mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-24 04:41:53 +00:00
Fix blur shader to use RenderScreenQuad
This commit is contained in:
parent
210fce1193
commit
647ef5d029
3 changed files with 17 additions and 21 deletions
|
@ -154,8 +154,8 @@ void FGLRenderer::BloomScene()
|
|||
{
|
||||
const auto &level = mBuffers->BloomLevels[i];
|
||||
const auto &next = mBuffers->BloomLevels[i + 1];
|
||||
mBlurShader->BlurHorizontal(mVBO, blurAmount, sampleCount, level.VTexture, level.HFramebuffer, level.Width, level.Height);
|
||||
mBlurShader->BlurVertical(mVBO, blurAmount, sampleCount, level.HTexture, next.VFramebuffer, next.Width, next.Height);
|
||||
mBlurShader->BlurHorizontal(this, blurAmount, sampleCount, level.VTexture, level.HFramebuffer, level.Width, level.Height);
|
||||
mBlurShader->BlurVertical(this, blurAmount, sampleCount, level.HTexture, next.VFramebuffer, next.Width, next.Height);
|
||||
}
|
||||
|
||||
// Blur and upscale:
|
||||
|
@ -164,8 +164,8 @@ void FGLRenderer::BloomScene()
|
|||
const auto &level = mBuffers->BloomLevels[i];
|
||||
const auto &next = mBuffers->BloomLevels[i - 1];
|
||||
|
||||
mBlurShader->BlurHorizontal(mVBO, blurAmount, sampleCount, level.VTexture, level.HFramebuffer, level.Width, level.Height);
|
||||
mBlurShader->BlurVertical(mVBO, blurAmount, sampleCount, level.HTexture, level.VFramebuffer, level.Width, level.Height);
|
||||
mBlurShader->BlurHorizontal(this, blurAmount, sampleCount, level.VTexture, level.HFramebuffer, level.Width, level.Height);
|
||||
mBlurShader->BlurVertical(this, blurAmount, sampleCount, level.HTexture, level.VFramebuffer, level.Width, level.Height);
|
||||
|
||||
// Linear upscale:
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, next.VFramebuffer);
|
||||
|
@ -179,8 +179,8 @@ void FGLRenderer::BloomScene()
|
|||
RenderScreenQuad();
|
||||
}
|
||||
|
||||
mBlurShader->BlurHorizontal(mVBO, blurAmount, sampleCount, level0.VTexture, level0.HFramebuffer, level0.Width, level0.Height);
|
||||
mBlurShader->BlurVertical(mVBO, blurAmount, sampleCount, level0.HTexture, level0.VFramebuffer, level0.Width, level0.Height);
|
||||
mBlurShader->BlurHorizontal(this, blurAmount, sampleCount, level0.VTexture, level0.HFramebuffer, level0.Width, level0.Height);
|
||||
mBlurShader->BlurVertical(this, blurAmount, sampleCount, level0.HTexture, level0.VFramebuffer, level0.Width, level0.Height);
|
||||
|
||||
// Add bloom back to scene texture:
|
||||
mBuffers->BindCurrentFB();
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "gl/system/gl_cvars.h"
|
||||
#include "gl/shaders/gl_blurshader.h"
|
||||
#include "gl/data/gl_vertexbuffer.h"
|
||||
#include "gl/renderer/gl_renderer.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -56,9 +57,9 @@
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FBlurShader::BlurVertical(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height)
|
||||
void FBlurShader::BlurVertical(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height)
|
||||
{
|
||||
Blur(vbo, blurAmount, sampleCount, inputTexture, outputFrameBuffer, width, height, true);
|
||||
Blur(renderer, blurAmount, sampleCount, inputTexture, outputFrameBuffer, width, height, true);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -67,9 +68,9 @@ void FBlurShader::BlurVertical(FFlatVertexBuffer *vbo, float blurAmount, int sam
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FBlurShader::BlurHorizontal(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height)
|
||||
void FBlurShader::BlurHorizontal(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height)
|
||||
{
|
||||
Blur(vbo, blurAmount, sampleCount, inputTexture, outputFrameBuffer, width, height, false);
|
||||
Blur(renderer, blurAmount, sampleCount, inputTexture, outputFrameBuffer, width, height, false);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -78,7 +79,7 @@ void FBlurShader::BlurHorizontal(FFlatVertexBuffer *vbo, float blurAmount, int s
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FBlurShader::Blur(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height, bool vertical)
|
||||
void FBlurShader::Blur(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height, bool vertical)
|
||||
{
|
||||
BlurSetup *setup = GetSetup(blurAmount, sampleCount);
|
||||
if (vertical)
|
||||
|
@ -111,12 +112,7 @@ void FBlurShader::Blur(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount
|
|||
glViewport(0, 0, width, height);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
FFlatVertex *ptr = vbo->GetBuffer();
|
||||
ptr->Set(-1.0f, -1.0f, 0, 0.0f, 0.0f); ptr++;
|
||||
ptr->Set(-1.0f, 1.0f, 0, 0.0f, 1.0f); ptr++;
|
||||
ptr->Set(1.0f, -1.0f, 0, 1.0f, 0.0f); ptr++;
|
||||
ptr->Set(1.0f, 1.0f, 0, 1.0f, 1.0f); ptr++;
|
||||
vbo->RenderCurrent(ptr, GL_TRIANGLE_STRIP);
|
||||
renderer->RenderScreenQuad();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
#include "gl_shaderprogram.h"
|
||||
#include <memory>
|
||||
|
||||
class FFlatVertexBuffer;
|
||||
class FGLRenderer;
|
||||
|
||||
class FBlurShader
|
||||
{
|
||||
public:
|
||||
void BlurVertical(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height);
|
||||
void BlurHorizontal(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height);
|
||||
void BlurVertical(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height);
|
||||
void BlurHorizontal(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height);
|
||||
|
||||
private:
|
||||
void Blur(FFlatVertexBuffer *vbo, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height, bool vertical);
|
||||
void Blur(FGLRenderer *renderer, float blurAmount, int sampleCount, GLuint inputTexture, GLuint outputFrameBuffer, int width, int height, bool vertical);
|
||||
|
||||
struct BlurSetup
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue