summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/ir
diff options
context:
space:
mode:
Diffstat (limited to 'src/shader_recompiler/frontend/ir')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp11
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h7
-rw-r--r--src/shader_recompiler/frontend/ir/modifiers.h12
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc6
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
1623Value 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
1628void 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
1623U1 IREmitter::VoteAll(const U1& value) { 1634U1 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));
43union TextureInstInfo { 43union 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};
52static_assert(sizeof(TextureInstInfo) <= sizeof(u32)); 54static_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,
389OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, ) 389OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, )
390OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) 390OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, )
391OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 391OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
392OPCODE(BindlessImageRead, U32x4, U32, Opaque, )
393OPCODE(BindlessImageWrite, Void, U32, Opaque, U32x4, )
392 394
393OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 395OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
394OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 396OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
@@ -400,6 +402,8 @@ OPCODE(BoundImageFetch, F32x4, U32,
400OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, ) 402OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, )
401OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) 403OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, )
402OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 404OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
405OPCODE(BoundImageRead, U32x4, U32, Opaque, )
406OPCODE(BoundImageWrite, Void, U32, Opaque, U32x4, )
403 407
404OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 408OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
405OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 409OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
@@ -411,6 +415,8 @@ OPCODE(ImageFetch, F32x4, U32,
411OPCODE(ImageQueryDimensions, U32x4, U32, U32, ) 415OPCODE(ImageQueryDimensions, U32x4, U32, U32, )
412OPCODE(ImageQueryLod, F32x4, U32, Opaque, ) 416OPCODE(ImageQueryLod, F32x4, U32, Opaque, )
413OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 417OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
418OPCODE(ImageRead, U32x4, U32, Opaque, )
419OPCODE(ImageWrite, Void, U32, Opaque, U32x4, )
414 420
415// Warp operations 421// Warp operations
416OPCODE(VoteAll, U1, U1, ) 422OPCODE(VoteAll, U1, U1, )