summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend')
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.cpp3
-rw-r--r--src/shader_recompiler/backend/spirv/emit_context.h1
-rw-r--r--src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp4
3 files changed, 8 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp
index c2d13f97c..4d5dabcbf 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.cpp
+++ b/src/shader_recompiler/backend/spirv/emit_context.cpp
@@ -302,6 +302,9 @@ void EmitContext::DefineInputs(const Info& info) {
base_vertex = DefineInput(*this, U32[1], spv::BuiltIn::BaseVertex);
}
}
+ if (info.loads_front_face) {
+ front_face = DefineInput(*this, U1, spv::BuiltIn::FrontFacing);
+ }
for (size_t index = 0; index < info.loads_generics.size(); ++index) {
if (!info.loads_generics[index]) {
continue;
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h
index 0cb411a0e..01b7b665d 100644
--- a/src/shader_recompiler/backend/spirv/emit_context.h
+++ b/src/shader_recompiler/backend/spirv/emit_context.h
@@ -94,6 +94,7 @@ public:
Id vertex_id{};
Id vertex_index{};
Id base_vertex{};
+ Id front_face{};
Id input_position{};
std::array<Id, 32> input_generics{};
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 8fc040f8b..6fa16eb80 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
@@ -156,6 +156,10 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr) {
return ctx.OpISub(ctx.U32[1], ctx.OpLoad(ctx.U32[1], ctx.vertex_index),
ctx.OpLoad(ctx.U32[1], ctx.base_vertex));
}
+ case IR::Attribute::FrontFace:
+ return ctx.OpSelect(ctx.U32[1], ctx.OpLoad(ctx.U1, ctx.front_face),
+ ctx.Constant(ctx.U32[1], std::numeric_limits<u32>::max()),
+ ctx.u32_zero_value);
default:
throw NotImplementedException("Read attribute {}", attr);
}