aboutsummaryrefslogtreecommitdiff
path: root/include/RenderBackend/OpenGL/ShaderProgram.hpp
blob: efeae5bbdb9c52c79276e14d3aadfb0ba4d45893 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#pragma once

#include "VertexShader.hpp"
#include "PixelShader.hpp"
#include "../../Result.hpp"
#include "../../types.hpp"
#include <vector>

namespace amalgine
{
    class ShaderProgram
    {
    public:
        ShaderProgram();
        
        const std::string& getOutputAttributeName(i32 attributeIndex);
        ShaderOutputVec4 defineOutputVec4(const std::string &name);
        //Result<std::string> addVertexShader(const VertexShader &vertexShader);
        //Result<std::string> addPixelShader(const PixelShader &pixelShader);
        //void build();
    private:
        /*
         * Throws PixelShaderTooManyAttributes if too many pixel attributes are defined for the platform.
         * Throws PixelShaderAttributeAlreadyDefined if a pixel attribute with the same name has already been defined.
         */
        i32 defineOutputVariable(const std::string &variableName, const char *typeName);
    private:
        int locationCounter;
        i32 maxPixelAttribs; // Could make this static
        std::unordered_map<std::string, i32> pixelAttributes;
        std::vector<std::string> pixelAttributeNames;
        std::vector<u32> shaderIds;
    };
}