gpu,gpu/gl: implement shader uniform buffers

Emulate them for the OpenGL ES backend because 2.0 doesn't support uniform
buffers. The future d3d backend only supports uniform (constant) buffers.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-19 21:06:30 +01:00
parent ef3e94e7a7
commit 646a767665
12 changed files with 504 additions and 252 deletions
+6 -6
View File
@@ -8,11 +8,11 @@ layout(binding = 0) uniform Block {
float z;
vec2 scale;
vec2 offset;
vec2 uvScale;
vec2 uvOffset;
vec2 uvCoverScale;
vec2 uvCoverOffset;
} uniforms;
vec2 uvScale;
vec2 uvOffset;
};
layout(location = 0) in vec2 pos;
@@ -22,7 +22,7 @@ layout(location = 1) in vec2 uv;
layout(location = 1) out vec2 vUV;
void main() {
gl_Position = vec4(pos*uniforms.scale + uniforms.offset, uniforms.z, 1);
vUV = uv*uniforms.uvScale + uniforms.uvOffset;
vCoverUV = uv*uniforms.uvCoverScale+uniforms.uvCoverOffset;
gl_Position = vec4(pos*scale + offset, z, 1);
vUV = uv*uvScale + uvOffset;
vCoverUV = uv*uvCoverScale+uvCoverOffset;
}