diff options
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.cpp | 11 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/ir_emitter.h | 7 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/modifiers.h | 12 | ||||
| -rw-r--r-- | src/shader_recompiler/frontend/ir/opcodes.inc | 6 |
4 files changed, 27 insertions, 9 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp index a2104bdb3..17be0c639 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp +++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp | |||
| @@ -1620,6 +1620,17 @@ Value IREmitter::ImageGradient(const Value& handle, const Value& coords, const V | |||
| 1620 | return Inst(op, Flags{info}, handle, coords, derivates, offset, lod_clamp); | 1620 | return Inst(op, Flags{info}, handle, coords, derivates, offset, lod_clamp); |
| 1621 | } | 1621 | } |
| 1622 | 1622 | ||
| 1623 | Value IREmitter::ImageRead(const Value& handle, const Value& coords, TextureInstInfo info) { | ||
| 1624 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageRead : Opcode::BindlessImageRead}; | ||
| 1625 | return Inst(op, Flags{info}, handle, coords); | ||
| 1626 | } | ||
| 1627 | |||
| 1628 | void IREmitter::ImageWrite(const Value& handle, const Value& coords, const Value& color, | ||
| 1629 | TextureInstInfo info) { | ||
| 1630 | const Opcode op{handle.IsImmediate() ? Opcode::BoundImageWrite : Opcode::BindlessImageWrite}; | ||
| 1631 | Inst(op, Flags{info}, handle, coords, color); | ||
| 1632 | } | ||
| 1633 | |||
| 1623 | U1 IREmitter::VoteAll(const U1& value) { | 1634 | U1 IREmitter::VoteAll(const U1& value) { |
| 1624 | return Inst<U1>(Opcode::VoteAll, value); | 1635 | return Inst<U1>(Opcode::VoteAll, value); |
| 1625 | } | 1636 | } |
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h index 2cab1dc5d..ec60070ef 100644 --- a/src/shader_recompiler/frontend/ir/ir_emitter.h +++ b/src/shader_recompiler/frontend/ir/ir_emitter.h | |||
| @@ -265,20 +265,19 @@ public: | |||
| 265 | 265 | ||
| 266 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, | 266 | [[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords, |
| 267 | TextureInstInfo info); | 267 | TextureInstInfo info); |
| 268 | |||
| 269 | [[nodiscard]] Value ImageGather(const Value& handle, const Value& coords, const Value& offset, | 268 | [[nodiscard]] Value ImageGather(const Value& handle, const Value& coords, const Value& offset, |
| 270 | const Value& offset2, TextureInstInfo info); | 269 | const Value& offset2, TextureInstInfo info); |
| 271 | |||
| 272 | [[nodiscard]] Value ImageGatherDref(const Value& handle, const Value& coords, | 270 | [[nodiscard]] Value ImageGatherDref(const Value& handle, const Value& coords, |
| 273 | const Value& offset, const Value& offset2, const F32& dref, | 271 | const Value& offset, const Value& offset2, const F32& dref, |
| 274 | TextureInstInfo info); | 272 | TextureInstInfo info); |
| 275 | |||
| 276 | [[nodiscard]] Value ImageFetch(const Value& handle, const Value& coords, const Value& offset, | 273 | [[nodiscard]] Value ImageFetch(const Value& handle, const Value& coords, const Value& offset, |
| 277 | const U32& lod, const U32& multisampling, TextureInstInfo info); | 274 | const U32& lod, const U32& multisampling, TextureInstInfo info); |
| 278 | |||
| 279 | [[nodiscard]] Value ImageGradient(const Value& handle, const Value& coords, | 275 | [[nodiscard]] Value ImageGradient(const Value& handle, const Value& coords, |
| 280 | const Value& derivates, const Value& offset, | 276 | const Value& derivates, const Value& offset, |
| 281 | const F32& lod_clamp, TextureInstInfo info); | 277 | const F32& lod_clamp, TextureInstInfo info); |
| 278 | [[nodiscard]] Value ImageRead(const Value& handle, const Value& coords, TextureInstInfo info); | ||
| 279 | [[nodiscard]] void ImageWrite(const Value& handle, const Value& coords, const Value& color, | ||
| 280 | TextureInstInfo info); | ||
| 282 | 281 | ||
| 283 | [[nodiscard]] U1 VoteAll(const U1& value); | 282 | [[nodiscard]] U1 VoteAll(const U1& value); |
| 284 | [[nodiscard]] U1 VoteAny(const U1& value); | 283 | [[nodiscard]] U1 VoteAny(const U1& value); |
diff --git a/src/shader_recompiler/frontend/ir/modifiers.h b/src/shader_recompiler/frontend/ir/modifiers.h index 461671326..447e9703c 100644 --- a/src/shader_recompiler/frontend/ir/modifiers.h +++ b/src/shader_recompiler/frontend/ir/modifiers.h | |||
| @@ -43,11 +43,13 @@ static_assert(sizeof(FpControl) <= sizeof(u32)); | |||
| 43 | union TextureInstInfo { | 43 | union TextureInstInfo { |
| 44 | u32 raw; | 44 | u32 raw; |
| 45 | BitField<0, 8, TextureType> type; | 45 | BitField<0, 8, TextureType> type; |
| 46 | BitField<8, 1, u32> has_bias; | 46 | BitField<8, 1, u32> is_depth; |
| 47 | BitField<9, 1, u32> has_lod_clamp; | 47 | BitField<9, 1, u32> has_bias; |
| 48 | BitField<10, 1, u32> relaxed_precision; | 48 | BitField<10, 1, u32> has_lod_clamp; |
| 49 | BitField<11, 2, u32> gather_component; | 49 | BitField<11, 1, u32> relaxed_precision; |
| 50 | BitField<13, 2, u32> num_derivates; | 50 | BitField<12, 2, u32> gather_component; |
| 51 | BitField<14, 2, u32> num_derivates; | ||
| 52 | BitField<16, 3, ImageFormat> image_format; | ||
| 51 | }; | 53 | }; |
| 52 | static_assert(sizeof(TextureInstInfo) <= sizeof(u32)); | 54 | static_assert(sizeof(TextureInstInfo) <= sizeof(u32)); |
| 53 | 55 | ||
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc index 1697de965..82c5b37ba 100644 --- a/src/shader_recompiler/frontend/ir/opcodes.inc +++ b/src/shader_recompiler/frontend/ir/opcodes.inc | |||
| @@ -389,6 +389,8 @@ OPCODE(BindlessImageFetch, F32x4, U32, | |||
| 389 | OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, ) | 389 | OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, ) |
| 390 | OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) | 390 | OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) |
| 391 | OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) | 391 | OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) |
| 392 | OPCODE(BindlessImageRead, U32x4, U32, Opaque, ) | ||
| 393 | OPCODE(BindlessImageWrite, Void, U32, Opaque, U32x4, ) | ||
| 392 | 394 | ||
| 393 | OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 395 | OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 394 | OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 396 | OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| @@ -400,6 +402,8 @@ OPCODE(BoundImageFetch, F32x4, U32, | |||
| 400 | OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, ) | 402 | OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, ) |
| 401 | OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) | 403 | OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) |
| 402 | OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) | 404 | OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) |
| 405 | OPCODE(BoundImageRead, U32x4, U32, Opaque, ) | ||
| 406 | OPCODE(BoundImageWrite, Void, U32, Opaque, U32x4, ) | ||
| 403 | 407 | ||
| 404 | OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 408 | OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| 405 | OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) | 409 | OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) |
| @@ -411,6 +415,8 @@ OPCODE(ImageFetch, F32x4, U32, | |||
| 411 | OPCODE(ImageQueryDimensions, U32x4, U32, U32, ) | 415 | OPCODE(ImageQueryDimensions, U32x4, U32, U32, ) |
| 412 | OPCODE(ImageQueryLod, F32x4, U32, Opaque, ) | 416 | OPCODE(ImageQueryLod, F32x4, U32, Opaque, ) |
| 413 | OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) | 417 | OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) |
| 418 | OPCODE(ImageRead, U32x4, U32, Opaque, ) | ||
| 419 | OPCODE(ImageWrite, Void, U32, Opaque, U32x4, ) | ||
| 414 | 420 | ||
| 415 | // Warp operations | 421 | // Warp operations |
| 416 | OPCODE(VoteAll, U1, U1, ) | 422 | OPCODE(VoteAll, U1, U1, ) |