Hello Johannes,

On 03/11/2014 04:26 AM, Johannes wrote:
> I have now finished the second draft of the UniformBufferObjChunk.
> Additionally, I have started an example for demonstration of its usage.
> Please take a look if all is correctly in place.

looks good to me. Not sure if you need the uiChunkId counter - I'm 
guessing that is copied from elsewhere (I've seen it in some other 
chunks), but it may not be needed here.

> The example is not
> finished yet, however, because one important part is still missing and I
> would like to gather some ideas about how to implement that part:
>
> I did specualte...
>
>  > ii) class UniformBlocks:
>  > ------------------------
>  > The responsibility of this class is to bind the shader uniform blocks
>  > to
>  > the binding points (bind_pnt). It should have a map of block names to
>  > UniformBufferObjectChunk objects providing the appropriate binding
>  > points. An instance of this class can be added to a
>  > ShaderProgramChunk
>  > object. On usage of such a program the uniform block binding must be
>  > established:
>  >
>  >      GLuint index = glGetUniformBlockIndex(
>  >                          _shader.GetProgram(), block_name);
>  >      glUniformBlockBinding(_shader.GetProgram(), index, bind_pnt);
>
> Questions:
> - Do you think that this is the 'correct' way to establish the uniform
> block binding? I.e. to design a class UniformBlocks for that purpose?

hmm, as you are remarking below there are similarities to "ordinary" 
uniform variables, i.e. in a sense one can view a uniform block as a 
single variable that is assigned the value of the binding point of the 
buffer. So perhaps a special kind of ShaderVariable?

> - Is the name UniformBlocks appropriate, or shouldn't it be better named
> ShaderProgramUniformBlocks?
>
> - How do I represent the map from string block name to
> UniformBufferObjChunk in the potential UniformBlocks class? I.e. how
> should I layout this map so that is works with clusters and aspects? Is
> there something like a field map? Or should I just track two
> synchronized multi fields for the names and the UnifromBufferObjChunks?

I think there is some infrastructure for maps that have FieldContainer 
as their mapped type, for example VariantMaterial has a mapping from 
RenderProperties to PrimeMaterial*. I've not used it though, so I'm 
afraid I don't know how general it is or even how to use it in practice, 
other than emulating what VariantMaterial does - sorry.

> - I did look into the shader program classes and found the following
> participants:
> ShaderProgram, ShaderProgramVariables, ShaderVariable,
> ShaderProgramVariableChunk, ShaderExecutableChunk,
> ShaderExecutableVarChunk.
> So I think that the potential UniformBlocks class somehow corresponds to
> the class ShaderProgramVariables (?). What I did not yet understand are
> the steps and measures I have to take in the ShaderExecutableChunk
> implementation. Maybe you could explain a little about these chunks,
> their lifetime and the general idea behind this part of the setup?

IIRC the ShaderExecutable* chunks are complete (linked) GLSL programs 
(i.e. those that can be enabled with glUseProgram). These can consist of 
multiple ShaderProgramChunks that are linked together - I believe the 
motivation here is to be able to construct the final program at various 
levels of the scene graph.
Each uniform variable is an object derived from ShaderVariable and 
ShaderProgramVariables is a container for a bunch of them.

> - Can I ask the UniformBufferObjChunk about the StateChunk slot it is
> assigned to? I need the binding point which corresponds to the slot
> index for establishing the uniform block binding.

I think what I wrote in reply to this yesterday wasn't addressing your 
question, let me try again. A StateChunk can be present in multiple 
Materials, so in general it depends on the context which slot it would 
occupy and hence you can not ask it for that information. Hmpf, off hand 
I can't think of a good solution to this - anybody else have any 
thoughts? Help, please?

        Cheers,
                Carsten


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to