diff options
| author | 2021-05-31 05:34:53 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:34 -0400 | |
| commit | 5539b13c5a696de553be86bb7c4ae61a0cdcc754 (patch) | |
| tree | f5ebdb9fb9459ade45e598122430cfe951c9463c /src/shader_recompiler/backend/glasm | |
| parent | glasm: Implement legacy varyings (diff) | |
| download | yuzu-5539b13c5a696de553be86bb7c4ae61a0cdcc754.tar.gz yuzu-5539b13c5a696de553be86bb7c4ae61a0cdcc754.tar.xz yuzu-5539b13c5a696de553be86bb7c4ae61a0cdcc754.zip | |
shader,glasm: Implement legacy texcoord loads
Diffstat (limited to 'src/shader_recompiler/backend/glasm')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp index 3236def25..3b73e8757 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_context_get_set.cpp | |||
| @@ -37,6 +37,10 @@ bool IsInputArray(Stage stage) { | |||
| 37 | std::string VertexIndex(EmitContext& ctx, ScalarU32 vertex) { | 37 | std::string VertexIndex(EmitContext& ctx, ScalarU32 vertex) { |
| 38 | return IsInputArray(ctx.stage) ? fmt::format("[{}]", vertex) : ""; | 38 | return IsInputArray(ctx.stage) ? fmt::format("[{}]", vertex) : ""; |
| 39 | } | 39 | } |
| 40 | |||
| 41 | u32 TexCoordIndex(IR::Attribute attr) { | ||
| 42 | return (static_cast<u32>(attr) - static_cast<u32>(IR::Attribute::FixedFncTexture0S)) / 4; | ||
| 43 | } | ||
| 40 | } // Anonymous namespace | 44 | } // Anonymous namespace |
| 41 | 45 | ||
| 42 | void EmitGetCbufU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) { | 46 | void EmitGetCbufU8(EmitContext& ctx, IR::Inst& inst, const IR::Value& binding, ScalarU32 offset) { |
| @@ -76,6 +80,11 @@ void EmitGetAttribute(EmitContext& ctx, IR::Inst& inst, IR::Attribute attr, Scal | |||
| 76 | ctx.Add("MOV.F {}.x,in_attr{}{}[0].{};", inst, index, VertexIndex(ctx, vertex), swizzle); | 80 | ctx.Add("MOV.F {}.x,in_attr{}{}[0].{};", inst, index, VertexIndex(ctx, vertex), swizzle); |
| 77 | return; | 81 | return; |
| 78 | } | 82 | } |
| 83 | if (attr >= IR::Attribute::FixedFncTexture0S && attr <= IR::Attribute::FixedFncTexture9Q) { | ||
| 84 | const u32 index{TexCoordIndex(attr)}; | ||
| 85 | ctx.Add("MOV.F {}.x,{}.texcoord[{}].{};", inst, ctx.attrib_name, index, swizzle); | ||
| 86 | return; | ||
| 87 | } | ||
| 79 | switch (attr) { | 88 | switch (attr) { |
| 80 | case IR::Attribute::PrimitiveId: | 89 | case IR::Attribute::PrimitiveId: |
| 81 | ctx.Add("MOV.S {}.x,primitive.id;", inst); | 90 | ctx.Add("MOV.S {}.x,primitive.id;", inst); |
| @@ -128,8 +137,7 @@ void EmitSetAttribute(EmitContext& ctx, IR::Attribute attr, ScalarF32 value, | |||
| 128 | return; | 137 | return; |
| 129 | } | 138 | } |
| 130 | if (attr >= IR::Attribute::FixedFncTexture0S && attr <= IR::Attribute::FixedFncTexture9R) { | 139 | if (attr >= IR::Attribute::FixedFncTexture0S && attr <= IR::Attribute::FixedFncTexture9R) { |
| 131 | const u32 index{ | 140 | const u32 index{TexCoordIndex(attr)}; |
| 132 | (static_cast<u32>(attr) - static_cast<u32>(IR::Attribute::FixedFncTexture0S)) / 4}; | ||
| 133 | ctx.Add("MOV.F result.texcoord[{}].{},{};", index, swizzle, value); | 141 | ctx.Add("MOV.F result.texcoord[{}].{},{};", index, swizzle, value); |
| 134 | return; | 142 | return; |
| 135 | } | 143 | } |