diff options
Diffstat (limited to 'src/shader_recompiler/backend')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | 8 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp | 6 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp index 16e2a8502..d5424301b 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp | |||
| @@ -179,8 +179,12 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, | |||
| 179 | const char swizzle{"xyzw"[element]}; | 179 | const char swizzle{"xyzw"[element]}; |
| 180 | if (IR::IsGeneric(attr)) { | 180 | if (IR::IsGeneric(attr)) { |
| 181 | const u32 index{IR::GenericAttributeIndex(attr)}; | 181 | const u32 index{IR::GenericAttributeIndex(attr)}; |
| 182 | if (!ctx.runtime_info.previous_stage_stores.Generic(index)) { | 182 | if (!ctx.runtime_info.previous_stage_stores.Generic(index, element)) { |
| 183 | ctx.AddF32("{}=0.f;", inst, attr); | 183 | if (element == 3) { |
| 184 | ctx.AddF32("{}=1.f;", inst, attr); | ||
| 185 | } else { | ||
| 186 | ctx.AddF32("{}=0.f;", inst, attr); | ||
| 187 | } | ||
| 184 | return; | 188 | return; |
| 185 | } | 189 | } |
| 186 | ctx.AddF32("{}=in_attr{}{}.{};", inst, index, InputVertexIndex(ctx, vertex), swizzle); | 190 | ctx.AddF32("{}=in_attr{}{}.{};", inst, index, InputVertexIndex(ctx, vertex), swizzle); |
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 77fbb2b2f..756de0a27 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 | |||
| @@ -298,10 +298,14 @@ Id EmitGetAttribute(EmitContext& ctx, IR::Attribute attr, Id vertex) { | |||
| 298 | if (IR::IsGeneric(attr)) { | 298 | if (IR::IsGeneric(attr)) { |
| 299 | const u32 index{IR::GenericAttributeIndex(attr)}; | 299 | const u32 index{IR::GenericAttributeIndex(attr)}; |
| 300 | const std::optional<AttrInfo> type{AttrTypes(ctx, index)}; | 300 | const std::optional<AttrInfo> type{AttrTypes(ctx, index)}; |
| 301 | if (!type || !ctx.runtime_info.previous_stage_stores.Generic(index)) { | 301 | if (!type) { |
| 302 | // Attribute is disabled | 302 | // Attribute is disabled |
| 303 | return ctx.Const(0.0f); | 303 | return ctx.Const(0.0f); |
| 304 | } | 304 | } |
| 305 | if (!ctx.runtime_info.previous_stage_stores.Generic(index, element)) { | ||
| 306 | // Varying component is not written | ||
| 307 | return ctx.Const(type && element == 3 ? 1.0f : 0.0f); | ||
| 308 | } | ||
| 305 | const Id generic_id{ctx.input_generics.at(index)}; | 309 | const Id generic_id{ctx.input_generics.at(index)}; |
| 306 | const Id pointer{AttrPointer(ctx, type->pointer, vertex, generic_id, ctx.Const(element))}; | 310 | const Id pointer{AttrPointer(ctx, type->pointer, vertex, generic_id, ctx.Const(element))}; |
| 307 | const Id value{ctx.OpLoad(type->id, pointer)}; | 311 | const Id value{ctx.OpLoad(type->id, pointer)}; |