mesa: remove superfluous "native" limits and stats

We don't ever set these to anything else than the same as the non-native
counterparts. Let's drop the members in the first place, and use the
non-native version instead.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31538>
This commit is contained in:
Erik Faye-Lund 2024-10-05 17:02:54 +02:00 committed by Marge Bot
parent cf71e5534b
commit 12eba85544
7 changed files with 18 additions and 113 deletions

View file

@ -894,64 +894,44 @@ get_program_iv(struct gl_program *prog, GLenum target, GLenum pname,
*params = prog->Id;
return;
case GL_PROGRAM_INSTRUCTIONS_ARB:
case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
*params = prog->arb.NumInstructions;
return;
case GL_MAX_PROGRAM_INSTRUCTIONS_ARB:
case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
*params = limits->MaxInstructions;
return;
case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
*params = prog->arb.NumNativeInstructions;
return;
case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB:
*params = limits->MaxNativeInstructions;
return;
case GL_PROGRAM_TEMPORARIES_ARB:
case GL_PROGRAM_NATIVE_TEMPORARIES_ARB:
*params = prog->arb.NumTemporaries;
return;
case GL_MAX_PROGRAM_TEMPORARIES_ARB:
case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB:
*params = limits->MaxTemps;
return;
case GL_PROGRAM_NATIVE_TEMPORARIES_ARB:
*params = prog->arb.NumNativeTemporaries;
return;
case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB:
*params = limits->MaxNativeTemps;
return;
case GL_PROGRAM_PARAMETERS_ARB:
case GL_PROGRAM_NATIVE_PARAMETERS_ARB:
*params = prog->arb.NumParameters;
return;
case GL_MAX_PROGRAM_PARAMETERS_ARB:
case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB:
*params = limits->MaxParameters;
return;
case GL_PROGRAM_NATIVE_PARAMETERS_ARB:
*params = prog->arb.NumNativeParameters;
return;
case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB:
*params = limits->MaxNativeParameters;
return;
case GL_PROGRAM_ATTRIBS_ARB:
case GL_PROGRAM_NATIVE_ATTRIBS_ARB:
*params = prog->arb.NumAttributes;
return;
case GL_MAX_PROGRAM_ATTRIBS_ARB:
case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB:
*params = limits->MaxAttribs;
return;
case GL_PROGRAM_NATIVE_ATTRIBS_ARB:
*params = prog->arb.NumNativeAttributes;
return;
case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB:
*params = limits->MaxNativeAttribs;
return;
case GL_PROGRAM_ADDRESS_REGISTERS_ARB:
case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
*params = prog->arb.NumAddressRegs;
return;
case GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB:
*params = limits->MaxAddressRegs;
return;
case GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
*params = prog->arb.NumNativeAddressRegs;
return;
case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB:
*params = limits->MaxNativeAddressRegs;
*params = limits->MaxAddressRegs;
return;
case GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB:
*params = limits->MaxLocalParams;
@ -988,40 +968,28 @@ get_program_iv(struct gl_program *prog, GLenum target, GLenum pname,
const struct gl_program *fp = ctx->FragmentProgram.Current;
switch (pname) {
case GL_PROGRAM_ALU_INSTRUCTIONS_ARB:
*params = fp->arb.NumNativeAluInstructions;
return;
case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
*params = fp->arb.NumAluInstructions;
return;
case GL_PROGRAM_TEX_INSTRUCTIONS_ARB:
case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
*params = fp->arb.NumTexInstructions;
return;
case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
*params = fp->arb.NumNativeTexInstructions;
return;
case GL_PROGRAM_TEX_INDIRECTIONS_ARB:
case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
*params = fp->arb.NumTexIndirections;
return;
case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
*params = fp->arb.NumNativeTexIndirections;
return;
case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB:
case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
*params = limits->MaxAluInstructions;
return;
case GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB:
*params = limits->MaxNativeAluInstructions;
return;
case GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB:
case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
*params = limits->MaxTexInstructions;
return;
case GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB:
*params = limits->MaxNativeTexInstructions;
return;
case GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB:
*params = limits->MaxTexIndirections;
return;
case GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB:
*params = limits->MaxNativeTexIndirections;
*params = limits->MaxTexIndirections;
return;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetProgramivARB(pname)");

View file

@ -400,15 +400,6 @@ struct gl_program_constants
GLuint MaxParameters;
GLuint MaxLocalParams;
GLuint MaxEnvParams;
/* native/hardware limits */
GLuint MaxNativeInstructions;
GLuint MaxNativeAluInstructions;
GLuint MaxNativeTexInstructions;
GLuint MaxNativeTexIndirections;
GLuint MaxNativeAttribs;
GLuint MaxNativeTemps;
GLuint MaxNativeAddressRegs;
GLuint MaxNativeParameters;
/* For shaders */
GLuint MaxUniformComponents; /**< Usually == MaxParameters * 4 */

View file

@ -328,18 +328,6 @@ init_program_limits(struct gl_constants *consts, gl_shader_stage stage,
assert(0 && "Bad shader stage in init_program_limits()");
}
/* Set the native limits to zero. This implies that there is no native
* support for shaders. Let the drivers fill in the actual values.
*/
prog->MaxNativeInstructions = 0;
prog->MaxNativeAluInstructions = 0;
prog->MaxNativeTexInstructions = 0;
prog->MaxNativeTexIndirections = 0;
prog->MaxNativeAttribs = 0;
prog->MaxNativeTemps = 0;
prog->MaxNativeAddressRegs = 0;
prog->MaxNativeParameters = 0;
/* Set GLSL datatype range/precision info assuming IEEE float values.
* Drivers should override these defaults as needed.
*/

View file

@ -646,17 +646,6 @@ struct gl_program
GLuint NumTexInstructions;
GLuint NumTexIndirections;
/*@}*/
/** Native, actual h/w counts */
/*@{*/
GLuint NumNativeInstructions;
GLuint NumNativeTemporaries;
GLuint NumNativeParameters;
GLuint NumNativeAttributes;
GLuint NumNativeAddressRegs;
GLuint NumNativeAluInstructions;
GLuint NumNativeTexInstructions;
GLuint NumNativeTexIndirections;
/*@}*/
/** Used by ARB assembly-style programs. Can only be true for vertex
* programs.

View file

@ -96,17 +96,9 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
program->arb.NumParameters = prog.arb.NumParameters;
program->arb.NumAttributes = prog.arb.NumAttributes;
program->arb.NumAddressRegs = prog.arb.NumAddressRegs;
program->arb.NumNativeInstructions = prog.arb.NumNativeInstructions;
program->arb.NumNativeTemporaries = prog.arb.NumNativeTemporaries;
program->arb.NumNativeParameters = prog.arb.NumNativeParameters;
program->arb.NumNativeAttributes = prog.arb.NumNativeAttributes;
program->arb.NumNativeAddressRegs = prog.arb.NumNativeAddressRegs;
program->arb.NumAluInstructions = prog.arb.NumAluInstructions;
program->arb.NumTexInstructions = prog.arb.NumTexInstructions;
program->arb.NumTexIndirections = prog.arb.NumTexIndirections;
program->arb.NumNativeAluInstructions = prog.arb.NumAluInstructions;
program->arb.NumNativeTexInstructions = prog.arb.NumTexInstructions;
program->arb.NumNativeTexIndirections = prog.arb.NumTexIndirections;
program->info.inputs_read = prog.info.inputs_read;
program->info.outputs_written = prog.info.outputs_written;
program->arb.IndirectRegisterFiles = prog.arb.IndirectRegisterFiles;
@ -174,11 +166,6 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
program->arb.NumParameters = prog.arb.NumParameters;
program->arb.NumAttributes = prog.arb.NumAttributes;
program->arb.NumAddressRegs = prog.arb.NumAddressRegs;
program->arb.NumNativeInstructions = prog.arb.NumNativeInstructions;
program->arb.NumNativeTemporaries = prog.arb.NumNativeTemporaries;
program->arb.NumNativeParameters = prog.arb.NumNativeParameters;
program->arb.NumNativeAttributes = prog.arb.NumNativeAttributes;
program->arb.NumNativeAddressRegs = prog.arb.NumNativeAddressRegs;
program->info.inputs_read = prog.info.inputs_read;
program->info.outputs_written = prog.info.outputs_written;
program->arb.IndirectRegisterFiles = prog.arb.IndirectRegisterFiles;

View file

@ -2643,16 +2643,6 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st
state->prog->arb.NumAttributes =
util_bitcount64(state->prog->info.inputs_read);
/*
* Initialize native counts to logical counts. The device driver may
* change them if program is translated into a hardware program.
*/
state->prog->arb.NumNativeInstructions = state->prog->arb.NumInstructions;
state->prog->arb.NumNativeTemporaries = state->prog->arb.NumTemporaries;
state->prog->arb.NumNativeParameters = state->prog->arb.NumParameters;
state->prog->arb.NumNativeAttributes = state->prog->arb.NumAttributes;
state->prog->arb.NumNativeAddressRegs = state->prog->arb.NumAddressRegs;
result = GL_TRUE;
error:

View file

@ -223,28 +223,21 @@ void st_init_limits(struct pipe_screen *screen,
MAX_TEXTURE_IMAGE_UNITS);
pc->MaxInstructions =
pc->MaxNativeInstructions =
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INSTRUCTIONS);
pc->MaxAluInstructions =
pc->MaxNativeAluInstructions =
screen->get_shader_param(screen, sh,
PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS);
pc->MaxTexInstructions =
pc->MaxNativeTexInstructions =
screen->get_shader_param(screen, sh,
PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS);
pc->MaxTexIndirections =
pc->MaxNativeTexIndirections =
screen->get_shader_param(screen, sh,
PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS);
pc->MaxAttribs =
pc->MaxNativeAttribs =
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS);
pc->MaxTemps =
pc->MaxNativeTemps =
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_TEMPS);
pc->MaxAddressRegs =
pc->MaxNativeAddressRegs = sh == PIPE_SHADER_VERTEX ? 1 : 0;
pc->MaxAddressRegs = sh == PIPE_SHADER_VERTEX ? 1 : 0;
pc->MaxUniformComponents =
screen->get_shader_param(screen, sh,
@ -274,8 +267,7 @@ void st_init_limits(struct pipe_screen *screen,
* internal values in addition to what the source program uses. So, we
* drop the limit one step lower, to 2048, to be safe.
*/
pc->MaxParameters =
pc->MaxNativeParameters = MIN2(pc->MaxUniformComponents / 4, 2048);
pc->MaxParameters = MIN2(pc->MaxUniformComponents / 4, 2048);
pc->MaxInputComponents =
screen->get_shader_param(screen, sh, PIPE_SHADER_CAP_MAX_INPUTS) * 4;
pc->MaxOutputComponents =
@ -370,7 +362,7 @@ void st_init_limits(struct pipe_screen *screen,
!screen->get_shader_param(screen, sh,
PIPE_SHADER_CAP_INDIRECT_CONST_ADDR);
if (pc->MaxNativeInstructions &&
if (pc->MaxInstructions &&
(options->EmitNoIndirectUniform || pc->MaxUniformBlocks < 12)) {
can_ubo = false;
}