summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-10-30 18:17:27 -0300
committerGravatar ReinUsesLisp2019-12-09 23:52:28 -0300
commit0b5b93053d5f427c668a2494c52adfd468cf5728 (patch)
treeb850d080dce2c8f1c496c03a995b033fb2e4fad3 /src
parentvk_shader_decompiler: Misc changes (diff)
downloadyuzu-0b5b93053d5f427c668a2494c52adfd468cf5728.tar.gz
yuzu-0b5b93053d5f427c668a2494c52adfd468cf5728.tar.xz
yuzu-0b5b93053d5f427c668a2494c52adfd468cf5728.zip
shader_ir/other: Implement S2R InvocationId
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp5
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp1
-rw-r--r--src/video_core/shader/decode/other.cpp2
-rw-r--r--src/video_core/shader/node.h1
4 files changed, 9 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 3d3cd21f3..9700c2ebe 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1915,6 +1915,10 @@ private:
1915 return {}; 1915 return {};
1916 } 1916 }
1917 1917
1918 Expression InvocationId(Operation operation) {
1919 return {"gl_InvocationID", Type::Int};
1920 }
1921
1918 Expression YNegate(Operation operation) { 1922 Expression YNegate(Operation operation) {
1919 return {"y_direction", Type::Float}; 1923 return {"y_direction", Type::Float};
1920 } 1924 }
@@ -2153,6 +2157,7 @@ private:
2153 &GLSLDecompiler::EmitVertex, 2157 &GLSLDecompiler::EmitVertex,
2154 &GLSLDecompiler::EndPrimitive, 2158 &GLSLDecompiler::EndPrimitive,
2155 2159
2160 &GLSLDecompiler::InvocationId,
2156 &GLSLDecompiler::YNegate, 2161 &GLSLDecompiler::YNegate,
2157 &GLSLDecompiler::LocalInvocationId<0>, 2162 &GLSLDecompiler::LocalInvocationId<0>,
2158 &GLSLDecompiler::LocalInvocationId<1>, 2163 &GLSLDecompiler::LocalInvocationId<1>,
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 8f517bdc1..663293632 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -2357,6 +2357,7 @@ private:
2357 &SPIRVDecompiler::EmitVertex, 2357 &SPIRVDecompiler::EmitVertex,
2358 &SPIRVDecompiler::EndPrimitive, 2358 &SPIRVDecompiler::EndPrimitive,
2359 2359
2360 &SPIRVDecompiler::InvocationId,
2360 &SPIRVDecompiler::YNegate, 2361 &SPIRVDecompiler::YNegate,
2361 &SPIRVDecompiler::LocalInvocationId<0>, 2362 &SPIRVDecompiler::LocalInvocationId<0>,
2362 &SPIRVDecompiler::LocalInvocationId<1>, 2363 &SPIRVDecompiler::LocalInvocationId<1>,
diff --git a/src/video_core/shader/decode/other.cpp b/src/video_core/shader/decode/other.cpp
index 17cd45d3c..5c802886b 100644
--- a/src/video_core/shader/decode/other.cpp
+++ b/src/video_core/shader/decode/other.cpp
@@ -69,6 +69,8 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) {
69 case OpCode::Id::MOV_SYS: { 69 case OpCode::Id::MOV_SYS: {
70 const Node value = [this, instr] { 70 const Node value = [this, instr] {
71 switch (instr.sys20) { 71 switch (instr.sys20) {
72 case SystemVariable::InvocationId:
73 return Operation(OperationCode::InvocationId);
72 case SystemVariable::Ydirection: 74 case SystemVariable::Ydirection:
73 return Operation(OperationCode::YNegate); 75 return Operation(OperationCode::YNegate);
74 case SystemVariable::InvocationInfo: 76 case SystemVariable::InvocationInfo:
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h
index 8f4811c88..1a4d28ae9 100644
--- a/src/video_core/shader/node.h
+++ b/src/video_core/shader/node.h
@@ -172,6 +172,7 @@ enum class OperationCode {
172 EmitVertex, /// () -> void 172 EmitVertex, /// () -> void
173 EndPrimitive, /// () -> void 173 EndPrimitive, /// () -> void
174 174
175 InvocationId, /// () -> int
175 YNegate, /// () -> float 176 YNegate, /// () -> float
176 LocalInvocationIdX, /// () -> uint 177 LocalInvocationIdX, /// () -> uint
177 LocalInvocationIdY, /// () -> uint 178 LocalInvocationIdY, /// () -> uint