cogl-pipeline: Rename the fragment_{source,header}_buffer to codegen

We want to reuse the same buffers for vertends so calling them
fragment_* doesn't make sense.
This commit is contained in:
Neil Roberts 2010-12-02 18:05:22 +00:00
parent 3cf9159769
commit 0c732c27ae
5 changed files with 16 additions and 16 deletions

View File

@ -157,8 +157,8 @@ cogl_create_context (void)
_context->opaque_color_pipeline = cogl_pipeline_new (); _context->opaque_color_pipeline = cogl_pipeline_new ();
_context->blended_color_pipeline = cogl_pipeline_new (); _context->blended_color_pipeline = cogl_pipeline_new ();
_context->texture_pipeline = cogl_pipeline_new (); _context->texture_pipeline = cogl_pipeline_new ();
_context->fragment_header_buffer = g_string_new (""); _context->codegen_header_buffer = g_string_new ("");
_context->fragment_source_buffer = g_string_new (""); _context->codegen_source_buffer = g_string_new ("");
_context->source_stack = NULL; _context->source_stack = NULL;
_context->legacy_state_set = 0; _context->legacy_state_set = 0;

View File

@ -85,8 +85,8 @@ typedef struct
CoglPipeline *opaque_color_pipeline; /* used for set_source_color */ CoglPipeline *opaque_color_pipeline; /* used for set_source_color */
CoglPipeline *blended_color_pipeline; /* used for set_source_color */ CoglPipeline *blended_color_pipeline; /* used for set_source_color */
CoglPipeline *texture_pipeline; /* used for set_source_texture */ CoglPipeline *texture_pipeline; /* used for set_source_texture */
GString *fragment_header_buffer; GString *codegen_header_buffer;
GString *fragment_source_buffer; GString *codegen_source_buffer;
GList *source_stack; GList *source_stack;
int legacy_state_set; int legacy_state_set;

View File

@ -296,8 +296,8 @@ _cogl_pipeline_fragend_arbfp_start (CoglPipeline *pipeline,
int i; int i;
/* We reuse a single grow-only GString for code-gen */ /* We reuse a single grow-only GString for code-gen */
g_string_set_size (ctx->fragment_source_buffer, 0); g_string_set_size (ctx->codegen_source_buffer, 0);
arbfp_program_state->source = ctx->fragment_source_buffer; arbfp_program_state->source = ctx->codegen_source_buffer;
g_string_append (arbfp_program_state->source, g_string_append (arbfp_program_state->source,
"!!ARBfp1.0\n" "!!ARBfp1.0\n"
"TEMP output;\n" "TEMP output;\n"

View File

@ -303,10 +303,10 @@ _cogl_pipeline_fragend_glsl_start (CoglPipeline *pipeline,
other contains the main function. We need two strings other contains the main function. We need two strings
because we need to dynamically declare attributes as the because we need to dynamically declare attributes as the
add_layer callback is invoked */ add_layer callback is invoked */
g_string_set_size (ctx->fragment_header_buffer, 0); g_string_set_size (ctx->codegen_header_buffer, 0);
g_string_set_size (ctx->fragment_source_buffer, 0); g_string_set_size (ctx->codegen_source_buffer, 0);
priv->glsl_shader_state->header = ctx->fragment_header_buffer; priv->glsl_shader_state->header = ctx->codegen_header_buffer;
priv->glsl_shader_state->source = ctx->fragment_source_buffer; priv->glsl_shader_state->source = ctx->codegen_source_buffer;
g_string_append (priv->glsl_shader_state->source, g_string_append (priv->glsl_shader_state->source,
"void\n" "void\n"

View File

@ -221,13 +221,13 @@ get_uniform_cb (CoglPipeline *pipeline,
/* We can reuse the source buffer to create the uniform name because /* We can reuse the source buffer to create the uniform name because
the program has now been linked */ the program has now been linked */
g_string_set_size (ctx->fragment_source_buffer, 0); g_string_set_size (ctx->codegen_source_buffer, 0);
g_string_append_printf (ctx->fragment_source_buffer, g_string_append_printf (ctx->codegen_source_buffer,
"_cogl_sampler_%i", state->unit); "_cogl_sampler_%i", state->unit);
GE_RET( uniform_location, GE_RET( uniform_location,
glGetUniformLocation (state->gl_program, glGetUniformLocation (state->gl_program,
ctx->fragment_source_buffer->str) ); ctx->codegen_source_buffer->str) );
/* We can set the uniform immediately because the samplers are the /* We can set the uniform immediately because the samplers are the
unit index not the texture object number so it will never unit index not the texture object number so it will never
@ -236,13 +236,13 @@ get_uniform_cb (CoglPipeline *pipeline,
if (uniform_location != -1) if (uniform_location != -1)
GE( glUniform1i (uniform_location, state->unit) ); GE( glUniform1i (uniform_location, state->unit) );
g_string_set_size (ctx->fragment_source_buffer, 0); g_string_set_size (ctx->codegen_source_buffer, 0);
g_string_append_printf (ctx->fragment_source_buffer, g_string_append_printf (ctx->codegen_source_buffer,
"_cogl_layer_constant_%i", state->unit); "_cogl_layer_constant_%i", state->unit);
GE_RET( uniform_location, GE_RET( uniform_location,
glGetUniformLocation (state->gl_program, glGetUniformLocation (state->gl_program,
ctx->fragment_source_buffer->str) ); ctx->codegen_source_buffer->str) );
unit_state->combine_constant_uniform = uniform_location; unit_state->combine_constant_uniform = uniform_location;