added geometry shader support. Untested, and i dunno if there is any real use for it

This commit is contained in:
roboman2444 2017-05-21 21:01:32 -04:00
parent ed1e1c88f6
commit 08add66f94
5 changed files with 7 additions and 2 deletions

View File

@ -152,6 +152,8 @@ namespace spades {
type = GLShader::FragmentShader;
else if (name.find(".vs") != std::string::npos)
type = GLShader::VertexShader;
else if (name.find(".gs") != std::string::npos)
type = GLShader::GeometryShader;
else
SPRaise("Failed to determine the type of a shader: %s", name.c_str());
@ -184,7 +186,7 @@ namespace spades {
Stopwatch sw;
s->Compile();
SPLog("Successfully compiled GLSL program '%s' in %.3fms", name.c_str(),
SPLog("Successfully compiled GLSL program '%s' in %.3fms", name.c_str(), // should this be "program" or "shader"?
sw.GetTime() * 1000.);
return s;
}

View File

@ -31,6 +31,7 @@ namespace spades {
switch (type) {
case VertexShader: handle = device->CreateShader(IGLDevice::VertexShader); break;
case GeometryShader: handle = device->CreateShader(IGLDevice::GeometryShader); break;
case FragmentShader:
handle = device->CreateShader(IGLDevice::FragmentShader);
break;

View File

@ -33,7 +33,7 @@ namespace spades {
bool compiled;
public:
enum Type { VertexShader, FragmentShader };
enum Type { VertexShader, FragmentShader, GeometryShader };
GLShader(IGLDevice *, Type);
~GLShader();

View File

@ -199,6 +199,7 @@ namespace spades {
// shader type
VertexShader,
GeometryShader,
FragmentShader,
// shader query

View File

@ -1331,6 +1331,7 @@ namespace spades {
ret = glCreateShader(GL_FRAGMENT_SHADER);
break;
case draw::IGLDevice::VertexShader: ret = glCreateShader(GL_VERTEX_SHADER); break;
case draw::IGLDevice::GeometryShader: ret = glCreateShader(GL_GEOMETRY_SHADER); break;
default: SPInvalidEnum("type", type);
}
#endif