Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need size for uniforms #258

Closed
RemiArnaud opened this issue Mar 26, 2014 · 7 comments
Closed

need size for uniforms #258

RemiArnaud opened this issue Mar 26, 2014 · 7 comments

Comments

@RemiArnaud
Copy link
Contributor

split from #100

need to add count to uniforms when it is a multiple of the size defined in the type.

for example

"jointMat": {
                    "semantic": "JOINT_MATRIX",
                    "type": 35676
                },

will become

"jointMat": {
                    "semantic": "JOINT_MATRIX",
                    "type": 35676,
                    "count": 7
                },
@fabrobinet
Copy link
Contributor

It is not strictly needed but developers will appreciate that, especially to allocate the memory needed upfront if they want to do it while reading techniques.
That count isn't explicitly present in the WebGL API because as it is contained in the array:

uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, 
                          Float32Array value);

But (of course) it is there on GL ES 2.0...

void glUniform4iv(  GLint location,
    GLsizei count,
    const GLint *value)

@pjcozzi
Copy link
Member

pjcozzi commented Apr 7, 2014

This is OK with me. Have we thought about uniform arrays in general, e.g., is the value array for a parameter still a 1D array where every sizeof(type) elements is one value in the uniform array?

@pjcozzi pjcozzi added this to the Draft 1.0 spec milestone Apr 30, 2014
@fabrobinet
Copy link
Contributor

the count will be only for arrays, and thus will actually indicate we deal with an array. mat4 joint[1] has to be differentiated from just mat4 joint;

@pjcozzi
Copy link
Member

pjcozzi commented Jun 23, 2014

So lack of count indicates a non-array and the presence of count (with count always >= 1) indicates an array? If so, I can update the 0.7 spec.

@fabrobinet
Copy link
Contributor

exactly

@pjcozzi
Copy link
Member

pjcozzi commented Jul 7, 2014

Spec updated in d10b1d0.

This impacts both uniforms and vertex attributes since both can reference parameters. This also keeps values as a 1D array so, for example, if a parameter is an array of two vec3s, the values array would have six elements, where the first three are one vec3 and the last three are the other.

A material parameter needs to override the entire array, not just individual elements. Is this OK for 1.0? We could add more fine-grained control later without a breaking change by adding offset and count properties.

Is there anything else we need to consider for this change?

@fabrobinet
Copy link
Contributor

That sounds fine to me, thanks @pjcozzi closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants