diff options
Diffstat (limited to 'src/shader_recompiler/backend/glsl/emit_glsl_image.cpp')
| -rw-r--r-- | src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp index d8874b0cc..4be2c25ec 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_image.cpp | |||
| @@ -460,27 +460,27 @@ void EmitImageFetch(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | |||
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, | 462 | void EmitImageQueryDimensions(EmitContext& ctx, IR::Inst& inst, const IR::Value& index, |
| 463 | std::string_view lod) { | 463 | std::string_view lod, const IR::Value& skip_mips_val) { |
| 464 | const auto info{inst.Flags<IR::TextureInstInfo>()}; | 464 | const auto info{inst.Flags<IR::TextureInstInfo>()}; |
| 465 | const auto texture{Texture(ctx, info, index)}; | 465 | const auto texture{Texture(ctx, info, index)}; |
| 466 | const bool skip_mips{skip_mips_val.U1()}; | ||
| 467 | const auto mips{ | ||
| 468 | [&] { return skip_mips ? "0u" : fmt::format("uint(textureQueryLevels({}))", texture); }}; | ||
| 466 | switch (info.type) { | 469 | switch (info.type) { |
| 467 | case TextureType::Color1D: | 470 | case TextureType::Color1D: |
| 468 | return ctx.AddU32x4( | 471 | return ctx.AddU32x4("{}=uvec4(uint(textureSize({},int({}))),0u,0u,{});", inst, texture, lod, |
| 469 | "{}=uvec4(uint(textureSize({},int({}))),0u,0u,uint(textureQueryLevels({})));", inst, | 472 | mips()); |
| 470 | texture, lod, texture); | ||
| 471 | case TextureType::ColorArray1D: | 473 | case TextureType::ColorArray1D: |
| 472 | case TextureType::Color2D: | 474 | case TextureType::Color2D: |
| 473 | case TextureType::ColorCube: | 475 | case TextureType::ColorCube: |
| 474 | case TextureType::Color2DRect: | 476 | case TextureType::Color2DRect: |
| 475 | return ctx.AddU32x4( | 477 | return ctx.AddU32x4("{}=uvec4(uvec2(textureSize({},int({}))),0u,{});", inst, texture, lod, |
| 476 | "{}=uvec4(uvec2(textureSize({},int({}))),0u,uint(textureQueryLevels({})));", inst, | 478 | mips()); |
| 477 | texture, lod, texture); | ||
| 478 | case TextureType::ColorArray2D: | 479 | case TextureType::ColorArray2D: |
| 479 | case TextureType::Color3D: | 480 | case TextureType::Color3D: |
| 480 | case TextureType::ColorArrayCube: | 481 | case TextureType::ColorArrayCube: |
| 481 | return ctx.AddU32x4( | 482 | return ctx.AddU32x4("{}=uvec4(uvec3(textureSize({},int({}))),{});", inst, texture, lod, |
| 482 | "{}=uvec4(uvec3(textureSize({},int({}))),uint(textureQueryLevels({})));", inst, texture, | 483 | mips()); |
| 483 | lod, texture); | ||
| 484 | case TextureType::Buffer: | 484 | case TextureType::Buffer: |
| 485 | throw NotImplementedException("EmitImageQueryDimensions Texture buffers"); | 485 | throw NotImplementedException("EmitImageQueryDimensions Texture buffers"); |
| 486 | } | 486 | } |