mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
Add test of degenerate vertex shaders with no outputs but full GS output
This commit is contained in:
@@ -75,6 +75,40 @@ void main()
|
||||
Color = col;
|
||||
}
|
||||
|
||||
)EOSHADER";
|
||||
|
||||
std::string nopvertex = R"EOSHADER(
|
||||
#version 420 core
|
||||
|
||||
void main()
|
||||
{
|
||||
}
|
||||
|
||||
)EOSHADER";
|
||||
|
||||
std::string geometry = R"EOSHADER(
|
||||
#version 420 core
|
||||
|
||||
layout(points) in;
|
||||
layout(triangle_strip, max_vertices = 3) out;
|
||||
|
||||
out vec4 col;
|
||||
|
||||
void main()
|
||||
{
|
||||
const vec4 verts[3] = vec4[3](vec4(-0.4, -0.4, 0.5, 1.0), vec4(0.6, -0.6, 0.5, 1.0),
|
||||
vec4(-0.5, 0.5, 0.5, 1.0));
|
||||
|
||||
for(int i=0; i < 3; i++)
|
||||
{
|
||||
gl_Position = verts[i];
|
||||
col = vec4(1, 0, 0, 1);
|
||||
EmitVertex();
|
||||
}
|
||||
|
||||
EndPrimitive();
|
||||
}
|
||||
|
||||
)EOSHADER";
|
||||
|
||||
int main()
|
||||
@@ -152,6 +186,8 @@ void main()
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
|
||||
GLuint geomprogram = MakeProgram(nopvertex, common + pixel, geometry);
|
||||
|
||||
GLuint fbo = MakeFBO();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
|
||||
@@ -201,6 +237,12 @@ void main()
|
||||
|
||||
glDrawArrays(GL_POINTS, 0, 1);
|
||||
|
||||
setMarker("Geom Only");
|
||||
|
||||
glUseProgram(geomprogram);
|
||||
|
||||
glDrawArrays(GL_POINTS, 0, 1);
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glBlitFramebuffer(0, 0, screenWidth, screenHeight, 0, 0, screenWidth, screenHeight,
|
||||
|
||||
@@ -10,4 +10,33 @@ class GL_Mesh_Zoo(rdtest.TestCase):
|
||||
self.zoo_helper = rdtest.Mesh_Zoo()
|
||||
|
||||
def check_capture(self):
|
||||
self.zoo_helper.check_capture(self.capture_filename, self.controller)
|
||||
self.zoo_helper.check_capture(self.capture_filename, self.controller)
|
||||
|
||||
# Test GL-only thing with geometry shader only and completely no-op vertex shader
|
||||
self.controller.SetFrameEvent(self.zoo_helper.find_draw("Geom Only").next.eventId, False)
|
||||
|
||||
pos: rd.MeshFormat = self.controller.GetPostVSData(0, 0, rd.MeshDataStage.VSOut)
|
||||
|
||||
# vertex output should be completely empty
|
||||
self.check(pos.vertexByteStride == 0)
|
||||
self.check(pos.numIndices == 0)
|
||||
self.check(self.controller.GetBufferData(pos.vertexResourceId, 0, 0) == bytes())
|
||||
|
||||
gsout_ref = {
|
||||
0: {
|
||||
'gl_Position': [-0.4, -0.4, 0.5, 1.0],
|
||||
'col': [1.0, 0.0, 0.0, 1.0],
|
||||
},
|
||||
1: {
|
||||
'gl_Position': [0.6, -0.6, 0.5, 1.0],
|
||||
'col': [1.0, 0.0, 0.0, 1.0],
|
||||
},
|
||||
2: {
|
||||
'gl_Position': [-0.5, 0.5, 0.5, 1.0],
|
||||
'col': [1.0, 0.0, 0.0, 1.0],
|
||||
},
|
||||
}
|
||||
|
||||
self.check_mesh_data(gsout_ref, self.get_postvs(rd.MeshDataStage.GSOut))
|
||||
|
||||
rdtest.log.success("Geometry-only pass is as expected")
|
||||
|
||||
Reference in New Issue
Block a user