glsl: Use layer numbers not unit numbers for builtin uniforms
When generating GLSL code, the names of the builtin uniforms for the sampler and the layer constant have been renamed to use the layer number not the unit number. This will make it easier if we ever want to make them public. Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
parent
e6b3bfa41a
commit
aa9c293502
@ -367,11 +367,9 @@ add_constant_lookup (CoglPipelineShaderState *shader_state,
|
||||
CoglPipelineLayer *layer,
|
||||
const char *swizzle)
|
||||
{
|
||||
int unit_index = _cogl_pipeline_layer_get_unit_index (layer);
|
||||
|
||||
g_string_append_printf (shader_state->header,
|
||||
"_cogl_layer_constant_%i.%s",
|
||||
unit_index, swizzle);
|
||||
layer->index, swizzle);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -456,7 +454,7 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
|
||||
g_string_append_printf (shader_state->header,
|
||||
"uniform sampler%s _cogl_sampler_%i;\n",
|
||||
target_string,
|
||||
unit_index);
|
||||
layer->index);
|
||||
|
||||
g_string_append_printf (shader_state->header,
|
||||
"vec4\n"
|
||||
@ -471,7 +469,7 @@ ensure_texture_lookup_generated (CoglPipelineShaderState *shader_state,
|
||||
else
|
||||
g_string_append_printf (shader_state->header,
|
||||
"texture%s (_cogl_sampler_%i, coords.%s);\n",
|
||||
target_string, unit_index, tex_coord_swizzle);
|
||||
target_string, layer->index, tex_coord_swizzle);
|
||||
|
||||
g_string_append (shader_state->header, "}\n");
|
||||
}
|
||||
@ -612,7 +610,7 @@ ensure_arg_generated (CoglPipeline *pipeline,
|
||||
{
|
||||
g_string_append_printf (shader_state->header,
|
||||
"uniform vec4 _cogl_layer_constant_%i;\n",
|
||||
unit_index);
|
||||
layer->index);
|
||||
shader_state->unit_state[unit_index].combine_constant_used = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ get_uniform_cb (CoglPipeline *pipeline,
|
||||
the program has now been linked */
|
||||
g_string_set_size (ctx->codegen_source_buffer, 0);
|
||||
g_string_append_printf (ctx->codegen_source_buffer,
|
||||
"_cogl_sampler_%i", state->unit);
|
||||
"_cogl_sampler_%i", layer_index);
|
||||
|
||||
GE_RET( uniform_location,
|
||||
ctx, glGetUniformLocation (state->gl_program,
|
||||
@ -386,7 +386,7 @@ get_uniform_cb (CoglPipeline *pipeline,
|
||||
|
||||
g_string_set_size (ctx->codegen_source_buffer, 0);
|
||||
g_string_append_printf (ctx->codegen_source_buffer,
|
||||
"_cogl_layer_constant_%i", state->unit);
|
||||
"_cogl_layer_constant_%i", layer_index);
|
||||
|
||||
GE_RET( uniform_location,
|
||||
ctx, glGetUniformLocation (state->gl_program,
|
||||
|
Loading…
Reference in New Issue
Block a user