Fixes
This commit is contained in:
parent
a7b8ba13cd
commit
448f254a2b
@ -1,5 +1,5 @@
|
|||||||
uniform sampler2D source;
|
uniform sampler2D source;
|
||||||
uniform layout(rgba16f) restrict writeonly image2D dest;
|
uniform layout(r32f) restrict writeonly image2D dest;
|
||||||
uniform vec2 pixel;
|
uniform vec2 pixel;
|
||||||
uniform float sigma;
|
uniform float sigma;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
uniform sampler2D source;
|
uniform sampler2D source;
|
||||||
uniform layout(rgba16f) restrict writeonly image2D dest;
|
uniform layout(r32f) restrict writeonly image2D dest;
|
||||||
uniform vec2 pixel;
|
uniform vec2 pixel;
|
||||||
uniform float sigma;
|
uniform float sigma;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ void main()
|
|||||||
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
g0 = 1.0 / (sqrt(2.0 * 3.14) * sigma);
|
||||||
g1 = exp(-0.5 / (sigma * sigma));
|
g1 = exp(-0.5 / (sigma * sigma));
|
||||||
g2 = g1 * g1;
|
g2 = g1 * g1;
|
||||||
floar sum = local_src[x][y + 6] * g0;
|
float sum = local_src[x][y + 6] * g0;
|
||||||
g0 *= g1;
|
g0 *= g1;
|
||||||
g1 *= g2;
|
g1 *= g2;
|
||||||
for (int i = 1; i < 6; i++) {
|
for (int i = 1; i < 6; i++) {
|
||||||
|
@ -99,6 +99,7 @@ enum TypeFBO
|
|||||||
FBO_EIGHTH2,
|
FBO_EIGHTH2,
|
||||||
FBO_DISPLACE,
|
FBO_DISPLACE,
|
||||||
FBO_BLOOM_1024,
|
FBO_BLOOM_1024,
|
||||||
|
FBO_SCALAR_1024,
|
||||||
FBO_BLOOM_512,
|
FBO_BLOOM_512,
|
||||||
FBO_TMP_512,
|
FBO_TMP_512,
|
||||||
FBO_LENS_512,
|
FBO_LENS_512,
|
||||||
@ -160,6 +161,7 @@ enum TypeRTT
|
|||||||
RTT_MLAA_TMP,
|
RTT_MLAA_TMP,
|
||||||
|
|
||||||
RTT_BLOOM_1024,
|
RTT_BLOOM_1024,
|
||||||
|
RTT_SCALAR_1024,
|
||||||
RTT_BLOOM_512,
|
RTT_BLOOM_512,
|
||||||
RTT_TMP_512,
|
RTT_TMP_512,
|
||||||
RTT_LENS_512,
|
RTT_LENS_512,
|
||||||
|
@ -321,16 +321,38 @@ void PostProcessing::renderGaussian6BlurLayer(FrameBuffer &in_fbo)
|
|||||||
|
|
||||||
for (unsigned i = 0; i < 4; i++)
|
for (unsigned i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
// Used as temp
|
|
||||||
irr_driver->getFBO(FBO_BLOOM_1024).Bind();
|
|
||||||
GLuint LayerTex;
|
GLuint LayerTex;
|
||||||
glGenTextures(1, &LayerTex);
|
glGenTextures(1, &LayerTex);
|
||||||
glTextureView(LayerTex, GL_TEXTURE_2D, in_fbo.getRTT()[0], GL_R32F, 0, 1, i, 1);
|
glTextureView(LayerTex, GL_TEXTURE_2D, in_fbo.getRTT()[0], GL_R32F, 0, 1, i, 1);
|
||||||
|
if (!irr_driver->hasARBComputeShaders())
|
||||||
|
{
|
||||||
|
// Used as temp
|
||||||
|
irr_driver->getFBO(FBO_SCALAR_1024).Bind();
|
||||||
FullScreenShader::Gaussian6VBlurShader::getInstance()->SetTextureUnits(LayerTex);
|
FullScreenShader::Gaussian6VBlurShader::getInstance()->SetTextureUnits(LayerTex);
|
||||||
DrawFullScreenEffect<FullScreenShader::Gaussian6VBlurShader>(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f);
|
DrawFullScreenEffect<FullScreenShader::Gaussian6VBlurShader>(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f);
|
||||||
in_fbo.BindLayer(i);
|
in_fbo.BindLayer(i);
|
||||||
FullScreenShader::Gaussian6HBlurShader::getInstance()->SetTextureUnits(irr_driver->getFBO(FBO_BLOOM_1024).getRTT()[0]);
|
FullScreenShader::Gaussian6HBlurShader::getInstance()->SetTextureUnits(irr_driver->getFBO(FBO_SCALAR_1024).getRTT()[0]);
|
||||||
DrawFullScreenEffect<FullScreenShader::Gaussian6HBlurShader>(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f);
|
DrawFullScreenEffect<FullScreenShader::Gaussian6HBlurShader>(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
|
||||||
|
glUseProgram(FullScreenShader::ComputeShadowBlurVShader::getInstance()->Program);
|
||||||
|
FullScreenShader::ComputeShadowBlurVShader::getInstance()->SetTextureUnits(LayerTex);
|
||||||
|
glBindSampler(FullScreenShader::ComputeShadowBlurVShader::getInstance()->TU_dest, 0);
|
||||||
|
glBindImageTexture(FullScreenShader::ComputeShadowBlurVShader::getInstance()->TU_dest, irr_driver->getFBO(FBO_SCALAR_1024).getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R32F);
|
||||||
|
FullScreenShader::ComputeShadowBlurVShader::getInstance()->setUniforms(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f);
|
||||||
|
glDispatchCompute((int)1024 / 8 + 1, (int)1024 / 8 + 1, 1);
|
||||||
|
|
||||||
|
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT | GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||||
|
glUseProgram(FullScreenShader::ComputeShadowBlurHShader::getInstance()->Program);
|
||||||
|
FullScreenShader::ComputeShadowBlurHShader::getInstance()->SetTextureUnits(irr_driver->getFBO(FBO_SCALAR_1024).getRTT()[0]);
|
||||||
|
glBindSampler(FullScreenShader::ComputeShadowBlurHShader::getInstance()->TU_dest, 0);
|
||||||
|
glBindImageTexture(FullScreenShader::ComputeShadowBlurHShader::getInstance()->TU_dest, LayerTex, 0, false, 0, GL_WRITE_ONLY, GL_R32F);
|
||||||
|
FullScreenShader::ComputeShadowBlurHShader::getInstance()->setUniforms(core::vector2df(1.f / 1024.f, 1.f / 1024.f), 1.f);
|
||||||
|
glDispatchCompute((int)1024 / 8 + 1, (int)1024 / 8 + 1, 1);
|
||||||
|
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||||
|
}
|
||||||
glDeleteTextures(1, &LayerTex);
|
glDeleteTextures(1, &LayerTex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,7 @@ RTT::RTT(size_t width, size_t height)
|
|||||||
RenderTargetTextures[RTT_HALF2_R] = generateRTT(half, GL_R16F, GL_RED, GL_FLOAT);
|
RenderTargetTextures[RTT_HALF2_R] = generateRTT(half, GL_R16F, GL_RED, GL_FLOAT);
|
||||||
|
|
||||||
RenderTargetTextures[RTT_BLOOM_1024] = generateRTT(shadowsize0, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
RenderTargetTextures[RTT_BLOOM_1024] = generateRTT(shadowsize0, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
||||||
|
RenderTargetTextures[RTT_SCALAR_1024] = generateRTT(shadowsize0, GL_R32F, GL_RED, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_BLOOM_512] = generateRTT(shadowsize1, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
RenderTargetTextures[RTT_BLOOM_512] = generateRTT(shadowsize1, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_TMP_512] = generateRTT(shadowsize1, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
RenderTargetTextures[RTT_TMP_512] = generateRTT(shadowsize1, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
||||||
RenderTargetTextures[RTT_LENS_512] = generateRTT(shadowsize1, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
RenderTargetTextures[RTT_LENS_512] = generateRTT(shadowsize1, GL_RGBA16F, GL_BGR, GL_FLOAT);
|
||||||
@ -208,6 +209,9 @@ RTT::RTT(size_t width, size_t height)
|
|||||||
somevector.push_back(RenderTargetTextures[RTT_BLOOM_1024]);
|
somevector.push_back(RenderTargetTextures[RTT_BLOOM_1024]);
|
||||||
FrameBuffers.push_back(new FrameBuffer(somevector, 1024, 1024));
|
FrameBuffers.push_back(new FrameBuffer(somevector, 1024, 1024));
|
||||||
somevector.clear();
|
somevector.clear();
|
||||||
|
somevector.push_back(RenderTargetTextures[RTT_SCALAR_1024]);
|
||||||
|
FrameBuffers.push_back(new FrameBuffer(somevector, 1024, 1024));
|
||||||
|
somevector.clear();
|
||||||
somevector.push_back(RenderTargetTextures[RTT_BLOOM_512]);
|
somevector.push_back(RenderTargetTextures[RTT_BLOOM_512]);
|
||||||
FrameBuffers.push_back(new FrameBuffer(somevector, 512, 512));
|
FrameBuffers.push_back(new FrameBuffer(somevector, 512, 512));
|
||||||
somevector.clear();
|
somevector.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user