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 <emil.velikov@collabora.com>
This commit is contained in:
@@ -373,16 +373,17 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
|
||||
COPY_4V(value, ctx->FragmentProgram.Parameters[idx]);
|
||||
return;
|
||||
case STATE_LOCAL:
|
||||
if (!ctx->FragmentProgram.Current->LocalParams) {
|
||||
ctx->FragmentProgram.Current->LocalParams =
|
||||
if (!ctx->FragmentProgram.Current->arb.LocalParams) {
|
||||
ctx->FragmentProgram.Current->arb.LocalParams =
|
||||
rzalloc_array_size(ctx->FragmentProgram.Current,
|
||||
sizeof(float[4]),
|
||||
MAX_PROGRAM_LOCAL_PARAMS);
|
||||
if (!ctx->FragmentProgram.Current->LocalParams)
|
||||
if (!ctx->FragmentProgram.Current->arb.LocalParams)
|
||||
return;
|
||||
}
|
||||
|
||||
COPY_4V(value, ctx->FragmentProgram.Current->LocalParams[idx]);
|
||||
COPY_4V(value,
|
||||
ctx->FragmentProgram.Current->arb.LocalParams[idx]);
|
||||
return;
|
||||
default:
|
||||
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
|
||||
@@ -401,16 +402,17 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
|
||||
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
|
||||
return;
|
||||
case STATE_LOCAL:
|
||||
if (!ctx->VertexProgram.Current->LocalParams) {
|
||||
ctx->VertexProgram.Current->LocalParams =
|
||||
if (!ctx->VertexProgram.Current->arb.LocalParams) {
|
||||
ctx->VertexProgram.Current->arb.LocalParams =
|
||||
rzalloc_array_size(ctx->VertexProgram.Current,
|
||||
sizeof(float[4]),
|
||||
MAX_PROGRAM_LOCAL_PARAMS);
|
||||
if (!ctx->VertexProgram.Current->LocalParams)
|
||||
if (!ctx->VertexProgram.Current->arb.LocalParams)
|
||||
return;
|
||||
}
|
||||
|
||||
COPY_4V(value, ctx->VertexProgram.Current->LocalParams[idx]);
|
||||
COPY_4V(value,
|
||||
ctx->VertexProgram.Current->arb.LocalParams[idx]);
|
||||
return;
|
||||
default:
|
||||
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
|
||||
|
Reference in New Issue
Block a user