mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- added a RenderQueue parameter to all Bind functions of the postprocessing shaders. This is unused for now. All places calling these pass a dummy NOQUEUE value which is just a nullptr.
This is for Vulkan preparation where all of this needs to run in a user-specified context so that this code can be moved out of the GL folder without depending on OpenGL's global state model.
This commit is contained in:
parent
0b9eaac5e1
commit
8bf009bd89
28 changed files with 91 additions and 88 deletions
|
@ -51,7 +51,7 @@ void FShadowMap::Update()
|
|||
|
||||
GLRenderer->mBuffers->BindShadowMapFB();
|
||||
|
||||
GLRenderer->mShadowMapShader->Bind();
|
||||
GLRenderer->mShadowMapShader->Bind(NOQUEUE);
|
||||
GLRenderer->mShadowMapShader->Uniforms->ShadowmapQuality = gl_shadowmap_quality;
|
||||
GLRenderer->mShadowMapShader->Uniforms.Set();
|
||||
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 4, mLightList);
|
||||
|
|
|
@ -115,7 +115,7 @@ void FGLRenderer::AmbientOccludeScene()
|
|||
glViewport(0, 0, mBuffers->AmbientWidth, mBuffers->AmbientHeight);
|
||||
mBuffers->BindSceneDepthTexture(0);
|
||||
mBuffers->BindSceneColorTexture(1);
|
||||
mLinearDepthShader->Bind();
|
||||
mLinearDepthShader->Bind(NOQUEUE);
|
||||
if (gl_multisample > 1) mLinearDepthShader->Uniforms->SampleIndex = 0;
|
||||
mLinearDepthShader->Uniforms->LinearizeDepthA = 1.0f / GetZFar() - 1.0f / GetZNear();
|
||||
mLinearDepthShader->Uniforms->LinearizeDepthB = MAX(1.0f / GetZNear(), 1.e-8f);
|
||||
|
@ -131,7 +131,7 @@ void FGLRenderer::AmbientOccludeScene()
|
|||
mBuffers->LinearDepthTexture.Bind(0);
|
||||
mBuffers->AmbientRandomTexture[randomTexture].Bind(2, GL_NEAREST, GL_REPEAT);
|
||||
mBuffers->BindSceneNormalTexture(1);
|
||||
mSSAOShader->Bind();
|
||||
mSSAOShader->Bind(NOQUEUE);
|
||||
if (gl_multisample > 1) mSSAOShader->Uniforms->SampleIndex = 0;
|
||||
mSSAOShader->Uniforms->UVToViewA = { 2.0f * invFocalLenX, 2.0f * invFocalLenY };
|
||||
mSSAOShader->Uniforms->UVToViewB = { -invFocalLenX, -invFocalLenY };
|
||||
|
@ -151,7 +151,7 @@ void FGLRenderer::AmbientOccludeScene()
|
|||
{
|
||||
mBuffers->AmbientFB0.Bind();
|
||||
mBuffers->AmbientTexture1.Bind(0);
|
||||
mDepthBlurShader->Bind(false);
|
||||
mDepthBlurShader->Bind(NOQUEUE, false);
|
||||
mDepthBlurShader->Uniforms[false]->BlurSharpness = blurSharpness;
|
||||
mDepthBlurShader->Uniforms[false]->InvFullResolution = { 1.0f / mBuffers->AmbientWidth, 1.0f / mBuffers->AmbientHeight };
|
||||
mDepthBlurShader->Uniforms[false].Set();
|
||||
|
@ -159,7 +159,7 @@ void FGLRenderer::AmbientOccludeScene()
|
|||
|
||||
mBuffers->AmbientFB1.Bind();
|
||||
mBuffers->AmbientTexture0.Bind(0);
|
||||
mDepthBlurShader->Bind(true);
|
||||
mDepthBlurShader->Bind(NOQUEUE, true);
|
||||
mDepthBlurShader->Uniforms[true]->BlurSharpness = blurSharpness;
|
||||
mDepthBlurShader->Uniforms[true]->InvFullResolution = { 1.0f / mBuffers->AmbientWidth, 1.0f / mBuffers->AmbientHeight };
|
||||
mDepthBlurShader->Uniforms[true]->PowExponent = gl_ssao_exponent;
|
||||
|
@ -180,7 +180,7 @@ void FGLRenderer::AmbientOccludeScene()
|
|||
}
|
||||
mBuffers->AmbientTexture1.Bind(0, GL_LINEAR);
|
||||
mBuffers->BindSceneFogTexture(1);
|
||||
mSSAOCombineShader->Bind();
|
||||
mSSAOCombineShader->Bind(NOQUEUE);
|
||||
if (gl_multisample > 1) mSSAOCombineShader->Uniforms->SampleCount = gl_multisample;
|
||||
mSSAOCombineShader->Uniforms->Scale = { sceneScaleX, sceneScaleY };
|
||||
mSSAOCombineShader->Uniforms->Offset = { sceneOffsetX, sceneOffsetY };
|
||||
|
@ -214,7 +214,7 @@ void FGLRenderer::UpdateCameraExposure()
|
|||
level0.Framebuffer.Bind();
|
||||
glViewport(0, 0, level0.Width, level0.Height);
|
||||
mBuffers->BindCurrentTexture(0, GL_LINEAR);
|
||||
mExposureExtractShader->Bind();
|
||||
mExposureExtractShader->Bind(NOQUEUE);
|
||||
mExposureExtractShader->Uniforms->Scale = { mSceneViewport.width / (float)mScreenViewport.width, mSceneViewport.height / (float)mScreenViewport.height };
|
||||
mExposureExtractShader->Uniforms->Offset = { mSceneViewport.left / (float)mScreenViewport.width, mSceneViewport.top / (float)mScreenViewport.height };
|
||||
mExposureExtractShader->Uniforms.Set();
|
||||
|
@ -229,7 +229,7 @@ void FGLRenderer::UpdateCameraExposure()
|
|||
next.Framebuffer.Bind();
|
||||
glViewport(0, 0, next.Width, next.Height);
|
||||
level.Texture.Bind(0);
|
||||
mExposureAverageShader->Bind();
|
||||
mExposureAverageShader->Bind(NOQUEUE);
|
||||
RenderScreenQuad();
|
||||
}
|
||||
|
||||
|
@ -247,7 +247,7 @@ void FGLRenderer::UpdateCameraExposure()
|
|||
mBuffers->FirstExposureFrame = false;
|
||||
}
|
||||
mBuffers->ExposureLevels.Last().Texture.Bind(0);
|
||||
mExposureCombineShader->Bind();
|
||||
mExposureCombineShader->Bind(NOQUEUE);
|
||||
mExposureCombineShader->Uniforms->ExposureBase = gl_exposure_base;
|
||||
mExposureCombineShader->Uniforms->ExposureMin = gl_exposure_min;
|
||||
mExposureCombineShader->Uniforms->ExposureScale = gl_exposure_scale;
|
||||
|
@ -296,7 +296,7 @@ static void RenderBlur(FGLRenderer *renderer, float blurAmount, PPTexture input,
|
|||
{
|
||||
ComputeBlurSamples(7, blurAmount, renderer->mBlurShader->Uniforms[vertical]->SampleWeights);
|
||||
|
||||
renderer->mBlurShader->Bind(vertical);
|
||||
renderer->mBlurShader->Bind(NOQUEUE, vertical);
|
||||
renderer->mBlurShader->Uniforms[vertical].Set(POSTPROCESS_BINDINGPOINT);
|
||||
|
||||
input.Bind(0);
|
||||
|
@ -329,7 +329,7 @@ void FGLRenderer::BloomScene(int fixedcm)
|
|||
glViewport(0, 0, level0.Width, level0.Height);
|
||||
mBuffers->BindCurrentTexture(0, GL_LINEAR);
|
||||
mBuffers->ExposureTexture.Bind(1);
|
||||
mBloomExtractShader->Bind();
|
||||
mBloomExtractShader->Bind(NOQUEUE);
|
||||
mBloomExtractShader->Uniforms->Scale = { mSceneViewport.width / (float)mScreenViewport.width, mSceneViewport.height / (float)mScreenViewport.height };
|
||||
mBloomExtractShader->Uniforms->Offset = { mSceneViewport.left / (float)mScreenViewport.width, mSceneViewport.top / (float)mScreenViewport.height };
|
||||
mBloomExtractShader->Uniforms.Set();
|
||||
|
@ -357,7 +357,7 @@ void FGLRenderer::BloomScene(int fixedcm)
|
|||
next.VFramebuffer.Bind();
|
||||
glViewport(0, 0, next.Width, next.Height);
|
||||
level.VTexture.Bind(0, GL_LINEAR);
|
||||
mBloomCombineShader->Bind();
|
||||
mBloomCombineShader->Bind(NOQUEUE);
|
||||
RenderScreenQuad();
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ void FGLRenderer::BloomScene(int fixedcm)
|
|||
glBlendEquation(GL_FUNC_ADD);
|
||||
glBlendFunc(GL_ONE, GL_ONE);
|
||||
level0.VTexture.Bind(0, GL_LINEAR);
|
||||
mBloomCombineShader->Bind();
|
||||
mBloomCombineShader->Bind(NOQUEUE);
|
||||
RenderScreenQuad();
|
||||
glViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height);
|
||||
|
||||
|
@ -434,7 +434,7 @@ void FGLRenderer::BlurScene(float gameinfobluramount)
|
|||
next.VFramebuffer.Bind();
|
||||
glViewport(0, 0, next.Width, next.Height);
|
||||
level.VTexture.Bind(0, GL_LINEAR);
|
||||
mBloomCombineShader->Bind();
|
||||
mBloomCombineShader->Bind(NOQUEUE);
|
||||
RenderScreenQuad();
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@ void FGLRenderer::TonemapScene()
|
|||
|
||||
mBuffers->BindNextFB();
|
||||
mBuffers->BindCurrentTexture(0);
|
||||
mTonemapShader->Bind();
|
||||
mTonemapShader->Bind(NOQUEUE);
|
||||
|
||||
if (mTonemapShader->IsPaletteMode())
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ void FGLRenderer::ColormapScene(int fixedcm)
|
|||
|
||||
mBuffers->BindNextFB();
|
||||
mBuffers->BindCurrentTexture(0);
|
||||
mColormapShader->Bind();
|
||||
mColormapShader->Bind(NOQUEUE);
|
||||
|
||||
FSpecialColormap *scm = &SpecialColormaps[fixedcm - CM_FIRSTSPECIALCOLORMAP];
|
||||
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
||||
|
@ -604,7 +604,7 @@ void FGLRenderer::LensDistortScene()
|
|||
|
||||
mBuffers->BindNextFB();
|
||||
mBuffers->BindCurrentTexture(0, GL_LINEAR);
|
||||
mLensShader->Bind();
|
||||
mLensShader->Bind(NOQUEUE);
|
||||
mLensShader->Uniforms->AspectRatio = aspect;
|
||||
mLensShader->Uniforms->Scale = scale;
|
||||
mLensShader->Uniforms->LensDistortionCoefficient = k;
|
||||
|
@ -635,13 +635,13 @@ void FGLRenderer::ApplyFXAA()
|
|||
|
||||
mBuffers->BindNextFB();
|
||||
mBuffers->BindCurrentTexture(0);
|
||||
mFXAALumaShader->Bind();
|
||||
mFXAALumaShader->Bind(NOQUEUE);
|
||||
RenderScreenQuad();
|
||||
mBuffers->NextTexture();
|
||||
|
||||
mBuffers->BindNextFB();
|
||||
mBuffers->BindCurrentTexture(0, GL_LINEAR);
|
||||
mFXAAShader->Bind();
|
||||
mFXAAShader->Bind(NOQUEUE);
|
||||
mFXAAShader->Uniforms->ReciprocalResolution = { 1.0f / mBuffers->GetWidth(), 1.0f / mBuffers->GetHeight() };
|
||||
mFXAAShader->Uniforms.Set();
|
||||
RenderScreenQuad();
|
||||
|
@ -744,7 +744,7 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
mPresentShader->Bind();
|
||||
mPresentShader->Bind(NOQUEUE);
|
||||
if (!applyGamma || framebuffer->IsHWGammaActive())
|
||||
{
|
||||
mPresentShader->Uniforms->InvGamma = 1.0f;
|
||||
|
|
|
@ -50,6 +50,7 @@ class FShadowMapShader;
|
|||
class FCustomPostProcessShaders;
|
||||
class GLSceneDrawer;
|
||||
class SWSceneDrawer;
|
||||
#define NOQUEUE nullptr // just some token to be used as a placeholder
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "hwrenderer/utility/hw_cvars.h"
|
||||
#include "gl/shaders/gl_ambientshader.h"
|
||||
|
||||
void FLinearDepthShader::Bind()
|
||||
void FLinearDepthShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
bool multisample = (gl_multisample > 1);
|
||||
if (mMultisample != multisample)
|
||||
|
@ -44,10 +44,10 @@ void FLinearDepthShader::Bind()
|
|||
Uniforms.Init();
|
||||
mMultisample = multisample;
|
||||
}
|
||||
mShader->Bind();
|
||||
mShader->Bind(q);
|
||||
}
|
||||
|
||||
void FSSAOShader::Bind()
|
||||
void FSSAOShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
bool multisample = (gl_multisample > 1);
|
||||
if (mCurrentQuality != gl_ssao || mMultisample != multisample)
|
||||
|
@ -66,7 +66,7 @@ void FSSAOShader::Bind()
|
|||
Uniforms.Init();
|
||||
mMultisample = multisample;
|
||||
}
|
||||
mShader->Bind();
|
||||
mShader->Bind(q);
|
||||
}
|
||||
|
||||
FString FSSAOShader::GetDefines(int mode, bool multisample)
|
||||
|
@ -94,7 +94,7 @@ FString FSSAOShader::GetDefines(int mode, bool multisample)
|
|||
return defines;
|
||||
}
|
||||
|
||||
void FDepthBlurShader::Bind(bool vertical)
|
||||
void FDepthBlurShader::Bind(IRenderQueue *q, bool vertical)
|
||||
{
|
||||
auto &shader = mShader[vertical];
|
||||
if (!shader)
|
||||
|
@ -111,10 +111,10 @@ void FDepthBlurShader::Bind(bool vertical)
|
|||
shader.SetUniformBufferLocation(Uniforms[vertical].BindingPoint(), "Uniforms");
|
||||
Uniforms[vertical].Init();
|
||||
}
|
||||
shader.Bind();
|
||||
shader.Bind(q);
|
||||
}
|
||||
|
||||
void FSSAOCombineShader::Bind()
|
||||
void FSSAOCombineShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
bool multisample = (gl_multisample > 1);
|
||||
if (mMultisample != multisample)
|
||||
|
@ -134,5 +134,5 @@ void FSSAOCombineShader::Bind()
|
|||
Uniforms.Init();
|
||||
mMultisample = multisample;
|
||||
}
|
||||
mShader->Bind();
|
||||
mShader->Bind(q);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
class FLinearDepthShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
@ -49,7 +49,7 @@ private:
|
|||
class FSSAOShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ private:
|
|||
class FDepthBlurShader
|
||||
{
|
||||
public:
|
||||
void Bind(bool vertical);
|
||||
void Bind(IRenderQueue *q, bool vertical);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ private:
|
|||
class FSSAOCombineShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "v_video.h"
|
||||
#include "gl/shaders/gl_bloomshader.h"
|
||||
|
||||
void FBloomExtractShader::Bind()
|
||||
void FBloomExtractShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -41,10 +41,10 @@ void FBloomExtractShader::Bind()
|
|||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
||||
void FBloomCombineShader::Bind()
|
||||
void FBloomCombineShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -52,5 +52,5 @@ void FBloomCombineShader::Bind()
|
|||
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/bloomcombine.fp", "", 330);
|
||||
mShader.Link("shaders/glsl/bloomcombine");
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class FBloomExtractShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ private:
|
|||
class FBloomCombineShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
private:
|
||||
FShaderProgram mShader;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
|
||||
void FBlurShader::Bind(bool vertical)
|
||||
void FBlurShader::Bind(IRenderQueue *q, bool vertical)
|
||||
{
|
||||
if (!mShader[vertical])
|
||||
{
|
||||
|
@ -49,5 +49,5 @@ void FBlurShader::Bind(bool vertical)
|
|||
Uniforms[vertical].Init();
|
||||
}
|
||||
|
||||
mShader[vertical].Bind();
|
||||
mShader[vertical].Bind(q);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class PPTexture;
|
|||
class FBlurShader
|
||||
{
|
||||
public:
|
||||
void Bind(bool vertical);
|
||||
void Bind(IRenderQueue *q, bool vertical);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "v_video.h"
|
||||
#include "gl/shaders/gl_colormapshader.h"
|
||||
|
||||
void FColormapShader::Bind()
|
||||
void FColormapShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
auto &shader = mShader;
|
||||
if (!shader)
|
||||
|
@ -41,6 +41,6 @@ void FColormapShader::Bind()
|
|||
shader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
shader.Bind();
|
||||
shader.Bind(q);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class FColormapShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
EXTERN_CVAR(Int, gl_fxaa)
|
||||
|
||||
void FFXAALumaShader::Bind()
|
||||
void FFXAALumaShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ void FFXAALumaShader::Bind()
|
|||
mShader.Link("shaders/glsl/fxaa");
|
||||
}
|
||||
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
||||
static int GetMaxVersion()
|
||||
|
@ -73,7 +73,7 @@ static FString GetDefines()
|
|||
return result;
|
||||
}
|
||||
|
||||
void FFXAAShader::Bind()
|
||||
void FFXAAShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
assert(gl_fxaa > 0 && gl_fxaa < Count);
|
||||
FShaderProgram &shader = mShaders[gl_fxaa];
|
||||
|
@ -90,5 +90,5 @@ void FFXAAShader::Bind()
|
|||
Uniforms.Init();
|
||||
}
|
||||
|
||||
shader.Bind();
|
||||
shader.Bind(q);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
class FFXAALumaShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
private:
|
||||
FShaderProgram mShader;
|
||||
|
@ -43,7 +43,7 @@ private:
|
|||
class FFXAAShader : public IFXAAShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "v_video.h"
|
||||
#include "gl/shaders/gl_lensshader.h"
|
||||
|
||||
void FLensShader::Bind()
|
||||
void FLensShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -41,5 +41,5 @@ void FLensShader::Bind()
|
|||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class FLensShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ void FCustomPostProcessShaders::Run(FString target)
|
|||
{
|
||||
if (shader->Desc->Target == target)
|
||||
{
|
||||
shader->Run();
|
||||
shader->Run(NOQUEUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ PostProcessShaderInstance::~PostProcessShaderInstance()
|
|||
glDeleteTextures(1, (GLuint*)&it.second);
|
||||
}
|
||||
|
||||
void PostProcessShaderInstance::Run()
|
||||
void PostProcessShaderInstance::Run(IRenderQueue *q)
|
||||
{
|
||||
if (!IsShaderSupported())
|
||||
return;
|
||||
|
@ -88,7 +88,7 @@ void PostProcessShaderInstance::Run()
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
mProgram.Bind();
|
||||
mProgram.Bind(q);
|
||||
|
||||
UpdateUniforms();
|
||||
BindTextures();
|
||||
|
|
|
@ -11,7 +11,7 @@ public:
|
|||
PostProcessShaderInstance(PostProcessShader *desc) : Desc(desc) { }
|
||||
~PostProcessShaderInstance();
|
||||
|
||||
void Run();
|
||||
void Run(IRenderQueue *q);
|
||||
|
||||
PostProcessShader *Desc;
|
||||
|
||||
|
|
|
@ -30,29 +30,29 @@
|
|||
#include "gl_load/gl_system.h"
|
||||
#include "gl/shaders/gl_present3dRowshader.h"
|
||||
|
||||
void FPresent3DCheckerShader::Bind()
|
||||
void FPresent3DCheckerShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_checker3d.fp", "shaders/glsl/presentChecker3d");
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
||||
void FPresent3DColumnShader::Bind()
|
||||
void FPresent3DColumnShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_column3d.fp", "shaders/glsl/presentColumn3d");
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
||||
void FPresent3DRowShader::Bind()
|
||||
void FPresent3DRowShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_row3d.fp", "shaders/glsl/presentRow3d");
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
|
|
@ -34,19 +34,19 @@
|
|||
class FPresent3DCheckerShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
void Bind(IRenderQueue *q) override;
|
||||
};
|
||||
|
||||
class FPresent3DColumnShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
void Bind(IRenderQueue *q) override;
|
||||
};
|
||||
|
||||
class FPresent3DRowShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
void Bind(IRenderQueue *q) override;
|
||||
};
|
||||
|
||||
// GL_PRESENT3DROWSHADER_H_
|
||||
|
|
|
@ -40,11 +40,11 @@ void FPresentShaderBase::Init(const char * vtx_shader_name, const char * program
|
|||
Uniforms.Init();
|
||||
}
|
||||
|
||||
void FPresentShader::Bind()
|
||||
void FPresentShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present.fp", "shaders/glsl/present");
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class FPresentShaderBase
|
|||
{
|
||||
public:
|
||||
virtual ~FPresentShaderBase() {}
|
||||
virtual void Bind() = 0;
|
||||
virtual void Bind(IRenderQueue *q) = 0;
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ protected:
|
|||
class FPresentShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
void Bind(IRenderQueue *q) override;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ void FShaderProgram::SetUniformBufferLocation(int index, const char *name)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FShaderProgram::Bind()
|
||||
void FShaderProgram::Bind(IRenderQueue *)
|
||||
{
|
||||
glUseProgram(mProgram);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "gl_shader.h"
|
||||
#include "hwrenderer/data/shaderuniforms.h"
|
||||
|
||||
class IRenderQueue;
|
||||
|
||||
class FShaderProgram
|
||||
{
|
||||
public:
|
||||
|
@ -23,7 +25,7 @@ public:
|
|||
void Link(const char *name);
|
||||
void SetUniformBufferLocation(int index, const char *name);
|
||||
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q); // the parameter here is just a preparation for Vulkan
|
||||
|
||||
operator GLuint() const { return mProgram; }
|
||||
explicit operator bool() const { return mProgram != 0; }
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include "files.h"
|
||||
#include "gl/shaders/gl_shadowmapshader.h"
|
||||
|
||||
void FShadowMapShader::Bind()
|
||||
void FShadowMapShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -36,5 +36,5 @@ void FShadowMapShader::Bind()
|
|||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
class FShadowMapShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include "hwrenderer/utility/hw_cvars.h"
|
||||
#include "gl/shaders/gl_tonemapshader.h"
|
||||
|
||||
void FTonemapShader::Bind()
|
||||
void FTonemapShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
auto &shader = mShader[gl_tonemap];
|
||||
if (!shader)
|
||||
|
@ -41,7 +41,7 @@ void FTonemapShader::Bind()
|
|||
shader.Compile(FShaderProgram::Fragment, "shaders/glsl/tonemap.fp", prolog, 330);
|
||||
shader.Link("shaders/glsl/tonemap");
|
||||
}
|
||||
shader.Bind();
|
||||
shader.Bind(q);
|
||||
}
|
||||
|
||||
bool FTonemapShader::IsPaletteMode()
|
||||
|
@ -62,7 +62,7 @@ const char *FTonemapShader::GetDefines(int mode)
|
|||
}
|
||||
}
|
||||
|
||||
void FExposureExtractShader::Bind()
|
||||
void FExposureExtractShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -74,10 +74,10 @@ void FExposureExtractShader::Bind()
|
|||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
||||
void FExposureAverageShader::Bind()
|
||||
void FExposureAverageShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -85,10 +85,10 @@ void FExposureAverageShader::Bind()
|
|||
mShader.Compile(FShaderProgram::Fragment, "shaders/glsl/exposureaverage.fp", "", 400);
|
||||
mShader.Link("shaders/glsl/exposureaverage");
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
||||
|
||||
void FExposureCombineShader::Bind()
|
||||
void FExposureCombineShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
|
@ -100,5 +100,5 @@ void FExposureCombineShader::Bind()
|
|||
mShader.SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
mShader.Bind();
|
||||
mShader.Bind(q);
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
class FTonemapShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
static bool IsPaletteMode();
|
||||
|
||||
|
@ -30,7 +30,7 @@ private:
|
|||
class FExposureExtractShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ private:
|
|||
class FExposureAverageShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
private:
|
||||
FShaderProgram mShader;
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
class FExposureCombineShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
struct UniformBlock
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@ static void prepareInterleavedPresent(FPresentShaderBase& shader)
|
|||
const IntRect& box = screen->mOutputLetterbox;
|
||||
glViewport(box.left, box.top, box.width, box.height);
|
||||
|
||||
shader.Bind();
|
||||
shader.Bind(NOQUEUE);
|
||||
|
||||
if ( GLRenderer->framebuffer->IsHWGammaActive() )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue