summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/spirv/emit_context.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-03-26 16:46:07 -0300
committerGravatar ameerj2021-07-22 21:51:24 -0400
commitd9c5bd9509e82fcde72c18663989931f97ed6518 (patch)
treed6575e66d66a8abc8ee8776c1c2536c052424787 /src/shader_recompiler/backend/spirv/emit_context.cpp
parentshader: Add IR opcode for ImageFetch (diff)
downloadyuzu-d9c5bd9509e82fcde72c18663989931f97ed6518.tar.gz
yuzu-d9c5bd9509e82fcde72c18663989931f97ed6518.tar.xz
yuzu-d9c5bd9509e82fcde72c18663989931f97ed6518.zip
shader: Refactor PTP and other minor changes
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_context.cpp')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index 7d8b938d1..50793b5bf 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -169,7 +169,6 @@ void EmitContext::DefineCommonTypes(const Info& info) {
169 AddCapability(spv::Capability::Float64); 169 AddCapability(spv::Capability::Float64);
170 F64.Define(*this, TypeFloat(64), "f64"); 170 F64.Define(*this, TypeFloat(64), "f64");
171 } 171 }
172 array_U32x2 = Name(TypeArray(U32[2], Constant(U32[1], 4U)), "array-u32x2");
173} 172}
174 173
175void EmitContext::DefineCommonConstants() { 174void EmitContext::DefineCommonConstants() {
@@ -352,20 +351,19 @@ void EmitContext::DefineOutputs(const Info& info) {
352 } 351 }
353 } 352 }
354 if (stage == Stage::Fragment) { 353 if (stage == Stage::Fragment) {
355 for (size_t i = 0; i < 8; ++i) { 354 for (u32 index = 0; index < 8; ++index) {
356 if (!info.stores_frag_color[i]) { 355 if (!info.stores_frag_color[index]) {
357 continue; 356 continue;
358 } 357 }
359 frag_color[i] = DefineOutput(*this, F32[4]); 358 frag_color[index] = DefineOutput(*this, F32[4]);
360 Decorate(frag_color[i], spv::Decoration::Location, static_cast<u32>(i)); 359 Decorate(frag_color[index], spv::Decoration::Location, index);
361 Name(frag_color[i], fmt::format("frag_color{}", i)); 360 Name(frag_color[index], fmt::format("frag_color{}", index));
362 } 361 }
363 if (!info.stores_frag_depth) { 362 if (info.stores_frag_depth) {
364 return; 363 frag_depth = DefineOutput(*this, F32[1]);
364 Decorate(frag_depth, spv::Decoration::BuiltIn, spv::BuiltIn::FragDepth);
365 Name(frag_depth, "frag_depth");
365 } 366 }
366 frag_depth = DefineOutput(*this, F32[1]);
367 Decorate(frag_depth, spv::Decoration::BuiltIn, static_cast<u32>(spv::BuiltIn::FragDepth));
368 Name(frag_depth, "frag_depth");
369 } 367 }
370} 368}
371 369