2018-06-11 18:48:43 +00:00
|
|
|
|
|
|
|
#pragma once
|
2016-07-26 19:27:02 +00:00
|
|
|
|
2018-06-12 20:08:31 +00:00
|
|
|
#include "gl_load/gl_system.h"
|
2016-07-26 19:27:02 +00:00
|
|
|
#include "gl_shader.h"
|
2018-06-13 20:08:55 +00:00
|
|
|
#include "hwrenderer/postprocessing/hw_shaderprogram.h"
|
2018-06-11 18:48:43 +00:00
|
|
|
|
2018-06-13 20:08:55 +00:00
|
|
|
class FShaderProgram : public IShaderProgram
|
2016-07-26 19:27:02 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-08-25 23:40:28 +00:00
|
|
|
FShaderProgram();
|
2016-07-26 19:27:02 +00:00
|
|
|
~FShaderProgram();
|
|
|
|
|
2018-06-13 20:08:55 +00:00
|
|
|
void Compile(ShaderType type, const char *lumpName, const char *defines, int maxGlslVersion) override;
|
|
|
|
void Compile(ShaderType type, const char *name, const FString &code, const char *defines, int maxGlslVersion) override;
|
2016-07-26 19:27:02 +00:00
|
|
|
void Link(const char *name);
|
2018-06-11 20:33:55 +00:00
|
|
|
void SetUniformBufferLocation(int index, const char *name);
|
2018-06-13 13:53:56 +00:00
|
|
|
|
2018-06-13 20:08:55 +00:00
|
|
|
void Bind(IRenderQueue *q) override; // the parameter here is just a preparation for Vulkan
|
2016-07-26 19:27:02 +00:00
|
|
|
|
2018-06-13 20:08:55 +00:00
|
|
|
GLuint Handle() { return mProgram; }
|
|
|
|
//explicit operator bool() const { return mProgram != 0; }
|
2016-07-26 19:27:02 +00:00
|
|
|
|
|
|
|
private:
|
2016-08-25 23:40:28 +00:00
|
|
|
FShaderProgram(const FShaderProgram &) = delete;
|
|
|
|
FShaderProgram &operator=(const FShaderProgram &) = delete;
|
|
|
|
|
2018-06-13 13:53:56 +00:00
|
|
|
FString PatchShader(ShaderType type, const FString &code, const char *defines, int maxGlslVersion);
|
2016-07-29 19:31:20 +00:00
|
|
|
|
2016-07-26 19:27:02 +00:00
|
|
|
void CreateShader(ShaderType type);
|
|
|
|
FString GetShaderInfoLog(GLuint handle);
|
|
|
|
FString GetProgramInfoLog(GLuint handle);
|
|
|
|
|
|
|
|
GLuint mProgram = 0;
|
|
|
|
GLuint mShaders[NumShaderTypes];
|
2018-06-13 13:53:56 +00:00
|
|
|
TArray<std::pair<FString, int>> samplerstobind;
|
2016-07-26 19:27:02 +00:00
|
|
|
};
|