summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend
diff options
context:
space:
mode:
authorGravatar FernandoS272021-03-29 02:00:43 +0200
committerGravatar ameerj2021-07-22 21:51:25 -0400
commitd5bfc630886d98ed77959a9771c67293244aff0e (patch)
tree5816db6c236f9884c8900dd8a2c1e7ba9936b757 /src/shader_recompiler/frontend
parentshader: Implement TMML partially (diff)
downloadyuzu-d5bfc630886d98ed77959a9771c67293244aff0e.tar.gz
yuzu-d5bfc630886d98ed77959a9771c67293244aff0e.tar.xz
yuzu-d5bfc630886d98ed77959a9771c67293244aff0e.zip
shader: Implement ImageGradient
Diffstat (limited to 'src/shader_recompiler/frontend')
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.cpp7
-rw-r--r--src/shader_recompiler/frontend/ir/ir_emitter.h4
-rw-r--r--src/shader_recompiler/frontend/ir/modifiers.h1
-rw-r--r--src/shader_recompiler/frontend/ir/opcodes.inc3
4 files changed, 15 insertions, 0 deletions
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.cpp b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
index f6818ec8a..edf8c05d4 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.cpp
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.cpp
@@ -1573,6 +1573,13 @@ Value IREmitter::ImageQueryLod(const Value& handle, const Value& coords, Texture
1573 return Inst(op, Flags{info}, handle, coords); 1573 return Inst(op, Flags{info}, handle, coords);
1574} 1574}
1575 1575
1576Value IREmitter::ImageGradient(const Value& handle, const Value& coords, const Value& derivates,
1577 const Value& offset, const F32& lod_clamp, TextureInstInfo info) {
1578 const Opcode op{handle.IsImmediate() ? Opcode::BoundImageGradient
1579 : Opcode::BindlessImageGradient};
1580 return Inst(op, Flags{info}, handle, coords, derivates, offset, lod_clamp);
1581}
1582
1576U1 IREmitter::VoteAll(const U1& value) { 1583U1 IREmitter::VoteAll(const U1& value) {
1577 return Inst<U1>(Opcode::VoteAll, value); 1584 return Inst<U1>(Opcode::VoteAll, value);
1578} 1585}
diff --git a/src/shader_recompiler/frontend/ir/ir_emitter.h b/src/shader_recompiler/frontend/ir/ir_emitter.h
index 2beeace8f..a4616e247 100644
--- a/src/shader_recompiler/frontend/ir/ir_emitter.h
+++ b/src/shader_recompiler/frontend/ir/ir_emitter.h
@@ -268,6 +268,10 @@ public:
268 [[nodiscard]] Value ImageFetch(const Value& handle, const Value& coords, const Value& offset, 268 [[nodiscard]] Value ImageFetch(const Value& handle, const Value& coords, const Value& offset,
269 const U32& lod, const U32& multisampling, TextureInstInfo info); 269 const U32& lod, const U32& multisampling, TextureInstInfo info);
270 270
271 [[nodiscard]] Value ImageGradient(const Value& handle, const Value& coords,
272 const Value& derivates, const Value& offset,
273 const F32& lod_clamp, TextureInstInfo info);
274
271 [[nodiscard]] U1 VoteAll(const U1& value); 275 [[nodiscard]] U1 VoteAll(const U1& value);
272 [[nodiscard]] U1 VoteAny(const U1& value); 276 [[nodiscard]] U1 VoteAny(const U1& value);
273 [[nodiscard]] U1 VoteEqual(const U1& value); 277 [[nodiscard]] U1 VoteEqual(const U1& value);
diff --git a/src/shader_recompiler/frontend/ir/modifiers.h b/src/shader_recompiler/frontend/ir/modifiers.h
index 4f09a4b39..90078f535 100644
--- a/src/shader_recompiler/frontend/ir/modifiers.h
+++ b/src/shader_recompiler/frontend/ir/modifiers.h
@@ -39,6 +39,7 @@ union TextureInstInfo {
39 BitField<9, 1, u32> has_lod_clamp; 39 BitField<9, 1, u32> has_lod_clamp;
40 BitField<10, 1, u32> relaxed_precision; 40 BitField<10, 1, u32> relaxed_precision;
41 BitField<11, 2, u32> gather_component; 41 BitField<11, 2, u32> gather_component;
42 BitField<13, 2, u32> num_derivates;
42}; 43};
43static_assert(sizeof(TextureInstInfo) <= sizeof(u32)); 44static_assert(sizeof(TextureInstInfo) <= sizeof(u32));
44 45
diff --git a/src/shader_recompiler/frontend/ir/opcodes.inc b/src/shader_recompiler/frontend/ir/opcodes.inc
index 49cdcd57f..79baacd08 100644
--- a/src/shader_recompiler/frontend/ir/opcodes.inc
+++ b/src/shader_recompiler/frontend/ir/opcodes.inc
@@ -381,6 +381,7 @@ OPCODE(BindlessImageGatherDref, F32x4, U32,
381OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 381OPCODE(BindlessImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
382OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, ) 382OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, )
383OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, ) 383OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, )
384OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
384 385
385OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 386OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
386OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 387OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
@@ -391,6 +392,7 @@ OPCODE(BoundImageGatherDref, F32x4, U32,
391OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 392OPCODE(BoundImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
392OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, ) 393OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, )
393OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, ) 394OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, )
395OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
394 396
395OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 397OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
396OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, ) 398OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
@@ -401,6 +403,7 @@ OPCODE(ImageGatherDref, F32x4, U32,
401OPCODE(ImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, ) 403OPCODE(ImageFetch, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
402OPCODE(ImageQueryDimensions, U32x4, U32, U32, ) 404OPCODE(ImageQueryDimensions, U32x4, U32, U32, )
403OPCODE(ImageQueryLod, F32x4, U32, Opaque, ) 405OPCODE(ImageQueryLod, F32x4, U32, Opaque, )
406OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, F32, )
404 407
405// Warp operations 408// Warp operations
406OPCODE(VoteAll, U1, U1, ) 409OPCODE(VoteAll, U1, U1, )