diff options
| author | 2021-03-26 19:24:50 +0100 | |
|---|---|---|
| committer | 2021-07-22 21:51:24 -0400 | |
| commit | b5db38f50e9f81964bf0cc946e4ed5b00fe564d0 (patch) | |
| tree | fefc872d1da6481c8478e4da0381faaaad6f4b75 /src/shader_recompiler/frontend | |
| parent | shader: Implement TLD4.PTP (diff) | |
| download | yuzu-b5db38f50e9f81964bf0cc946e4ed5b00fe564d0.tar.gz yuzu-b5db38f50e9f81964bf0cc946e4ed5b00fe564d0.tar.xz yuzu-b5db38f50e9f81964bf0cc946e4ed5b00fe564d0.zip | |
shader: Add IR opcode for ImageFetch
Diffstat (limited to 'src/shader_recompiler/frontend')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 6 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 8 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.inc | 3 |
3 files changed, 15 insertions, 2 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index f49c30484..b8d36f362 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -1491,6 +1491,12 @@ Value IREmitter::ImageGatherDref(const Value& handle, const Value& coords, const | |||
| 1491 | return Inst(op, Flags{info}, handle, coords, offset, offset2, dref); | 1491 | return Inst(op, Flags{info}, handle, coords, offset, offset2, dref); |
| 1492 | } | 1492 | } |
| 1493 | 1493 | ||
| 1494 | Value IREmitter::ImageFetch(const Value& handle, const Value& coords, const Value& offset, | ||
| 1495 | const U32& lod, const U32& multisampling, TextureInstInfo info) { | ||
| 1496 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageFetch : Opcode::BindlessImageFetch}; | ||
| 1497 | return Inst(op, Flags{info}, handle, coords, offset, lod, multisampling); | ||
| 1498 | } | ||
| 1499 | |||
| 1494 | U1 IREmitter::VoteAll(const U1& value) { | 1500 | U1 IREmitter::VoteAll(const U1& value) { |
| 1495 | return Inst<U1>(Opcode::VoteAll, value); | 1501 | return Inst<U1>(Opcode::VoteAll, value); |
| 1496 | } | 1502 | } |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 04b43197f..446fd7785 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -243,8 +243,12 @@ public: | |||
| 243 | [[nodiscard]] Value ImageGather(const Value& handle, const Value& coords, const Value& offset, | 243 | [[nodiscard]] Value ImageGather(const Value& handle, const Value& coords, const Value& offset, |
| 244 | const Value& offset2, TextureInstInfo info); | 244 | const Value& offset2, TextureInstInfo info); |
| 245 | 245 | ||
| 246 | [[nodiscard]] Value ImageGatherDref(const Value& handle, const Value& coords, const Value& offset, | 246 | [[nodiscard]] Value ImageGatherDref(const Value& handle, const Value& coords, |
| 247 | const Value& offset2, const F32& dref, TextureInstInfo info); | 247 | const Value& offset, const Value& offset2, const F32& dref, |
| 248 | TextureInstInfo info); | ||
| 249 | |||
| 250 | [[nodiscard]] Value ImageFetch(const Value& handle, const Value& coords, const Value& offset, | ||
| 251 | const U32& lod, const U32& multisampling, TextureInstInfo info); | ||
| 248 | 252 | ||
| 249 | [[nodiscard]] U1 VoteAll(const U1& value); | 253 | [[nodiscard]] U1 VoteAll(const U1& value); |
| 250 | [[nodiscard]] U1 VoteAny(const U1& value); | 254 | [[nodiscard]] U1 VoteAny(const U1& value); |
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 0dc0aabdf..3dacd7b6b 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -356,6 +356,7 @@ OPCODE(BindlessImageSampleDrefImplicitLod, F32, U32, | |||
| 356 | OPCODE(BindlessImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) | 356 | OPCODE(BindlessImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) |
| 357 | OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) | 357 | OPCODE(BindlessImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 358 | OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) | 358 | OPCODE(BindlessImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) |
| 359 | OPCODE(BindlessImageFetch, F32x4, U32, Opaque, U32, U32, ) | ||
| 359 | 360 | ||
| 360 | OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 361 | OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 361 | OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 362 | OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| @@ -363,6 +364,7 @@ OPCODE(BoundImageSampleDrefImplicitLod, F32, U32, | |||
| 363 | OPCODE(BoundImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) | 364 | OPCODE(BoundImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) |
| 364 | OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) | 365 | OPCODE(BoundImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 365 | OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) | 366 | OPCODE(BoundImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) |
| 367 | OPCODE(BoundImageFetch, F32x4, U32, Opaque, U32, U32, ) | ||
| 366 | 368 | ||
| 367 | OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 369 | OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 368 | OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 370 | OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| @@ -370,6 +372,7 @@ OPCODE(ImageSampleDrefImplicitLod, F32, U32, | |||
| 370 | OPCODE(ImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) | 372 | OPCODE(ImageSampleDrefExplicitLod, F32, U32, Opaque, F32, Opaque, Opaque, ) |
| 371 | OPCODE(ImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) | 373 | OPCODE(ImageGather, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 372 | OPCODE(ImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) | 374 | OPCODE(ImageGatherDref, F32x4, U32, Opaque, Opaque, Opaque, F32, ) |
| 375 | OPCODE(ImageFetch, F32x4, U32, Opaque, U32, U32, ) | ||
| 373 | 376 | ||
| 374 | // Warp operations | 377 | // Warp operations |
| 375 | OPCODE(VoteAll, U1, U1, ) | 378 | OPCODE(VoteAll, U1, U1, ) |