diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | 15 | ||||
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_memory.cpp | 8 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index c070fba0e..1a34fe9b3 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -46,7 +46,20 @@ void EmitImageSampleExplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unuse | |||
| 46 | [[maybe_unused]] std::string_view coords, | 46 | [[maybe_unused]] std::string_view coords, |
| 47 | [[maybe_unused]] std::string_view lod_lc, | 47 | [[maybe_unused]] std::string_view lod_lc, |
| 48 | [[maybe_unused]] const IR::Value& offset) { | 48 | [[maybe_unused]] const IR::Value& offset) { |
| 49 | throw NotImplementedException("GLSL Instruction"); | 49 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 50 | if (info.has_bias) { | ||
| 51 | throw NotImplementedException("Bias texture samples"); | ||
| 52 | } | ||
| 53 | if (info.has_lod_clamp) { | ||
| 54 | throw NotImplementedException("Lod clamp samples"); | ||
| 55 | } | ||
| 56 | const auto texture{Texture(ctx, info, index)}; | ||
| 57 | if (!offset.IsEmpty()) { | ||
| 58 | ctx.AddF32x4("{}=textureLodOffset({},{},{},ivec2({}));", inst, texture, coords, lod_lc, | ||
| 59 | ctx.reg_alloc.Consume(offset)); | ||
| 60 | } else { | ||
| 61 | ctx.AddF32x4("{}=textureLod({},{},{});", inst, texture, coords, lod_lc); | ||
| 62 | } | ||
| 50 | } | 63 | } |
| 51 | 64 | ||
| 52 | void EmitImageSampleDrefImplicitLod([[maybe_unused]] EmitContext& ctx, | 65 | void EmitImageSampleDrefImplicitLod([[maybe_unused]] EmitContext& ctx, |
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_memory.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_memory.cpp index 6168c4e06..708c9685b 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_memory.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_memory.cpp | |||
| @@ -81,13 +81,15 @@ void EmitWriteStorageS16([[maybe_unused]] EmitContext& ctx, | |||
| 81 | 81 | ||
| 82 | void EmitWriteStorage32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, | 82 | void EmitWriteStorage32(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, |
| 83 | std::string_view value) { | 83 | std::string_view value) { |
| 84 | ctx.Add("ssbo{}[{}]={};", binding.U32(), offset.U32(), value); | 84 | const auto offset_var{ctx.reg_alloc.Consume(offset)}; |
| 85 | ctx.Add("ssbo{}[{}]={};", binding.U32(), offset_var, value); | ||
| 85 | } | 86 | } |
| 86 | 87 | ||
| 87 | void EmitWriteStorage64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, | 88 | void EmitWriteStorage64(EmitContext& ctx, const IR::Value& binding, const IR::Value& offset, |
| 88 | std::string_view value) { | 89 | std::string_view value) { |
| 89 | ctx.Add("ssbo{}[{}]={}.x;", binding.U32(), offset.U32(), value); | 90 | const auto offset_var{ctx.reg_alloc.Consume(offset)}; |
| 90 | ctx.Add("ssbo{}[{}]={}.y;", binding.U32(), offset.U32() + 1, value); | 91 | ctx.Add("ssbo{}[{}]={}.x;", binding.U32(), offset_var, value); |
| 92 | ctx.Add("ssbo{}[{}+1]={}.y;", binding.U32(), offset_var, value); | ||
| 91 | } | 93 | } |
| 92 | 94 | ||
| 93 | void EmitWriteStorage128([[maybe_unused]] EmitContext& ctx, | 95 | void EmitWriteStorage128([[maybe_unused]] EmitContext& ctx, |