summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2021-05-21 02:12:32 -0300
committerGravatar ameerj2021-07-22 21:51:33 -0400
commit9e7b6622c25aa858b96bf0f1c7f94223a2f449a2 (patch)
tree48c62889aeb79d6f0f01a467ba0d1ac01dec512b /src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
parentemit_glasm_context_get_and_set.cpp: Add missing semicolons (diff)
downloadyuzu-9e7b6622c25aa858b96bf0f1c7f94223a2f449a2.tar.gz
yuzu-9e7b6622c25aa858b96bf0f1c7f94223a2f449a2.tar.xz
yuzu-9e7b6622c25aa858b96bf0f1c7f94223a2f449a2.zip
shader: Split profile and runtime information in separate structs
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv_special.cpp')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_special.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
index ba948f3c9..072a3b1bd 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
@@ -18,8 +18,8 @@ void ConvertDepthMode(EmitContext& ctx) {
18} 18}
19 19
20void SetFixedPipelinePointSize(EmitContext& ctx) { 20void SetFixedPipelinePointSize(EmitContext& ctx) {
21 if (ctx.profile.fixed_state_point_size) { 21 if (ctx.runtime_info.fixed_state_point_size) {
22 const float point_size{*ctx.profile.fixed_state_point_size}; 22 const float point_size{*ctx.runtime_info.fixed_state_point_size};
23 ctx.OpStore(ctx.output_point_size, ctx.Const(point_size)); 23 ctx.OpStore(ctx.output_point_size, ctx.Const(point_size));
24 } 24 }
25} 25}
@@ -62,7 +62,10 @@ Id ComparisonFunction(EmitContext& ctx, CompareFunction comparison, Id operand_1
62} 62}
63 63
64void AlphaTest(EmitContext& ctx) { 64void AlphaTest(EmitContext& ctx) {
65 const auto comparison{*ctx.profile.alpha_test_func}; 65 if (!ctx.runtime_info.alpha_test_func) {
66 return;
67 }
68 const auto comparison{*ctx.runtime_info.alpha_test_func};
66 if (comparison == CompareFunction::Always) { 69 if (comparison == CompareFunction::Always) {
67 return; 70 return;
68 } 71 }
@@ -76,7 +79,7 @@ void AlphaTest(EmitContext& ctx) {
76 79
77 const Id true_label{ctx.OpLabel()}; 80 const Id true_label{ctx.OpLabel()};
78 const Id discard_label{ctx.OpLabel()}; 81 const Id discard_label{ctx.OpLabel()};
79 const Id alpha_reference{ctx.Const(ctx.profile.alpha_test_reference)}; 82 const Id alpha_reference{ctx.Const(ctx.runtime_info.alpha_test_reference)};
80 const Id condition{ComparisonFunction(ctx, comparison, alpha, alpha_reference)}; 83 const Id condition{ComparisonFunction(ctx, comparison, alpha, alpha_reference)};
81 84
82 ctx.OpSelectionMerge(true_label, spv::SelectionControlMask::MaskNone); 85 ctx.OpSelectionMerge(true_label, spv::SelectionControlMask::MaskNone);
@@ -113,7 +116,7 @@ void EmitPrologue(EmitContext& ctx) {
113} 116}
114 117
115void EmitEpilogue(EmitContext& ctx) { 118void EmitEpilogue(EmitContext& ctx) {
116 if (ctx.stage == Stage::VertexB && ctx.profile.convert_depth_mode) { 119 if (ctx.stage == Stage::VertexB && ctx.runtime_info.convert_depth_mode) {
117 ConvertDepthMode(ctx); 120 ConvertDepthMode(ctx);
118 } 121 }
119 if (ctx.stage == Stage::Fragment) { 122 if (ctx.stage == Stage::Fragment) {
@@ -122,7 +125,7 @@ void EmitEpilogue(EmitContext& ctx) {
122} 125}
123 126
124void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) { 127void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) {
125 if (ctx.profile.convert_depth_mode) { 128 if (ctx.runtime_info.convert_depth_mode) {
126 ConvertDepthMode(ctx); 129 ConvertDepthMode(ctx);
127 } 130 }
128 if (stream.IsImmediate()) { 131 if (stream.IsImmediate()) {