Move `data/shaders` to `data/shaders/glsl` Move `data/hlsl` to `data/shaders/hlsl` Fix up shader paths in the cpp files to point to the new glsl location. `data/shaders/hlsl/compile.py` still overwrites the glsl .spv files (for now). Issue: #723
35 lines
No EOL
816 B
GLSL
35 lines
No EOL
816 B
GLSL
// Copyright 2020 Google LLC
|
|
|
|
Texture2D textureColor : register(t1);
|
|
SamplerState samplerColor : register(s1);
|
|
|
|
struct UBO
|
|
{
|
|
float radialBlurScale;
|
|
float radialBlurStrength;
|
|
float2 radialOrigin;
|
|
};
|
|
|
|
cbuffer ubo : register(b0) { UBO ubo; }
|
|
|
|
float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET
|
|
{
|
|
int2 texDim;
|
|
textureColor.GetDimensions(texDim.x, texDim.y);
|
|
float2 radialSize = float2(1.0 / texDim.x, 1.0 / texDim.y);
|
|
|
|
float2 UV = inUV;
|
|
|
|
float4 color = float4(0.0, 0.0, 0.0, 0.0);
|
|
UV += radialSize * 0.5 - ubo.radialOrigin;
|
|
|
|
#define samples 32
|
|
|
|
for (int i = 0; i < samples; i++)
|
|
{
|
|
float scale = 1.0 - ubo.radialBlurScale * (float(i) / float(samples-1));
|
|
color += textureColor.Sample(samplerColor, UV * scale + ubo.radialOrigin);
|
|
}
|
|
|
|
return (color / samples) * ubo.radialBlurStrength;
|
|
} |