added geometry shader support. Untested, and i dunno if there is any real use for it
This commit is contained in:
parent
ed1e1c88f6
commit
08add66f94
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -33,7 +33,7 @@ namespace spades {
|
||||
bool compiled;
|
||||
|
||||
public:
|
||||
enum Type { VertexShader, FragmentShader };
|
||||
enum Type { VertexShader, FragmentShader, GeometryShader };
|
||||
|
||||
GLShader(IGLDevice *, Type);
|
||||
~GLShader();
|
||||
|
@ -199,6 +199,7 @@ namespace spades {
|
||||
|
||||
// shader type
|
||||
VertexShader,
|
||||
GeometryShader,
|
||||
FragmentShader,
|
||||
|
||||
// shader query
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user