diff options
Diffstat (limited to 'src/shader_recompiler/backend/glasm/emit_glasm_image.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp index 7f2cf052a..c395248ed 100644 --- a/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp +++ b/src/shader_recompiler/backend/glasm/emit_glasm_image.cpp | |||
| @@ -120,7 +120,10 @@ void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu | |||
| 120 | const std::string_view lod_clamp_mod{info.has_lod_clamp ? ".LODCLAMP" : ""}; | 120 | const std::string_view lod_clamp_mod{info.has_lod_clamp ? ".LODCLAMP" : ""}; |
| 121 | const std::string_view type{"2D"}; // FIXME | 121 | const std::string_view type{"2D"}; // FIXME |
| 122 | const std::string texture{Texture(ctx, info, index)}; | 122 | const std::string texture{Texture(ctx, info, index)}; |
| 123 | 123 | std::string offset_vec; | |
| 124 | if (!offset.IsEmpty()) { | ||
| 125 | offset_vec = fmt::format(",offset({})", Register{ctx.reg_alloc.Consume(offset)}); | ||
| 126 | } | ||
| 124 | std::string coord_vec{fmt::to_string(Register{ctx.reg_alloc.Consume(coord)})}; | 127 | std::string coord_vec{fmt::to_string(Register{ctx.reg_alloc.Consume(coord)})}; |
| 125 | if (coord.InstRecursive()->HasUses()) { | 128 | if (coord.InstRecursive()->HasUses()) { |
| 126 | // Move non-dead coords to a separate register, although this should never happen because | 129 | // Move non-dead coords to a separate register, although this should never happen because |
| @@ -131,26 +134,27 @@ void EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst& inst, const IR::Valu | |||
| 131 | const Register ret{ctx.reg_alloc.Define(inst)}; | 134 | const Register ret{ctx.reg_alloc.Define(inst)}; |
| 132 | if (info.has_bias) { | 135 | if (info.has_bias) { |
| 133 | if (info.type == TextureType::ColorArrayCube) { | 136 | if (info.type == TextureType::ColorArrayCube) { |
| 134 | ctx.Add("TXB.F{}{} {},{},{},{},ARRAYCUBE;", lod_clamp_mod, sparse_mod, ret, coord_vec, | 137 | ctx.Add("TXB.F{}{} {},{},{},{},ARRAYCUBE{};", lod_clamp_mod, sparse_mod, ret, coord_vec, |
| 135 | bias_lc, texture); | 138 | bias_lc, texture, offset_vec); |
| 136 | } else { | 139 | } else { |
| 137 | if (info.has_lod_clamp) { | 140 | if (info.has_lod_clamp) { |
| 138 | ctx.Add("MOV.F {}.w,{}.x;" | 141 | ctx.Add("MOV.F {}.w,{}.x;" |
| 139 | "TXB.F.LODCLAMP{} {},{},{}.y,{},{};", | 142 | "TXB.F.LODCLAMP{} {},{},{}.y,{},{}{};", |
| 140 | coord_vec, bias_lc, sparse_mod, ret, coord_vec, bias_lc, texture, type); | 143 | coord_vec, bias_lc, sparse_mod, ret, coord_vec, bias_lc, texture, type, |
| 144 | offset_vec); | ||
| 141 | } else { | 145 | } else { |
| 142 | ctx.Add("MOV.F {}.w,{}.x;" | 146 | ctx.Add("MOV.F {}.w,{}.x;" |
| 143 | "TXB.F{} {},{},{},{};", | 147 | "TXB.F{} {},{},{},{}{};", |
| 144 | coord_vec, bias_lc, sparse_mod, ret, coord_vec, texture, type); | 148 | coord_vec, bias_lc, sparse_mod, ret, coord_vec, texture, type, offset_vec); |
| 145 | } | 149 | } |
| 146 | } | 150 | } |
| 147 | } else { | 151 | } else { |
| 148 | if (info.has_lod_clamp && info.type == TextureType::ColorArrayCube) { | 152 | if (info.has_lod_clamp && info.type == TextureType::ColorArrayCube) { |
| 149 | ctx.Add("TEX.F.LODCLAMP{} {},{},{},{},ARRAYCUBE;", sparse_mod, ret, coord_vec, bias_lc, | 153 | ctx.Add("TEX.F.LODCLAMP{} {},{},{},{},ARRAYCUBE{};", sparse_mod, ret, coord_vec, |
| 150 | texture); | 154 | bias_lc, texture, offset_vec); |
| 151 | } else { | 155 | } else { |
| 152 | ctx.Add("TEX.F{}{} {},{},{},{};", lod_clamp_mod, sparse_mod, ret, coord_vec, texture, | 156 | ctx.Add("TEX.F{}{} {},{},{},{}{};", lod_clamp_mod, sparse_mod, ret, coord_vec, texture, |
| 153 | type); | 157 | type, offset_vec); |
| 154 | } | 158 | } |
| 155 | } | 159 | } |
| 156 | if (sparse_inst) { | 160 | if (sparse_inst) { |