summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_image.cpp')
-rw-r--r--src/shader_recompiler/backend/glsl/emit_glsl_image.cpp24
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
12namespace Shader::Backend::GLSL { 13namespace Shader::Backend::GLSL {
14namespace {
15std::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
14void EmitImageSampleImplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 25void 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
22void EmitImageSampleExplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst, 44void EmitImageSampleExplicitLod([[maybe_unused]] EmitContext& ctx, [[maybe_unused]] IR::Inst& inst,