mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-25 05:21:02 +00:00
Add FBufferedUniformSampler because sampler uniforms may default bind to other locations than zero
This commit is contained in:
parent
b68bbaf617
commit
5f09d3b7ef
5 changed files with 28 additions and 6 deletions
|
@ -8,7 +8,7 @@ class FBloomExtractShader
|
|||
public:
|
||||
void Bind();
|
||||
|
||||
FBufferedUniform1i SceneTexture;
|
||||
FBufferedUniformSampler SceneTexture;
|
||||
FBufferedUniform1f Exposure;
|
||||
FBufferedUniform2f Scale;
|
||||
FBufferedUniform2f Offset;
|
||||
|
@ -22,7 +22,7 @@ class FBloomCombineShader
|
|||
public:
|
||||
void Bind();
|
||||
|
||||
FBufferedUniform1i BloomTexture;
|
||||
FBufferedUniformSampler BloomTexture;
|
||||
|
||||
private:
|
||||
FShaderProgram mShader;
|
||||
|
|
|
@ -8,7 +8,7 @@ class FLensShader
|
|||
public:
|
||||
void Bind();
|
||||
|
||||
FBufferedUniform1i InputTexture;
|
||||
FBufferedUniformSampler InputTexture;
|
||||
FBufferedUniform1f AspectRatio;
|
||||
FBufferedUniform1f Scale;
|
||||
FBufferedUniform4f LensDistortionCoefficient;
|
||||
|
|
|
@ -8,7 +8,7 @@ class FPresentShader
|
|||
public:
|
||||
void Bind();
|
||||
|
||||
FBufferedUniform1i InputTexture;
|
||||
FBufferedUniformSampler InputTexture;
|
||||
FBufferedUniform1f InvGamma;
|
||||
FBufferedUniform1f Contrast;
|
||||
FBufferedUniform1f Brightness;
|
||||
|
|
|
@ -201,6 +201,28 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class FBufferedUniformSampler
|
||||
{
|
||||
int mBuffer;
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
void Init(GLuint hShader, const GLchar *name)
|
||||
{
|
||||
mIndex = glGetUniformLocation(hShader, name);
|
||||
mBuffer = -1;
|
||||
}
|
||||
|
||||
void Set(int newvalue)
|
||||
{
|
||||
if (newvalue != mBuffer)
|
||||
{
|
||||
mBuffer = newvalue;
|
||||
glUniform1i(mIndex, newvalue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class FShader
|
||||
{
|
||||
|
|
|
@ -8,9 +8,9 @@ class FTonemapShader
|
|||
public:
|
||||
void Bind();
|
||||
|
||||
FBufferedUniform1i SceneTexture;
|
||||
FBufferedUniformSampler SceneTexture;
|
||||
FBufferedUniform1f Exposure;
|
||||
FBufferedUniform1i PaletteLUT;
|
||||
FBufferedUniformSampler PaletteLUT;
|
||||
|
||||
static bool IsPaletteMode();
|
||||
|
||||
|
|
Loading…
Reference in a new issue