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

AZDO: Move constants into constant buffers #47

Open
xycaleth opened this issue May 1, 2016 · 0 comments
Open

AZDO: Move constants into constant buffers #47

xycaleth opened this issue May 1, 2016 · 0 comments

Comments

@xycaleth
Copy link
Owner

xycaleth commented May 1, 2016

There are a lot of cases where uniform data is bound multiple times to multiple shaders using glUniformXXX. Each driver call incur some cost. We can eliminate a large number of these calls by storing arrays of data in uniform buffers. Each object then has some index in a regular uniform to fetch the data it needs. For example:

struct ShaderData {
  vec4 color;
  vec4 foo;
  vec2 data;
};

layout(std140) uniform AllShaderData {
  ShaderData u_ShaderData[1024];
}

uniform int u_ShaderIndex;

void main() {
  gl_FragColor = u_ShaderData[u_ShaderIndex].color;
}
@xycaleth xycaleth mentioned this issue May 1, 2016
4 tasks
@xycaleth xycaleth modified the milestone: Milestone 4 May 1, 2016
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

1 participant