summaryrefslogtreecommitdiff
path: root/cogl/cogl-pipeline-progend-glsl.c
Commit message (Collapse)AuthorAgeFilesLines
* cogl: rename cogl-context.h cogl-context-private.hRobert Bragg2011-04-111-1/+1
| | | | | Since we plan to add public cogl_context_* API we need to rename the current cogl-context.h which contains private member details.
* cogl-pipeline-progend-glsl: Generalize updating GLES2 uniformsNeil Roberts2011-01-241-57/+77
| | | | | | | | | | | The uniforms for the alpha test reference value and point size on GLES2 are updating using similar code. This generalizes the code so that there is a static array of predefined builtin uniforms which contains the uniform name, a pointer to a function to get the value from the pipeline, a pointer to a function to update the uniform and a flag representing which CoglPipelineState change affects the uniform. The uniforms are then updated in a loop. This should simplify adding more builtin uniforms.
* pipeline: differentiate texture target and data stateRobert Bragg2011-01-131-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There are several places where we need to compare the texture state of a pipeline and sometimes we need to take into consideration if the underlying texture has changed but other times we may only care to know if the texture target has changed. For example the fragends typically generate programs that they want to share with all pipelines with equivalent fragment processing state, and in this case when comparing pipelines we only care about the texture targets since changes to the underlying texture won't affect the programs generated. Prior to this we had tried to handle this by passing around some special flags to various functions that evaluate pipeline state to say when we do/don't care about the texture data, but this wasn't working in all cases and was more awkward to manage than the new approach. Now we simply have two state bits: COGL_PIPELINE_LAYER_STATE_TEXTURE_TARGET and COGL_PIPELINE_LAYER_STATE_TEXTURE_DATA and CoglPipelineLayer has an additional target member. Since all the appropriate code takes masks of these state bits to determine what to evaluate we don't need any extra magic flags.
* Remove the GLES2 wrapperNeil Roberts2010-12-131-30/+4
| | | | | | The GLES2 wrapper is no longer needed because the shader generation is done within the GLSL fragend and vertend and any functions that are different for GLES2 are now guarded by #ifdefs.
* cogl: upload matrices with uniforms on GLES2Neil Roberts2010-12-131-1/+249
| | | | | | | | | | | | | | | | | | | | | Once the GLES2 wrapper is removed we won't be able to upload the matrices with the fixed function API any more. The fixed function API gives a global state for setting the matrix but if a custom shader uniform is used for the matrices then the state is per program. _cogl_matrix_stack_flush_to_gl is called in a few places and it is assumed the current pipeline doesn't need to be flushed before it is called. To allow these semantics to continue to work, on GLES2 the matrix flush now just stores a reference to the matrix stack in the CoglContext. A pre_paint virtual is added to the progend which is called whenever a pipeline is flushed, even if the same pipeline was flushed already. This gives the GLSL progend a chance to upload the matrices to the uniforms. The combined modelview/projection matrix is only calculated if it is used. The generated programs end up never using the modelview or projection matrix so it usually only has to upload the combined matrix. When a matrix stack is flushed a reference is taked to it by the pipeline progend and the age is stored so that if the same state is used with the same program again then we don't need to reupload the uniform.
* cogl-vertex-attribute: Use glVertexAttribPointer on GLES2Neil Roberts2010-12-131-0/+139
| | | | | | | | | | | When the GLES2 wrapper is removed we can't use the fixed function API such as glColorPointer to set the builtin attributes. Instead the GLSL progend now maintains a cache of attribute locations that are queried with glGetAttribLocation. The code that previously maintained a cache of the enabled texture coord arrays has been modified to also cache the enabled vertex attributes under GLES2. The vertex attribute API is now the only place that is using this cache so it has been moved into cogl-vertex-attribute.c
* cogl: Add a vertend to generate GLSLNeil Roberts2010-12-131-28/+55
| | | | | | The GLSL vertend is mostly only useful for GLES2. The fixed function vertend is kept at higher priority than the GLSL vertend so it is unlikely to be used in any other circumstances.
* cogl-pipeline: Rename the fragment_{source,header}_buffer to codegenNeil Roberts2010-12-131-6/+6
| | | | | We want to reuse the same buffers for vertends so calling them fragment_* doesn't make sense.
* cogl: Add a GLSL 'progend'Neil Roberts2010-12-131-0/+542
'progend' is short for 'program backend'. The progend is intended to operate on combined state from a fragment backend and a vertex backend. The progend has an 'end' function which is run whenever the pipeline is flushed and the two pipeline change notification functions. All of the progends are run whenever the pipeline is flushed instead of selecting a single one because it is possible that multiple progends may be in use for example if the vertends and fragends are different. The GLSL progend will take the shaders generated by the fragend and vertend and link them into a single program. The fragend code has been changed to only generate the shader and not the program. The idea is that pipelines can share fragment shader objects even if their vertex state is different. The authority for the progend needs to be the combined authority on the vertend and fragend state.