diff options
author | gdkchan <gab.dark.100@gmail.com> | 2023-04-17 05:13:53 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 08:13:53 +0000 |
commit | d9b63353b019e1f1775370154f4f045ff14184ce (patch) | |
tree | ef4909c3da741eb9c498fcd57891c857a5cabe5a /Ryujinx.Graphics.Vulkan/Shaders/StencilDrawToMsFragmentShaderSource.frag | |
parent | eabd0ec93f903fb39605a29b35db4c6290bc9c88 (diff) |
Support copy between multisample and non-multisample depth textures (#4676)1.1.721
* Support copy between multisample and non-multisample depth textures
* PR feedback
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/Shaders/StencilDrawToMsFragmentShaderSource.frag')
-rw-r--r-- | Ryujinx.Graphics.Vulkan/Shaders/StencilDrawToMsFragmentShaderSource.frag | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Vulkan/Shaders/StencilDrawToMsFragmentShaderSource.frag b/Ryujinx.Graphics.Vulkan/Shaders/StencilDrawToMsFragmentShaderSource.frag new file mode 100644 index 00000000..a07ae9d1 --- /dev/null +++ b/Ryujinx.Graphics.Vulkan/Shaders/StencilDrawToMsFragmentShaderSource.frag @@ -0,0 +1,27 @@ +#version 450 core + +#extension GL_ARB_shader_stencil_export : require + +layout (std140, binding = 0) uniform sample_counts_log2_in +{ + ivec4 sample_counts_log2; +}; + +layout (set = 2, binding = 0) uniform isampler2D src; + +void main() +{ + int deltaX = sample_counts_log2.x - sample_counts_log2.z; + int deltaY = sample_counts_log2.y - sample_counts_log2.w; + int samplesInXLog2 = sample_counts_log2.z; + int samplesInYLog2 = sample_counts_log2.w; + int samplesInX = 1 << samplesInXLog2; + int samplesInY = 1 << samplesInYLog2; + + int sampleIndex = gl_SampleID; + + int inX = (int(gl_FragCoord.x) << sample_counts_log2.x) | ((sampleIndex & (samplesInX - 1)) << deltaX); + int inY = (int(gl_FragCoord.y) << sample_counts_log2.y) | ((sampleIndex >> samplesInXLog2) << deltaY); + + gl_FragStencilRefARB = texelFetch(src, ivec2(inX, inY), 0).r; +}
\ No newline at end of file |