Skip to content

Commit

Permalink
Removed usage of image_load_formatted to better support ancient Keple…
Browse files Browse the repository at this point in the history
…r (GTX 7xx) GPUs
  • Loading branch information
JuanDiegoMontoya committed Oct 28, 2023
1 parent a0f0a38 commit 3177cb5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions data/shaders/bloom/BloomCommon.h.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ layout(binding = 0, std140) uniform UniformBuffer
float width;
float strength;
float sourceLod;
float targetLod;
uint numPasses;
uint isFinalPass;
}uniforms;
Expand Down
6 changes: 3 additions & 3 deletions data/shaders/bloom/BloomUpsample.comp.glsl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#version 460 core

#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_image_load_formatted : require

#include "BloomCommon.h.glsl"

layout(binding = 0) uniform sampler2D s_source;
layout(binding = 0) uniform image2D i_target;
layout(binding = 1) uniform sampler2D s_target;
layout(binding = 0) uniform writeonly image2D i_target;

layout(local_size_x = 16, local_size_y = 16) in;
void main()
Expand All @@ -21,7 +21,7 @@ void main()
// center of written pixel
vec2 uv = (vec2(gid) + 0.5) / uniforms.targetDim;

vec4 rgba = imageLoad(i_target, gid);
vec4 rgba = texelFetch(s_target, gid, int(uniforms.targetLod));

vec4 blurSum = vec4(0);
blurSum += textureLod(s_source, uv + vec2(-1, -1) * texel * uniforms.width, uniforms.sourceLod) * 1.0 / 16.0;
Expand Down
5 changes: 2 additions & 3 deletions data/shaders/shadows/vsm/VsmReduceBitmaskHzb.comp.glsl
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#version 450 core

#extension GL_GOOGLE_include_directive : enable
#extension GL_EXT_shader_image_load_formatted : require

#include "../../Math.h.glsl"
#include "../../GlobalUniforms.h.glsl"
#include "VsmCommon.h.glsl"

layout(binding = 2) uniform restrict readonly uimage2DArray i_srcVsmBitmaskHzb;
layout(binding = 3) uniform restrict writeonly uimage2DArray i_dstVsmBitmaskHzb;
layout(binding = 2, r8ui) uniform restrict readonly uimage2DArray i_srcVsmBitmaskHzb;
layout(binding = 3, r8ui) uniform restrict writeonly uimage2DArray i_dstVsmBitmaskHzb;

layout(binding = 7, std140) uniform VsmReduceUniforms
{
Expand Down
2 changes: 2 additions & 0 deletions src/techniques/Bloom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ namespace Techniques
}

Fwog::Cmd::BindSampledImage(0, params.scratchTexture, linearSampler);
Fwog::Cmd::BindSampledImage(1, *targetTex, linearSampler);
Fwog::Cmd::BindImage(0, *targetTex, targetLod);

BloomUniforms uniforms{
Expand All @@ -141,6 +142,7 @@ namespace Techniques
.width = params.width,
.strength = params.strength,
.sourceLod = static_cast<float>(i),
.targetLod = static_cast<float>(targetLod),
.numPasses = params.passes,
.isFinalPass = i == 0,
};
Expand Down
3 changes: 2 additions & 1 deletion src/techniques/Bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ namespace Techniques
float width;
float strength;
float sourceLod;
float targetLod;
uint32_t numPasses;
uint32_t isFinalPass;
uint32_t _padding[3];
uint32_t _padding[2];
};

Fwog::TypedBuffer<BloomUniforms> uniformBuffer;
Expand Down

0 comments on commit 3177cb5

Please sign in to comment.