diff options
author | Timothy Arceri <[email protected]> | 2016-11-17 10:52:28 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2016-11-17 12:53:12 +1100 |
commit | c3df65c123c6392b0b116900395a89fd3dbb9b85 (patch) | |
tree | 2b7c4a89aff0ccbbfb7f9fec4e0b0459858b58bb /src/mesa/main/arbprogram.c | |
parent | d6bdb3a86293da2164e9355f0262ef83afeece7f (diff) |
st/mesa/r200/i915/i965: move ARB program fields into a union
It's common for games to compile 2000 programs or more so at
32bits x 2000 programs x 22 fields x 2 (at least) stages
This should give us something like 352 kilobytes in savings
once we add some more glsl only fields.
Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/mesa/main/arbprogram.c')
-rw-r--r-- | src/mesa/main/arbprogram.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 8b25699b6bf..cb67fe33bb5 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -274,15 +274,14 @@ get_local_param_pointer(struct gl_context *ctx, const char *func, return GL_FALSE; } - if (!prog->LocalParams) { - prog->LocalParams = rzalloc_array_size(prog, sizeof(float[4]), + if (!prog->arb.LocalParams) { + prog->arb.LocalParams = rzalloc_array_size(prog, sizeof(float[4]), maxParams); - - if (!prog->LocalParams) + if (!prog->arb.LocalParams) return GL_FALSE; } - *param = prog->LocalParams[index]; + *param = prog->arb.LocalParams[index]; return GL_TRUE; } @@ -682,61 +681,61 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) *params = prog->Id; return; case GL_PROGRAM_INSTRUCTIONS_ARB: - *params = prog->NumInstructions; + *params = prog->arb.NumInstructions; return; case GL_MAX_PROGRAM_INSTRUCTIONS_ARB: *params = limits->MaxInstructions; return; case GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB: - *params = prog->NumNativeInstructions; + *params = prog->arb.NumNativeInstructions; return; case GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB: *params = limits->MaxNativeInstructions; return; case GL_PROGRAM_TEMPORARIES_ARB: - *params = prog->NumTemporaries; + *params = prog->arb.NumTemporaries; return; case GL_MAX_PROGRAM_TEMPORARIES_ARB: *params = limits->MaxTemps; return; case GL_PROGRAM_NATIVE_TEMPORARIES_ARB: - *params = prog->NumNativeTemporaries; + *params = prog->arb.NumNativeTemporaries; return; case GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB: *params = limits->MaxNativeTemps; return; case GL_PROGRAM_PARAMETERS_ARB: - *params = prog->NumParameters; + *params = prog->arb.NumParameters; return; case GL_MAX_PROGRAM_PARAMETERS_ARB: *params = limits->MaxParameters; return; case GL_PROGRAM_NATIVE_PARAMETERS_ARB: - *params = prog->NumNativeParameters; + *params = prog->arb.NumNativeParameters; return; case GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB: *params = limits->MaxNativeParameters; return; case GL_PROGRAM_ATTRIBS_ARB: - *params = prog->NumAttributes; + *params = prog->arb.NumAttributes; return; case GL_MAX_PROGRAM_ATTRIBS_ARB: *params = limits->MaxAttribs; return; case GL_PROGRAM_NATIVE_ATTRIBS_ARB: - *params = prog->NumNativeAttributes; + *params = prog->arb.NumNativeAttributes; return; case GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB: *params = limits->MaxNativeAttribs; return; case GL_PROGRAM_ADDRESS_REGISTERS_ARB: - *params = prog->NumAddressRegs; + *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->NumNativeAddressRegs; + *params = prog->arb.NumNativeAddressRegs; return; case GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB: *params = limits->MaxNativeAddressRegs; @@ -780,22 +779,22 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params) const struct gl_program *fp = ctx->FragmentProgram.Current; switch (pname) { case GL_PROGRAM_ALU_INSTRUCTIONS_ARB: - *params = fp->NumNativeAluInstructions; + *params = fp->arb.NumNativeAluInstructions; return; case GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB: - *params = fp->NumAluInstructions; + *params = fp->arb.NumAluInstructions; return; case GL_PROGRAM_TEX_INSTRUCTIONS_ARB: - *params = fp->NumTexInstructions; + *params = fp->arb.NumTexInstructions; return; case GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB: - *params = fp->NumNativeTexInstructions; + *params = fp->arb.NumNativeTexInstructions; return; case GL_PROGRAM_TEX_INDIRECTIONS_ARB: - *params = fp->NumTexIndirections; + *params = fp->arb.NumTexIndirections; return; case GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB: - *params = fp->NumNativeTexIndirections; + *params = fp->arb.NumNativeTexIndirections; return; case GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB: *params = limits->MaxAluInstructions; |