mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Remove GL shader/program object labels, add support for geometry shaders
This commit is contained in:
@@ -272,7 +272,6 @@ void main()
|
||||
glBufferStorage(GL_UNIFORM_BUFFER, sizeof(Vec4f), &red, 0);
|
||||
|
||||
GLuint program = MakeProgram(vertex, pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
while(Running())
|
||||
{
|
||||
|
||||
@@ -334,7 +334,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
Vec4f cbufferdata[684];
|
||||
|
||||
|
||||
@@ -200,7 +200,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
GLuint gl_fromd3d = MakeTexture();
|
||||
HANDLE interop_fromd3d =
|
||||
|
||||
@@ -76,7 +76,6 @@ void main()
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
GLuint program = MakeProgram(vertex, pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
while(Running())
|
||||
{
|
||||
|
||||
@@ -96,7 +96,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
const int width = 4;
|
||||
const int height = 4;
|
||||
|
||||
@@ -101,7 +101,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
while(Running())
|
||||
{
|
||||
|
||||
@@ -103,7 +103,6 @@ void main()
|
||||
glBufferStorage(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32_t) * 3, idxs, 0);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
GraphicsWindow *win2 = NULL;
|
||||
void *ctx2 = NULL;
|
||||
|
||||
@@ -84,7 +84,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(vertex, pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
GLuint tex = MakeTexture();
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
|
||||
@@ -98,7 +98,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
GraphicsWindow *win2 = MakeWindow(300, 200, "Autotesting 2");
|
||||
void *ctx2 = MakeContext(win2, mainContext);
|
||||
|
||||
@@ -157,7 +157,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
GLuint fbo = MakeFBO();
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
|
||||
|
||||
@@ -97,7 +97,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
while(Running())
|
||||
{
|
||||
|
||||
@@ -134,7 +134,6 @@ void main()
|
||||
glBindBufferBase(GL_UNIFORM_BUFFER, 1, fsbuf);
|
||||
|
||||
GLuint glslprogram = MakeProgram(vertex, pixel);
|
||||
glObjectLabel(GL_PROGRAM, glslprogram, -1, "Full program");
|
||||
|
||||
GLuint spirvprogram = MakeProgram();
|
||||
|
||||
|
||||
@@ -153,7 +153,6 @@ void main()
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
float data[16 * 100];
|
||||
|
||||
|
||||
@@ -70,10 +70,11 @@ void OpenGLGraphicsTest::Shutdown()
|
||||
DestroyContext(mainContext);
|
||||
}
|
||||
|
||||
GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc, bool sep)
|
||||
GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc, std::string geomSrc)
|
||||
{
|
||||
GLuint vs = vertSrc.empty() ? 0 : glCreateShader(GL_VERTEX_SHADER);
|
||||
GLuint fs = fragSrc.empty() ? 0 : glCreateShader(GL_FRAGMENT_SHADER);
|
||||
GLuint gs = geomSrc.empty() ? 0 : glCreateShader(GL_GEOMETRY_SHADER);
|
||||
|
||||
const char *cstr = NULL;
|
||||
|
||||
@@ -81,7 +82,6 @@ GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc,
|
||||
{
|
||||
cstr = vertSrc.c_str();
|
||||
glShaderSource(vs, 1, &cstr, NULL);
|
||||
glObjectLabel(GL_SHADER, vs, -1, "VS doodad");
|
||||
glCompileShader(vs);
|
||||
}
|
||||
|
||||
@@ -89,10 +89,16 @@ GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc,
|
||||
{
|
||||
cstr = fragSrc.c_str();
|
||||
glShaderSource(fs, 1, &cstr, NULL);
|
||||
glObjectLabel(GL_SHADER, fs, -1, "FS thingy");
|
||||
glCompileShader(fs);
|
||||
}
|
||||
|
||||
if(gs)
|
||||
{
|
||||
cstr = geomSrc.c_str();
|
||||
glShaderSource(gs, 1, &cstr, NULL);
|
||||
glCompileShader(gs);
|
||||
}
|
||||
|
||||
char buffer[1024];
|
||||
GLint status = 0;
|
||||
|
||||
@@ -107,6 +113,7 @@ GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc,
|
||||
TEST_ERROR("Shader error: %s", buffer);
|
||||
glDeleteShader(vs);
|
||||
glDeleteShader(fs);
|
||||
glDeleteShader(gs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -121,6 +128,22 @@ GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc,
|
||||
TEST_ERROR("Shader error: %s", buffer);
|
||||
glDeleteShader(vs);
|
||||
glDeleteShader(fs);
|
||||
glDeleteShader(gs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(gs)
|
||||
glGetShaderiv(gs, GL_COMPILE_STATUS, &status);
|
||||
else
|
||||
status = 1;
|
||||
|
||||
if(status == 0)
|
||||
{
|
||||
glGetShaderInfoLog(gs, 1024, NULL, buffer);
|
||||
TEST_ERROR("Shader error: %s", buffer);
|
||||
glDeleteShader(vs);
|
||||
glDeleteShader(fs);
|
||||
glDeleteShader(gs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -130,8 +153,10 @@ GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc,
|
||||
glAttachShader(program, vs);
|
||||
if(fs)
|
||||
glAttachShader(program, fs);
|
||||
if(gs)
|
||||
glAttachShader(program, gs);
|
||||
|
||||
if(!vs || !fs || sep)
|
||||
if(!vs || !fs)
|
||||
glProgramParameteri(program, GL_PROGRAM_SEPARABLE, GL_TRUE);
|
||||
|
||||
glLinkProgram(program);
|
||||
@@ -156,6 +181,11 @@ GLuint OpenGLGraphicsTest::MakeProgram(std::string vertSrc, std::string fragSrc,
|
||||
glDetachShader(program, fs);
|
||||
glDeleteShader(fs);
|
||||
}
|
||||
if(gs)
|
||||
{
|
||||
glDetachShader(program, gs);
|
||||
glDeleteShader(gs);
|
||||
}
|
||||
|
||||
if(program)
|
||||
managedResources.progs.push_back(program);
|
||||
|
||||
@@ -44,7 +44,7 @@ struct OpenGLGraphicsTest : public GraphicsTest
|
||||
|
||||
void PostInit();
|
||||
|
||||
GLuint MakeProgram(std::string vertSrc, std::string fragSrc, bool sep = false);
|
||||
GLuint MakeProgram(std::string vertSrc, std::string fragSrc, std::string geomSrc = "");
|
||||
GLuint MakeProgram();
|
||||
GLuint MakePipeline();
|
||||
GLuint MakeBuffer();
|
||||
|
||||
@@ -101,7 +101,6 @@ void main()
|
||||
glBufferStorage(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32_t) * 3, idxs, 0);
|
||||
|
||||
GLuint program = MakeProgram(common + vertex, common + pixel);
|
||||
glObjectLabel(GL_PROGRAM, program, -1, "Full program");
|
||||
|
||||
while(Running())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user