aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/Shaders/DepthDrawToMsFragmentShaderSource.frag
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-04-17 05:13:53 -0300
committerGitHub <noreply@github.com>2023-04-17 08:13:53 +0000
commitd9b63353b019e1f1775370154f4f045ff14184ce (patch)
treeef4909c3da741eb9c498fcd57891c857a5cabe5a /Ryujinx.Graphics.Vulkan/Shaders/DepthDrawToMsFragmentShaderSource.frag
parenteabd0ec93f903fb39605a29b35db4c6290bc9c88 (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/DepthDrawToMsFragmentShaderSource.frag')
-rw-r--r--Ryujinx.Graphics.Vulkan/Shaders/DepthDrawToMsFragmentShaderSource.frag25
1 files changed, 25 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Vulkan/Shaders/DepthDrawToMsFragmentShaderSource.frag b/Ryujinx.Graphics.Vulkan/Shaders/DepthDrawToMsFragmentShaderSource.frag
new file mode 100644
index 00000000..bf5f612f
--- /dev/null
+++ b/Ryujinx.Graphics.Vulkan/Shaders/DepthDrawToMsFragmentShaderSource.frag
@@ -0,0 +1,25 @@
+#version 450 core
+
+layout (std140, binding = 0) uniform sample_counts_log2_in
+{
+ ivec4 sample_counts_log2;
+};
+
+layout (set = 2, binding = 0) uniform sampler2D 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_FragDepth = texelFetch(src, ivec2(inX, inY), 0).r;
+} \ No newline at end of file