summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_special.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
index 6c8fcd5a5..fee740c08 100644
--- a/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_spirv_special.cpp
@@ -15,6 +15,13 @@ void ConvertDepthMode(EmitContext& ctx) {
15 const Id vector{ctx.OpCompositeInsert(ctx.F32[4], screen_depth, position, 2u)}; 15 const Id vector{ctx.OpCompositeInsert(ctx.F32[4], screen_depth, position, 2u)};
16 ctx.OpStore(ctx.output_position, vector); 16 ctx.OpStore(ctx.output_position, vector);
17} 17}
18
19void SetFixedPipelinePointSize(EmitContext& ctx) {
20 if (ctx.profile.fixed_state_point_size) {
21 const float point_size{*ctx.profile.fixed_state_point_size};
22 ctx.OpStore(ctx.output_point_size, ctx.Constant(ctx.F32[1], point_size));
23 }
24}
18} // Anonymous namespace 25} // Anonymous namespace
19 26
20void EmitPrologue(EmitContext& ctx) { 27void EmitPrologue(EmitContext& ctx) {
@@ -28,10 +35,9 @@ void EmitPrologue(EmitContext& ctx) {
28 ctx.OpStore(generic_id, default_vector); 35 ctx.OpStore(generic_id, default_vector);
29 } 36 }
30 } 37 }
31 if (ctx.profile.fixed_state_point_size) { 38 }
32 const float point_size{*ctx.profile.fixed_state_point_size}; 39 if (ctx.stage == Stage::VertexB || ctx.stage == Stage::Geometry) {
33 ctx.OpStore(ctx.output_point_size, ctx.Constant(ctx.F32[1], point_size)); 40 SetFixedPipelinePointSize(ctx);
34 }
35 } 41 }
36} 42}
37 43
@@ -45,21 +51,23 @@ void EmitEmitVertex(EmitContext& ctx, const IR::Value& stream) {
45 if (ctx.profile.convert_depth_mode) { 51 if (ctx.profile.convert_depth_mode) {
46 ConvertDepthMode(ctx); 52 ConvertDepthMode(ctx);
47 } 53 }
48 if (!stream.IsImmediate()) { 54 if (stream.IsImmediate()) {
55 ctx.OpEmitStreamVertex(ctx.Def(stream));
56 } else {
49 // LOG_WARNING(..., "EmitVertex's stream is not constant"); 57 // LOG_WARNING(..., "EmitVertex's stream is not constant");
50 ctx.OpEmitStreamVertex(ctx.u32_zero_value); 58 ctx.OpEmitStreamVertex(ctx.u32_zero_value);
51 return;
52 } 59 }
53 ctx.OpEmitStreamVertex(ctx.Def(stream)); 60 // Restore fixed pipeline point size after emitting the vertex
61 SetFixedPipelinePointSize(ctx);
54} 62}
55 63
56void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) { 64void EmitEndPrimitive(EmitContext& ctx, const IR::Value& stream) {
57 if (!stream.IsImmediate()) { 65 if (stream.IsImmediate()) {
66 ctx.OpEndStreamPrimitive(ctx.Def(stream));
67 } else {
58 // LOG_WARNING(..., "EndPrimitive's stream is not constant"); 68 // LOG_WARNING(..., "EndPrimitive's stream is not constant");
59 ctx.OpEndStreamPrimitive(ctx.u32_zero_value); 69 ctx.OpEndStreamPrimitive(ctx.u32_zero_value);
60 return;
61 } 70 }
62 ctx.OpEndStreamPrimitive(ctx.Def(stream));
63} 71}
64 72
65} // namespace Shader::Backend::SPIRV 73} // namespace Shader::Backend::SPIRV