diff options
Diffstat (limited to 'src/shader_recompiler/backend/spirv')
4 files changed, 20 insertions, 0 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_context.cpp b/src/shader_recompiler/backend/spirv/emit_context.cpp index 5cd505d99..c8ce58254 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.cpp +++ b/src/shader_recompiler/backend/spirv/emit_context.cpp | |||
| @@ -182,6 +182,7 @@ void EmitContext::DefineCommonConstants() { | |||
| 182 | true_value = ConstantTrue(U1); | 182 | true_value = ConstantTrue(U1); |
| 183 | false_value = ConstantFalse(U1); | 183 | false_value = ConstantFalse(U1); |
| 184 | u32_zero_value = Constant(U32[1], 0U); | 184 | u32_zero_value = Constant(U32[1], 0U); |
| 185 | f32_zero_value = Constant(F32[1], 0.0f); | ||
| 185 | } | 186 | } |
| 186 | 187 | ||
| 187 | void EmitContext::DefineInterfaces(const Info& info) { | 188 | void EmitContext::DefineInterfaces(const Info& info) { |
diff --git a/src/shader_recompiler/backend/spirv/emit_context.h b/src/shader_recompiler/backend/spirv/emit_context.h index 071e66c2a..3965869f0 100644 --- a/src/shader_recompiler/backend/spirv/emit_context.h +++ b/src/shader_recompiler/backend/spirv/emit_context.h | |||
| @@ -70,6 +70,7 @@ public: | |||
| 70 | Id true_value{}; | 70 | Id true_value{}; |
| 71 | Id false_value{}; | 71 | Id false_value{}; |
| 72 | Id u32_zero_value{}; | 72 | Id u32_zero_value{}; |
| 73 | Id f32_zero_value{}; | ||
| 73 | 74 | ||
| 74 | UniformDefinitions uniform_types; | 75 | UniformDefinitions uniform_types; |
| 75 | 76 | ||
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv.h b/src/shader_recompiler/backend/spirv/emit_spirv.h index 3d0c6f7ba..105c23745 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv.h +++ b/src/shader_recompiler/backend/spirv/emit_spirv.h | |||
| @@ -362,6 +362,7 @@ Id EmitBindlessImageGather(EmitContext&); | |||
| 362 | Id EmitBindlessImageGatherDref(EmitContext&); | 362 | Id EmitBindlessImageGatherDref(EmitContext&); |
| 363 | Id EmitBindlessImageFetch(EmitContext&); | 363 | Id EmitBindlessImageFetch(EmitContext&); |
| 364 | Id EmitBindlessImageQueryDimensions(EmitContext&); | 364 | Id EmitBindlessImageQueryDimensions(EmitContext&); |
| 365 | Id EmitBindlessImageQueryLod(EmitContext&); | ||
| 365 | Id EmitBoundImageSampleImplicitLod(EmitContext&); | 366 | Id EmitBoundImageSampleImplicitLod(EmitContext&); |
| 366 | Id EmitBoundImageSampleExplicitLod(EmitContext&); | 367 | Id EmitBoundImageSampleExplicitLod(EmitContext&); |
| 367 | Id EmitBoundImageSampleDrefImplicitLod(EmitContext&); | 368 | Id EmitBoundImageSampleDrefImplicitLod(EmitContext&); |
| @@ -370,6 +371,7 @@ Id EmitBoundImageGather(EmitContext&); | |||
| 370 | Id EmitBoundImageGatherDref(EmitContext&); | 371 | Id EmitBoundImageGatherDref(EmitContext&); |
| 371 | Id EmitBoundImageFetch(EmitContext&); | 372 | Id EmitBoundImageFetch(EmitContext&); |
| 372 | Id EmitBoundImageQueryDimensions(EmitContext&); | 373 | Id EmitBoundImageQueryDimensions(EmitContext&); |
| 374 | Id EmitBoundImageQueryLod(EmitContext&); | ||
| 373 | Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, | 375 | Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, |
| 374 | Id bias_lc, Id offset); | 376 | Id bias_lc, Id offset); |
| 375 | Id EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, | 377 | Id EmitImageSampleExplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, |
| @@ -385,6 +387,7 @@ Id EmitImageGatherDref(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, | |||
| 385 | Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset, | 387 | Id EmitImageFetch(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id offset, |
| 386 | Id lod, Id ms); | 388 | Id lod, Id ms); |
| 387 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod); | 389 | Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id lod); |
| 390 | Id EmitImageQueryLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords); | ||
| 388 | Id EmitVoteAll(EmitContext& ctx, Id pred); | 391 | Id EmitVoteAll(EmitContext& ctx, Id pred); |
| 389 | Id EmitVoteAny(EmitContext& ctx, Id pred); | 392 | Id EmitVoteAny(EmitContext& ctx, Id pred); |
| 390 | Id EmitVoteEqual(EmitContext& ctx, Id pred); | 393 | Id EmitVoteEqual(EmitContext& ctx, Id pred); |
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp index 310cc7af7..2cd6b38c4 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | |||
| @@ -161,6 +161,10 @@ Id EmitBindlessImageQueryDimensions(EmitContext&) { | |||
| 161 | throw LogicError("Unreachable instruction"); | 161 | throw LogicError("Unreachable instruction"); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | Id EmitBindlessImageQueryLod(EmitContext&) { | ||
| 165 | throw LogicError("Unreachable instruction"); | ||
| 166 | } | ||
| 167 | |||
| 164 | Id EmitBoundImageSampleImplicitLod(EmitContext&) { | 168 | Id EmitBoundImageSampleImplicitLod(EmitContext&) { |
| 165 | throw LogicError("Unreachable instruction"); | 169 | throw LogicError("Unreachable instruction"); |
| 166 | } | 170 | } |
| @@ -193,6 +197,10 @@ Id EmitBoundImageQueryDimensions(EmitContext&) { | |||
| 193 | throw LogicError("Unreachable instruction"); | 197 | throw LogicError("Unreachable instruction"); |
| 194 | } | 198 | } |
| 195 | 199 | ||
| 200 | Id EmitBoundImageQueryLod(EmitContext&) { | ||
| 201 | throw LogicError("Unreachable instruction"); | ||
| 202 | } | ||
| 203 | |||
| 196 | Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, | 204 | Id EmitImageSampleImplicitLod(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, |
| 197 | Id bias_lc, Id offset) { | 205 | Id bias_lc, Id offset) { |
| 198 | const auto info{inst->Flags<IR::TextureInstInfo>()}; | 206 | const auto info{inst->Flags<IR::TextureInstInfo>()}; |
| @@ -287,4 +295,11 @@ Id EmitImageQueryDimensions(EmitContext& ctx, IR::Inst* inst, const IR::Value& i | |||
| 287 | throw LogicError("Unspecified image type {}", info.type.Value()); | 295 | throw LogicError("Unspecified image type {}", info.type.Value()); |
| 288 | } | 296 | } |
| 289 | 297 | ||
| 298 | Id EmitImageQueryLod(EmitContext& ctx, IR::Inst*, const IR::Value& index, Id coords) { | ||
| 299 | const Id zero{ctx.f32_zero_value}; | ||
| 300 | const Id image{TextureImage(ctx, index)}; | ||
| 301 | return ctx.OpCompositeConstruct(ctx.F32[4], ctx.OpImageQueryLod(ctx.F32[2], image, coords), | ||
| 302 | zero, zero); | ||
| 303 | } | ||
| 304 | |||
| 290 | } // namespace Shader::Backend::SPIRV | 305 | } // namespace Shader::Backend::SPIRV |