Porting GL4 geometry shaders. Likely not working.

This commit is contained in:
Ben Vanik
2016-02-20 16:35:21 -08:00
parent 769c58a9b2
commit b5a0c4715b
19 changed files with 2079 additions and 15 deletions

View File

@@ -0,0 +1,48 @@
// NOTE: This file is compiled and embedded into the exe.
// Use `xenia-build genspirv` and check in any changes under bin/.
#version 450
#extension all : warn
in gl_PerVertex {
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[];
} gl_in[];
out gl_PerVertex {
vec4 gl_Position;
float gl_PointSize;
float gl_ClipDistance[];
};
struct VertexData {
vec4 o[16];
};
layout(location = 1) in VertexData in_vtx[];
layout(location = 1) out VertexData out_vtx;
// TODO(benvanik): fetch default point size from register and use that if
// the VS doesn't write oPointSize.
// TODO(benvanik): clamp to min/max.
// TODO(benvanik): figure out how to see which interpolator gets adjusted.
layout(points) in;
layout(triangle_strip, max_vertices = 4) out;
void main() {
const vec2 offsets[4] = {
vec2(-1.0, 1.0),
vec2( 1.0, 1.0),
vec2(-1.0, -1.0),
vec2( 1.0, -1.0),
};
vec4 pos = gl_in[0].gl_Position;
float psize = gl_in[0].gl_PointSize;
for (int i = 0; i < 4; ++i) {
gl_Position = vec4(pos.xy + offsets[i] * psize, pos.zw);
out_vtx = in_vtx[0];
EmitVertex();
}
EndPrimitive();
}