diff options
| author | 2021-05-26 21:18:17 -0400 | |
|---|---|---|
| committer | 2021-07-22 21:51:36 -0400 | |
| commit | d171083d53e106c8c5131522fdc81d51360c562d (patch) | |
| tree | 282cbd1306616e969166e9ddc926bc51c1c15803 /src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |
| parent | glsl: Implement some attribute getters and setters (diff) | |
| download | yuzu-d171083d53e106c8c5131522fdc81d51360c562d.tar.gz yuzu-d171083d53e106c8c5131522fdc81d51360c562d.tar.xz yuzu-d171083d53e106c8c5131522fdc81d51360c562d.zip | |
glsl: textures wip
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_image.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index 109938e0e..cc5afc048 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -6,17 +6,39 @@ | |||
| 6 | 6 | ||
| 7 | #include "shader_recompiler/backend/glsl/emit_context.h" | 7 | #include "shader_recompiler/backend/glsl/emit_context.h" |
| 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" | 8 | #include "shader_recompiler/backend/glsl/emit_glsl_instructions.h" |
| 9 | #include "shader_recompiler/frontend/ir/modifiers.h" | ||
| 9 | #include "shader_recompiler/frontend/ir/value.h" | 10 | #include "shader_recompiler/frontend/ir/value.h" |
| 10 | #include "shader_recompiler/profile.h" | 11 | #include "shader_recompiler/profile.h" |
| 11 | 12 | ||
| 12 | namespace Shader::Backend::GLSL { | 13 | namespace Shader::Backend::GLSL { |
| 14 | namespace { | ||
| 15 | std::string Texture(EmitContext& ctx, IR::TextureInstInfo info, | ||
| 16 | [[maybe_unused]] const IR::Value& index) { | ||
| 17 | if (info.type == TextureType::Buffer) { | ||
| 18 | throw NotImplementedException("TextureType::Buffer"); | ||
| 19 | } else { | ||
| 20 | return fmt::format("tex{}", ctx.texture_bindings.at(info.descriptor_index)); | ||
| 21 | } | ||
| 22 | } | ||
| 23 | } // namespace | ||
| 13 | 24 | ||
| 14 | void EmitImageSampleImplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 25 | void EmitImageSampleImplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |
| 15 | [[maybe_unused]] const IR::Value& index, | 26 | [[maybe_unused]] const IR::Value& index, |
| 16 | [[maybe_unused]] std::string_view coords, | 27 | [[maybe_unused]] std::string_view coords, |
| 17 | [[maybe_unused]] std::string_view bias_lc, | 28 | [[maybe_unused]] std::string_view bias_lc, |
| 18 | [[maybe_unused]] const IR::Value& offset) { | 29 | [[maybe_unused]] const IR::Value& offset) { |
| 19 | throw NotImplementedException("GLSL Instruction"); | 30 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 31 | if (info.has_bias) { | ||
| 32 | throw NotImplementedException("Bias texture samples"); | ||
| 33 | } | ||
| 34 | if (info.has_lod_clamp) { | ||
| 35 | throw NotImplementedException("Lod clamp samples"); | ||
| 36 | } | ||
| 37 | if (!offset.IsEmpty()) { | ||
| 38 | throw NotImplementedException("Offset"); | ||
| 39 | } | ||
| 40 | const auto texture{Texture(ctx, info, index)}; | ||
| 41 | ctx.AddF32x4("{}=texture({},{});", inst, texture, coords); | ||
| 20 | } | 42 | } |
| 21 | 43 | ||
| 22 | void EmitImageSampleExplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, | 44 | void EmitImageSampleExplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, |