summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-04-16 18:47:26 -0300
committerGravatar ameerj2021-07-22 21:51:28 -0400
commit80940b17069f6baa733a9b572445b27bc7509137 (patch)
treeb6d73140e8f84cd4c3916895cbf054d124c98b7e /src/shader_recompiler/backend
parentshader: Implement PIXLD.MY_INDEX (diff)
downloadyuzu-80940b17069f6baa733a9b572445b27bc7509137.tar.gz
yuzu-80940b17069f6baa733a9b572445b27bc7509137.tar.xz
yuzu-80940b17069f6baa733a9b572445b27bc7509137.zip
shader: Implement SampleMask
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp5
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.h1
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv.h1
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp4
4 files changed, 10 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index 0b4abeb44..b9e6d5655 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -1179,7 +1179,10 @@ void EmitContext::DefineOutputs(const IR::Program& program) {
1179 if (info.stores_frag_depth) { 1179 if (info.stores_frag_depth) {
1180 frag_depth = DefineOutput(*this, F32[1], std::nullopt); 1180 frag_depth = DefineOutput(*this, F32[1], std::nullopt);
1181 Decorate(frag_depth, spv::Decoration::BuiltIn, spv::BuiltIn::FragDepth); 1181 Decorate(frag_depth, spv::Decoration::BuiltIn, spv::BuiltIn::FragDepth);
1182 Name(frag_depth, "frag_depth"); 1182 }
1183 if (info.stores_sample_mask) {
1184 sample_mask = DefineOutput(*this, U32[1], std::nullopt);
1185 Decorate(sample_mask, spv::Decoration::BuiltIn, spv::BuiltIn::SampleMask);
1183 } 1186 }
1184 break; 1187 break;
1185 default: 1188 default:
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h
index 9d8340333..528dc33fe 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.h
+++ b/src/shader_recompiler/backend/spirv/emit_context.h
@@ -215,6 +215,7 @@ public:
215 std::array<Id, 30> patches{}; 215 std::array<Id, 30> patches{};
216 216
217 std::array<Id, 8> frag_color{}; 217 std::array<Id, 8> frag_color{};
218 Id sample_mask{};
218 Id frag_depth{}; 219 Id frag_depth{};
219 220
220 std::vector<Id> interfaces; 221 std::vector<Id> interfaces;
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.h b/src/shader_recompiler/backend/spirv/emit_spirv.h
index dfddf5e58..9f658a4bd 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv.h
+++ b/src/shader_recompiler/backend/spirv/emit_spirv.h
@@ -58,6 +58,7 @@ void EmitSetAttributeIndexed(EmitContext& ctx, Id offset, Id value, Id vertex);
58Id EmitGetPatch(EmitContext& ctx, IR::Patch patch); 58Id EmitGetPatch(EmitContext& ctx, IR::Patch patch);
59void EmitSetPatch(EmitContext& ctx, IR::Patch patch, Id value); 59void EmitSetPatch(EmitContext& ctx, IR::Patch patch, Id value);
60void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, Id value); 60void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, Id value);
61void EmitSetSampleMask(EmitContext& ctx, Id value);
61void EmitSetFragDepth(EmitContext& ctx, Id value); 62void EmitSetFragDepth(EmitContext& ctx, Id value);
62void EmitGetZFlag(EmitContext& ctx); 63void EmitGetZFlag(EmitContext& ctx);
63void EmitGetSFlag(EmitContext& ctx); 64void EmitGetSFlag(EmitContext& ctx);
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
index 7555dd94c..e5e4c352b 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp
@@ -343,6 +343,10 @@ void EmitSetFragColor(EmitContext& ctx, u32 index, u32 component, Id value) {
343 ctx.OpStore(pointer, value); 343 ctx.OpStore(pointer, value);
344} 344}
345 345
346void EmitSetSampleMask(EmitContext& ctx, Id value) {
347 ctx.OpStore(ctx.sample_mask, value);
348}
349
346void EmitSetFragDepth(EmitContext& ctx, Id value) { 350void EmitSetFragDepth(EmitContext& ctx, Id value) {
347 ctx.OpStore(ctx.frag_depth, value); 351 ctx.OpStore(ctx.frag_depth, value);
348} 352}