aboutsummaryrefslogtreecommitdiff
path: root/src/RenderBackend/OpenGL/PixelShader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/RenderBackend/OpenGL/PixelShader.cpp')
-rw-r--r--src/RenderBackend/OpenGL/PixelShader.cpp44
1 files changed, 2 insertions, 42 deletions
diff --git a/src/RenderBackend/OpenGL/PixelShader.cpp b/src/RenderBackend/OpenGL/PixelShader.cpp
index cbdc842..2a7c913 100644
--- a/src/RenderBackend/OpenGL/PixelShader.cpp
+++ b/src/RenderBackend/OpenGL/PixelShader.cpp
@@ -1,7 +1,4 @@
#include "../../../include/RenderBackend/OpenGL/PixelShader.hpp"
-#include "../../../include/RenderBackend/OpenGL/CommonShader.hpp"
-#include "../../../include/RenderBackend/OpenGL/opengl.hpp"
-#include <cassert>
using namespace std;
@@ -31,24 +28,11 @@ namespace amalgine
}
- PixelShader::PixelShader() : locationCounter(0), mainFuncDefined(false)
+ PixelShader::PixelShader() : mainFuncDefined(false)
{
- glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxPixelAttribs);
writeHeader("#version 330 core\n\n");
}
- const string& PixelShader::getOutputAttributeName(i32 attributeIndex)
- {
- assert(attributeIndex < pixelAttributeNames.size());
- return pixelAttributeNames[attributeIndex];
- }
-
- ShaderOutputVec4 PixelShader::defineOutputVec4(const std::string &name)
- {
- i32 attributeIndex = defineOutputVariable(name, "vec4");
- return ShaderOutputVec4(this, attributeIndex);
- }
-
void PixelShader::defineMain(PixelShaderMainFunc mainFunc)
{
if(mainFuncDefined)
@@ -68,31 +52,7 @@ namespace amalgine
writeBody(";\n");
}
- i32 PixelShader::defineOutputVariable(const string &variableName, const char *typeName)
- {
- if(!isShaderVariableNameValid(variableName.c_str()))
- throw PixelShaderInvalidAttributeName(variableName);
-
- if(locationCounter + 1 > maxPixelAttribs)
- throw PixelShaderTooManyAttributes(maxPixelAttribs);
-
- if(pixelAttributes.find(variableName) != pixelAttributes.end())
- throw PixelShaderAttributeAlreadyDefined(variableName);
-
- i32 attributeIndex = locationCounter;
- pixelAttributes[variableName] = locationCounter;
- pixelAttributeNames.push_back(variableName);
-
- ++locationCounter;
- writeHeader("out ");
- writeHeader(typeName);
- writeHeader(" ");
- writeHeader(variableName);
- writeHeader(";\n");
- return attributeIndex;
- }
-
- string PixelShader::build()
+ string PixelShader::build() const
{
std::string result;
result.reserve(header.size() + 2 + body.size());