mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
- remove IShaderProgram and make the old classes an implementation detail of the OpenGL backend. In the long run they should be removed completely as their weird design is mostly an artifact of once having supported OpenGL 2
This commit is contained in:
parent
903f8b6696
commit
e5e9924c5e
23 changed files with 153 additions and 329 deletions
|
@ -1073,9 +1073,6 @@ set (PCH_SOURCES
|
|||
rendering/hwrenderer/postprocessing/hw_postprocess.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocessshader.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_shadowmapshader.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_presentshader.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_present3dRowshader.cpp
|
||||
rendering/hwrenderer/textures/hw_material.cpp
|
||||
rendering/hwrenderer/textures/hw_precache.cpp
|
||||
rendering/hwrenderer/utility/hw_clock.cpp
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "hwrenderer/postprocessing/hw_presentshader.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess_cvars.h"
|
||||
#include "hwrenderer/utility/hw_vrmodes.h"
|
||||
|
@ -220,7 +220,7 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
}
|
||||
|
||||
mPresentShader->Bind(NOQUEUE);
|
||||
mPresentShader->Bind();
|
||||
if (!applyGamma || framebuffer->IsHWGammaActive())
|
||||
{
|
||||
mPresentShader->Uniforms->InvGamma = 1.0f;
|
||||
|
|
|
@ -861,8 +861,8 @@ void FGLRenderBuffers::CompileEffectShaders()
|
|||
prolog = UniformBlockDecl::Create("Uniforms", desc.Uniforms, POSTPROCESS_BINDINGPOINT);
|
||||
prolog += desc.Defines;
|
||||
|
||||
glshader->Compile(IShaderProgram::Vertex, desc.VertexShader, "", desc.Version);
|
||||
glshader->Compile(IShaderProgram::Fragment, desc.FragmentShader, prolog, desc.Version);
|
||||
glshader->Compile(FShaderProgram::Vertex, desc.VertexShader, "", desc.Version);
|
||||
glshader->Compile(FShaderProgram::Fragment, desc.FragmentShader, prolog, desc.Version);
|
||||
glshader->Link(pair->Key.GetChars());
|
||||
if (!desc.Uniforms.empty())
|
||||
glshader->SetUniformBufferLocation(POSTPROCESS_BINDINGPOINT, "Uniforms");
|
||||
|
@ -987,7 +987,7 @@ void FGLRenderBuffers::RenderEffect(const FString &name)
|
|||
}
|
||||
|
||||
// Set shader
|
||||
shader->Bind(NOQUEUE);
|
||||
shader->Bind();
|
||||
|
||||
// Draw the screen quad
|
||||
GLRenderer->RenderScreenQuad();
|
||||
|
|
|
@ -47,10 +47,8 @@
|
|||
#include "gl/renderer/gl_renderer.h"
|
||||
#include "gl/renderer/gl_renderstate.h"
|
||||
#include "gl/renderer/gl_renderbuffers.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "hwrenderer/utility/hw_vrmodes.h"
|
||||
#include "hwrenderer/postprocessing/hw_presentshader.h"
|
||||
#include "hwrenderer/postprocessing/hw_present3dRowshader.h"
|
||||
#include "hwrenderer/postprocessing/hw_shadowmapshader.h"
|
||||
#include "hwrenderer/data/flatvertices.h"
|
||||
#include "hwrenderer/scene/hw_skydome.h"
|
||||
#include "hwrenderer/scene/hw_fakeflat.h"
|
||||
|
@ -198,7 +196,7 @@ void FGLRenderer::UpdateShadowMap()
|
|||
|
||||
mBuffers->BindShadowMapFB();
|
||||
|
||||
mShadowMapShader->Bind(NOQUEUE);
|
||||
mShadowMapShader->Bind();
|
||||
mShadowMapShader->Uniforms->ShadowmapQuality = gl_shadowmap_quality;
|
||||
mShadowMapShader->Uniforms.Set();
|
||||
|
||||
|
|
|
@ -24,25 +24,23 @@ class HWPortal;
|
|||
class FLightBuffer;
|
||||
class DPSprite;
|
||||
class FGLRenderBuffers;
|
||||
class FPresentShader;
|
||||
class FPresent3DCheckerShader;
|
||||
class FPresent3DColumnShader;
|
||||
class FPresent3DRowShader;
|
||||
class FGL2DDrawer;
|
||||
class FHardwareTexture;
|
||||
class FShadowMapShader;
|
||||
class SWSceneDrawer;
|
||||
class GLViewpointBuffer;
|
||||
struct FRenderViewpoint;
|
||||
class FPresentShaderBase;
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
class FSamplerManager;
|
||||
class FCustomPostProcessShaders;
|
||||
class OpenGLFrameBuffer;
|
||||
|
||||
#define NOQUEUE nullptr // just some token to be used as a placeholder
|
||||
class FPresentShaderBase;
|
||||
class FPresentShader;
|
||||
class FPresent3DCheckerShader;
|
||||
class FPresent3DColumnShader;
|
||||
class FPresent3DRowShader;
|
||||
class FShadowMapShader;
|
||||
|
||||
class FGLRenderer
|
||||
{
|
||||
|
|
|
@ -32,8 +32,7 @@
|
|||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "gl/renderer/gl_postprocessstate.h"
|
||||
#include "gl/system/gl_framebuffer.h"
|
||||
#include "hwrenderer/postprocessing/hw_presentshader.h"
|
||||
#include "hwrenderer/postprocessing/hw_present3dRowshader.h"
|
||||
#include "gl/shaders/gl_shaderprogram.h"
|
||||
#include "menu/menu.h"
|
||||
|
||||
EXTERN_CVAR(Int, vr_mode)
|
||||
|
@ -151,7 +150,7 @@ void FGLRenderer::prepareInterleavedPresent(FPresentShaderBase& shader)
|
|||
const IntRect& box = screen->mOutputLetterbox;
|
||||
glViewport(box.left, box.top, box.width, box.height);
|
||||
|
||||
shader.Bind(NOQUEUE);
|
||||
shader.Bind();
|
||||
|
||||
if (framebuffer->IsHWGammaActive())
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ void FCustomPostProcessShaders::Run(FString target)
|
|||
{
|
||||
if (shader->Desc->Target == target)
|
||||
{
|
||||
shader->Run(NOQUEUE);
|
||||
shader->Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ PostProcessShaderInstance::~PostProcessShaderInstance()
|
|||
glDeleteTextures(1, (GLuint*)&it.second);
|
||||
}
|
||||
|
||||
void PostProcessShaderInstance::Run(IRenderQueue *q)
|
||||
void PostProcessShaderInstance::Run()
|
||||
{
|
||||
if (!IsShaderSupported())
|
||||
return;
|
||||
|
@ -92,7 +92,7 @@ void PostProcessShaderInstance::Run(IRenderQueue *q)
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
mProgram.Bind(q);
|
||||
mProgram.Bind();
|
||||
|
||||
UpdateUniforms();
|
||||
BindTextures();
|
||||
|
@ -168,8 +168,8 @@ void PostProcessShaderInstance::CompileShader()
|
|||
prolog += uniformTextures;
|
||||
prolog += pipelineInOut;
|
||||
|
||||
mProgram.Compile(IShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", Desc->ShaderVersion);
|
||||
mProgram.Compile(IShaderProgram::Fragment, lumpName, code, prolog.GetChars(), Desc->ShaderVersion);
|
||||
mProgram.Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", Desc->ShaderVersion);
|
||||
mProgram.Compile(FShaderProgram::Fragment, lumpName, code, prolog.GetChars(), Desc->ShaderVersion);
|
||||
mProgram.Link(Desc->ShaderLumpName.GetChars());
|
||||
mInputTexture.Init(mProgram.Handle(), "InputTexture");
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public:
|
|||
PostProcessShaderInstance(PostProcessShader *desc) : Desc(desc) { }
|
||||
~PostProcessShaderInstance();
|
||||
|
||||
void Run(IRenderQueue *q);
|
||||
void Run();
|
||||
|
||||
PostProcessShader *Desc;
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ void FShaderProgram::SetUniformBufferLocation(int index, const char *name)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FShaderProgram::Bind(IRenderQueue *)
|
||||
void FShaderProgram::Bind()
|
||||
{
|
||||
glUseProgram(mProgram);
|
||||
}
|
||||
|
@ -295,4 +295,74 @@ FString FShaderProgram::PatchShader(ShaderType type, const FString &code, const
|
|||
return patchedCode;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void FPresentShaderBase::Init(const char * vtx_shader_name, const char * program_name)
|
||||
{
|
||||
FString prolog = Uniforms.CreateDeclaration("Uniforms", PresentUniforms::Desc());
|
||||
|
||||
mShader.reset(new FShaderProgram());
|
||||
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", prolog, 330);
|
||||
mShader->Compile(FShaderProgram::Fragment, vtx_shader_name, prolog, 330);
|
||||
mShader->Link(program_name);
|
||||
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
|
||||
void FPresentShader::Bind()
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present.fp", "shaders/glsl/present");
|
||||
}
|
||||
mShader->Bind();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void FPresent3DCheckerShader::Bind()
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_checker3d.fp", "shaders/glsl/presentChecker3d");
|
||||
}
|
||||
mShader->Bind();
|
||||
}
|
||||
|
||||
void FPresent3DColumnShader::Bind()
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_column3d.fp", "shaders/glsl/presentColumn3d");
|
||||
}
|
||||
mShader->Bind();
|
||||
}
|
||||
|
||||
void FPresent3DRowShader::Bind()
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_row3d.fp", "shaders/glsl/presentRow3d");
|
||||
}
|
||||
mShader->Bind();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void FShadowMapShader::Bind()
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
FString prolog = Uniforms.CreateDeclaration("Uniforms", ShadowMapUniforms::Desc());
|
||||
|
||||
mShader.reset(new FShaderProgram());
|
||||
mShader->Compile(FShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 430);
|
||||
mShader->Compile(FShaderProgram::Fragment, "shaders/glsl/shadowmap.fp", prolog, 430);
|
||||
mShader->Link("shaders/glsl/shadowmap");
|
||||
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
mShader->Bind();
|
||||
}
|
||||
|
||||
}
|
|
@ -3,23 +3,30 @@
|
|||
|
||||
#include "gl_load/gl_system.h"
|
||||
#include "gl_shader.h"
|
||||
#include "hwrenderer/postprocessing/hw_shaderprogram.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
|
||||
namespace OpenGLRenderer
|
||||
{
|
||||
|
||||
class FShaderProgram : public IShaderProgram
|
||||
class FShaderProgram
|
||||
{
|
||||
public:
|
||||
FShaderProgram();
|
||||
~FShaderProgram();
|
||||
|
||||
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;
|
||||
enum ShaderType
|
||||
{
|
||||
Vertex,
|
||||
Fragment,
|
||||
NumShaderTypes
|
||||
};
|
||||
|
||||
void Compile(ShaderType type, const char *lumpName, const char *defines, int maxGlslVersion);
|
||||
void Compile(ShaderType type, const char *name, const FString &code, const char *defines, int maxGlslVersion);
|
||||
void Link(const char *name);
|
||||
void SetUniformBufferLocation(int index, const char *name);
|
||||
|
||||
void Bind(IRenderQueue *q) override; // the parameter here is just a preparation for Vulkan
|
||||
void Bind();
|
||||
|
||||
GLuint Handle() { return mProgram; }
|
||||
//explicit operator bool() const { return mProgram != 0; }
|
||||
|
@ -44,4 +51,53 @@ private:
|
|||
TArray<std::pair<FString, int>> samplerstobind;
|
||||
};
|
||||
|
||||
class FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
virtual ~FPresentShaderBase() {}
|
||||
virtual void Bind() = 0;
|
||||
|
||||
ShaderUniforms<PresentUniforms, POSTPROCESS_BINDINGPOINT> Uniforms;
|
||||
|
||||
protected:
|
||||
virtual void Init(const char * vtx_shader_name, const char * program_name);
|
||||
std::unique_ptr<FShaderProgram> mShader;
|
||||
};
|
||||
|
||||
class FPresentShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
|
||||
};
|
||||
|
||||
class FPresent3DCheckerShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
};
|
||||
|
||||
class FPresent3DColumnShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
};
|
||||
|
||||
class FPresent3DRowShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind() override;
|
||||
};
|
||||
|
||||
class FShadowMapShader
|
||||
{
|
||||
public:
|
||||
void Bind();
|
||||
|
||||
ShaderUniforms<ShadowMapUniforms, POSTPROCESS_BINDINGPOINT> Uniforms;
|
||||
|
||||
private:
|
||||
std::unique_ptr<FShaderProgram> mShader;
|
||||
};
|
||||
|
||||
}
|
|
@ -325,11 +325,6 @@ FModelRenderer *OpenGLFrameBuffer::CreateModelRenderer(int mli)
|
|||
return new FGLModelRenderer(nullptr, gl_RenderState, mli);
|
||||
}
|
||||
|
||||
IShaderProgram *OpenGLFrameBuffer::CreateShaderProgram()
|
||||
{
|
||||
return new FShaderProgram;
|
||||
}
|
||||
|
||||
IVertexBuffer *OpenGLFrameBuffer::CreateVertexBuffer()
|
||||
{
|
||||
return new GLVertexBuffer;
|
||||
|
|
|
@ -37,7 +37,6 @@ public:
|
|||
void BeginFrame() override;
|
||||
void SetViewportRects(IntRect *bounds) override;
|
||||
void BlurScene(float amount) override;
|
||||
IShaderProgram *CreateShaderProgram() override;
|
||||
IVertexBuffer *CreateVertexBuffer() override;
|
||||
IIndexBuffer *CreateIndexBuffer() override;
|
||||
IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo) override;
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2016 Christopher Bruns
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_3dRowshader.cpp
|
||||
** Copy rendered texture to back buffer, possibly with gamma correction
|
||||
** while interleaving rows from two independent viewpoint textures,
|
||||
** representing the left-eye and right-eye views.
|
||||
**
|
||||
*/
|
||||
|
||||
#include "hw_present3dRowshader.h"
|
||||
|
||||
void FPresent3DCheckerShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_checker3d.fp", "shaders/glsl/presentChecker3d");
|
||||
}
|
||||
mShader->Bind(q);
|
||||
}
|
||||
|
||||
void FPresent3DColumnShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_column3d.fp", "shaders/glsl/presentColumn3d");
|
||||
}
|
||||
mShader->Bind(q);
|
||||
}
|
||||
|
||||
void FPresent3DRowShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present_row3d.fp", "shaders/glsl/presentRow3d");
|
||||
}
|
||||
mShader->Bind(q);
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2015 Christopher Bruns
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_present3dRowshader.h
|
||||
** Final composition and present shader for row-interleaved stereoscopic 3D mode
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef GL_PRESENT3DROWSHADER_H_
|
||||
#define GL_PRESENT3DROWSHADER_H_
|
||||
|
||||
#include "hw_shaderprogram.h"
|
||||
#include "hw_presentshader.h"
|
||||
|
||||
class FPresent3DCheckerShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind(IRenderQueue *q) override;
|
||||
};
|
||||
|
||||
class FPresent3DColumnShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind(IRenderQueue *q) override;
|
||||
};
|
||||
|
||||
class FPresent3DRowShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind(IRenderQueue *q) override;
|
||||
};
|
||||
|
||||
// GL_PRESENT3DROWSHADER_H_
|
||||
#endif
|
|
@ -1,50 +0,0 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2016 Magnus Norddahl
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
/*
|
||||
** gl_presentshader.cpp
|
||||
** Copy rendered texture to back buffer, possibly with gamma correction
|
||||
**
|
||||
*/
|
||||
|
||||
#include "v_video.h"
|
||||
#include "hw_presentshader.h"
|
||||
|
||||
void FPresentShaderBase::Init(const char * vtx_shader_name, const char * program_name)
|
||||
{
|
||||
FString prolog = Uniforms.CreateDeclaration("Uniforms", PresentUniforms::Desc());
|
||||
|
||||
mShader.reset(screen->CreateShaderProgram());
|
||||
mShader->Compile(IShaderProgram::Vertex, "shaders/glsl/screenquad.vp", prolog, 330);
|
||||
mShader->Compile(IShaderProgram::Fragment, vtx_shader_name, prolog, 330);
|
||||
mShader->Link(program_name);
|
||||
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
|
||||
void FPresentShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
Init("shaders/glsl/present.fp", "shaders/glsl/present");
|
||||
}
|
||||
mShader->Bind(q);
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef __GL_PRESENTSHADER_H
|
||||
#define __GL_PRESENTSHADER_H
|
||||
|
||||
#include "hwrenderer/postprocessing/hw_shaderprogram.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
|
||||
class FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
virtual ~FPresentShaderBase() {}
|
||||
virtual void Bind(IRenderQueue *q) = 0;
|
||||
|
||||
ShaderUniforms<PresentUniforms, POSTPROCESS_BINDINGPOINT> Uniforms;
|
||||
|
||||
protected:
|
||||
virtual void Init(const char * vtx_shader_name, const char * program_name);
|
||||
std::unique_ptr<IShaderProgram> mShader;
|
||||
};
|
||||
|
||||
class FPresentShader : public FPresentShaderBase
|
||||
{
|
||||
public:
|
||||
void Bind(IRenderQueue *q) override;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "hwrenderer/data/shaderuniforms.h"
|
||||
|
||||
class IRenderQueue;
|
||||
|
||||
class IShaderProgram
|
||||
{
|
||||
public:
|
||||
IShaderProgram() {}
|
||||
virtual ~IShaderProgram() {}
|
||||
|
||||
enum ShaderType
|
||||
{
|
||||
Vertex,
|
||||
Fragment,
|
||||
NumShaderTypes
|
||||
};
|
||||
|
||||
virtual void Compile(ShaderType type, const char *lumpName, const char *defines, int maxGlslVersion) = 0;
|
||||
virtual void Compile(ShaderType type, const char *name, const FString &code, const char *defines, int maxGlslVersion) = 0;
|
||||
virtual void Link(const char *name) = 0;
|
||||
virtual void SetUniformBufferLocation(int index, const char *name) = 0;
|
||||
|
||||
virtual void Bind(IRenderQueue *q) = 0; // the parameter here is just a preparation for Vulkan
|
||||
|
||||
private:
|
||||
IShaderProgram(const IShaderProgram &) = delete;
|
||||
IShaderProgram &operator=(const IShaderProgram &) = delete;
|
||||
};
|
|
@ -1,40 +0,0 @@
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright(C) 2016 Magnus Norddahl
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see http://www.gnu.org/licenses/
|
||||
//
|
||||
//--------------------------------------------------------------------------
|
||||
//
|
||||
|
||||
#include "files.h"
|
||||
#include "hw_shadowmapshader.h"
|
||||
|
||||
void FShadowMapShader::Bind(IRenderQueue *q)
|
||||
{
|
||||
if (!mShader)
|
||||
{
|
||||
FString prolog = Uniforms.CreateDeclaration("Uniforms", ShadowMapUniforms::Desc());
|
||||
|
||||
mShader.reset(screen->CreateShaderProgram());
|
||||
mShader->Compile(IShaderProgram::Vertex, "shaders/glsl/screenquad.vp", "", 430);
|
||||
mShader->Compile(IShaderProgram::Fragment, "shaders/glsl/shadowmap.fp", prolog, 430);
|
||||
mShader->Link("shaders/glsl/shadowmap");
|
||||
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
|
||||
Uniforms.Init();
|
||||
}
|
||||
mShader->Bind(q);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef __GL_SHADOWMAPSHADER_H
|
||||
#define __GL_SHADOWMAPSHADER_H
|
||||
|
||||
#include "hwrenderer/postprocessing/hw_shaderprogram.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
|
||||
class FShadowMapShader
|
||||
{
|
||||
public:
|
||||
void Bind(IRenderQueue *q);
|
||||
|
||||
ShaderUniforms<ShadowMapUniforms, POSTPROCESS_BINDINGPOINT> Uniforms;
|
||||
|
||||
private:
|
||||
std::unique_ptr<IShaderProgram> mShader;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -8,7 +8,6 @@
|
|||
#include "vulkan/system/vk_swapchain.h"
|
||||
#include "vulkan/renderer/vk_renderstate.h"
|
||||
#include "hwrenderer/utility/hw_cvars.h"
|
||||
#include "hwrenderer/postprocessing/hw_presentshader.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess.h"
|
||||
#include "hwrenderer/postprocessing/hw_postprocess_cvars.h"
|
||||
#include "hwrenderer/utility/hw_vrmodes.h"
|
||||
|
|
|
@ -498,12 +498,6 @@ FModelRenderer *VulkanFrameBuffer::CreateModelRenderer(int mli)
|
|||
return new FGLModelRenderer(nullptr, *GetRenderState(), mli);
|
||||
}
|
||||
|
||||
IShaderProgram *VulkanFrameBuffer::CreateShaderProgram()
|
||||
{
|
||||
I_FatalError("VulkanFrameBuffer::CreateShaderProgram not implemented\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
IVertexBuffer *VulkanFrameBuffer::CreateVertexBuffer()
|
||||
{
|
||||
return new VKVertexBuffer();
|
||||
|
|
|
@ -68,7 +68,6 @@ public:
|
|||
|
||||
IHardwareTexture *CreateHardwareTexture() override;
|
||||
FModelRenderer *CreateModelRenderer(int mli) override;
|
||||
IShaderProgram *CreateShaderProgram() override;
|
||||
IVertexBuffer *CreateVertexBuffer() override;
|
||||
IIndexBuffer *CreateIndexBuffer() override;
|
||||
IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo) override;
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "hwrenderer/dynlights/hw_shadowmap.h"
|
||||
|
||||
struct sector_t;
|
||||
class IShaderProgram;
|
||||
class FTexture;
|
||||
struct FPortalSceneState;
|
||||
class FSkyVertexBuffer;
|
||||
|
@ -431,7 +430,6 @@ public:
|
|||
virtual void BlurScene(float amount) {}
|
||||
|
||||
// Interface to hardware rendering resources
|
||||
virtual IShaderProgram *CreateShaderProgram() { return nullptr; }
|
||||
virtual IVertexBuffer *CreateVertexBuffer() { return nullptr; }
|
||||
virtual IIndexBuffer *CreateIndexBuffer() { return nullptr; }
|
||||
virtual IDataBuffer *CreateDataBuffer(int bindingpoint, bool ssbo) { return nullptr; }
|
||||
|
|
Loading…
Reference in a new issue