mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 23:12:24 +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:
|
public:
|
||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
FBufferedUniform1i SceneTexture;
|
FBufferedUniformSampler SceneTexture;
|
||||||
FBufferedUniform1f Exposure;
|
FBufferedUniform1f Exposure;
|
||||||
FBufferedUniform2f Scale;
|
FBufferedUniform2f Scale;
|
||||||
FBufferedUniform2f Offset;
|
FBufferedUniform2f Offset;
|
||||||
|
@ -22,7 +22,7 @@ class FBloomCombineShader
|
||||||
public:
|
public:
|
||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
FBufferedUniform1i BloomTexture;
|
FBufferedUniformSampler BloomTexture;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FShaderProgram mShader;
|
FShaderProgram mShader;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class FLensShader
|
||||||
public:
|
public:
|
||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
FBufferedUniform1i InputTexture;
|
FBufferedUniformSampler InputTexture;
|
||||||
FBufferedUniform1f AspectRatio;
|
FBufferedUniform1f AspectRatio;
|
||||||
FBufferedUniform1f Scale;
|
FBufferedUniform1f Scale;
|
||||||
FBufferedUniform4f LensDistortionCoefficient;
|
FBufferedUniform4f LensDistortionCoefficient;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class FPresentShader
|
||||||
public:
|
public:
|
||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
FBufferedUniform1i InputTexture;
|
FBufferedUniformSampler InputTexture;
|
||||||
FBufferedUniform1f InvGamma;
|
FBufferedUniform1f InvGamma;
|
||||||
FBufferedUniform1f Contrast;
|
FBufferedUniform1f Contrast;
|
||||||
FBufferedUniform1f Brightness;
|
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
|
class FShader
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,9 +8,9 @@ class FTonemapShader
|
||||||
public:
|
public:
|
||||||
void Bind();
|
void Bind();
|
||||||
|
|
||||||
FBufferedUniform1i SceneTexture;
|
FBufferedUniformSampler SceneTexture;
|
||||||
FBufferedUniform1f Exposure;
|
FBufferedUniform1f Exposure;
|
||||||
FBufferedUniform1i PaletteLUT;
|
FBufferedUniformSampler PaletteLUT;
|
||||||
|
|
||||||
static bool IsPaletteMode();
|
static bool IsPaletteMode();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue