diff options
author | Timothy Arceri <[email protected]> | 2015-09-30 11:00:02 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2015-10-05 10:53:24 +1100 |
commit | 763cd8c080353482cb41da578cb3d6f7892a0c9f (patch) | |
tree | dff9ba9c0e6a4ebc0e706d578fe5313bc1cbda4f /src/mesa | |
parent | b85757bc72350df609f50e000512bc80d07f1497 (diff) |
glsl: reduce memory footprint of uniform_storage struct
The uniform will only be of a single type so store the data for
opaque types in a single array.
Cc: Francisco Jerez <[email protected]>
Cc: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_shader.cpp | 2 | ||||
-rw-r--r-- | src/mesa/main/shaderapi.c | 2 | ||||
-rw-r--r-- | src/mesa/main/uniform_query.cpp | 8 | ||||
-rw-r--r-- | src/mesa/program/ir_to_mesa.cpp | 5 | ||||
-rw-r--r-- | src/mesa/program/sampler.cpp | 4 |
5 files changed, 11 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp index c8568f77304..3960e869421 100644 --- a/src/mesa/drivers/dri/i965/brw_shader.cpp +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp @@ -1436,7 +1436,7 @@ brw_setup_image_uniform_values(gl_shader_stage stage, &stage_prog_data->param[param_start_index]; for (unsigned i = 0; i < MAX2(storage->array_elements, 1); i++) { - const unsigned image_idx = storage->image[stage].index + i; + const unsigned image_idx = storage->opaque[stage].index + i; const brw_image_param *image_param = &stage_prog_data->image_param[image_idx]; diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c index 13fdf8c033b..9dd1054c8ee 100644 --- a/src/mesa/main/shaderapi.c +++ b/src/mesa/main/shaderapi.c @@ -2597,7 +2597,7 @@ _mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location, { struct gl_uniform_storage *uni = sh->SubroutineUniformRemapTable[location]; - int offset = location - uni->subroutine[stage].index; + int offset = location - uni->opaque[stage].index; memcpy(params, &uni->storage[offset], sizeof(GLuint)); } diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 33c959dc1a5..d48729778ae 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -804,11 +804,11 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, /* If the shader stage doesn't use the sampler uniform, skip this. */ - if (sh == NULL || !uni->sampler[i].active) + if (sh == NULL || !uni->opaque[i].active) continue; for (int j = 0; j < count; j++) { - sh->SamplerUnits[uni->sampler[i].index + offset + j] = + sh->SamplerUnits[uni->opaque[i].index + offset + j] = ((unsigned *) values)[j]; } @@ -850,11 +850,11 @@ _mesa_uniform(struct gl_context *ctx, struct gl_shader_program *shProg, */ if (uni->type->is_image()) { for (int i = 0; i < MESA_SHADER_STAGES; i++) { - if (uni->image[i].active) { + if (uni->opaque[i].active) { struct gl_shader *sh = shProg->_LinkedShaders[i]; for (int j = 0; j < count; j++) - sh->ImageUnits[uni->image[i].index + offset + j] = + sh->ImageUnits[uni->opaque[i].index + offset + j] = ((GLint *) values)[j]; } } diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 35ea791827a..e81f459da28 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -2352,11 +2352,12 @@ add_uniform_to_shader::visit_field(const glsl_type *type, const char *name, struct gl_uniform_storage *storage = &this->shader_program->UniformStorage[location]; - assert(storage->sampler[shader_type].active); + assert(storage->type->is_sampler() && + storage->opaque[shader_type].active); for (unsigned int j = 0; j < size / 4; j++) params->ParameterValues[index + j][0].f = - storage->sampler[shader_type].index + j; + storage->opaque[shader_type].index + j; } } diff --git a/src/mesa/program/sampler.cpp b/src/mesa/program/sampler.cpp index b1168fdade8..1198a3c45f1 100644 --- a/src/mesa/program/sampler.cpp +++ b/src/mesa/program/sampler.cpp @@ -119,7 +119,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, return 0; } - if (!shader_program->UniformStorage[location].sampler[shader].active) { + if (!shader_program->UniformStorage[location].opaque[shader].active) { assert(0 && "cannot return a sampler"); linker_error(shader_program, "cannot return a sampler named %s, because it is not " @@ -128,7 +128,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, return 0; } - return shader_program->UniformStorage[location].sampler[shader].index + + return shader_program->UniformStorage[location].opaque[shader].index + getname.offset; } |