shader: Implement SULD and SUST

This commit is contained in:
ReinUsesLisp 2021-04-09 01:45:39 -03:00 committed by ameerj
parent 094da34456
commit 7cb2ab3585
31 changed files with 739 additions and 209 deletions

View file

@ -1620,6 +1620,17 @@ Value IREmitter::ImageGradient(const Value& handle, const Value& coords, const V
return Inst(op, Flags{info}, handle, coords, derivates, offset, lod_clamp);
}
Value IREmitter::ImageRead(const Value& handle, const Value& coords, TextureInstInfo info) {
const Opcode op{handle.IsImmediate() ? Opcode::BoundImageRead : Opcode::BindlessImageRead};
return Inst(op, Flags{info}, handle, coords);
}
void IREmitter::ImageWrite(const Value& handle, const Value& coords, const Value& color,
TextureInstInfo info) {
const Opcode op{handle.IsImmediate() ? Opcode::BoundImageWrite : Opcode::BindlessImageWrite};
Inst(op, Flags{info}, handle, coords, color);
}
U1 IREmitter::VoteAll(const U1& value) {
return Inst<U1>(Opcode::VoteAll, value);
}

View file

@ -265,20 +265,19 @@ public:
[[nodiscard]] Value ImageQueryLod(const Value& handle, const Value& coords,
TextureInstInfo info);
[[nodiscard]] Value ImageGather(const Value& handle, const Value& coords, const Value& offset,
const Value& offset2, TextureInstInfo info);
[[nodiscard]] Value ImageGatherDref(const Value& handle, const Value& coords,
const Value& offset, const Value& offset2, const F32& dref,
TextureInstInfo info);
[[nodiscard]] Value ImageFetch(const Value& handle, const Value& coords, const Value& offset,
const U32& lod, const U32& multisampling, TextureInstInfo info);
[[nodiscard]] Value ImageGradient(const Value& handle, const Value& coords,
const Value& derivates, const Value& offset,
const F32& lod_clamp, TextureInstInfo info);
[[nodiscard]] Value ImageRead(const Value& handle, const Value& coords, TextureInstInfo info);
[[nodiscard]] void ImageWrite(const Value& handle, const Value& coords, const Value& color,
TextureInstInfo info);
[[nodiscard]] U1 VoteAll(const U1& value);
[[nodiscard]] U1 VoteAny(const U1& value);

View file

@ -43,11 +43,13 @@ static_assert(sizeof(FpControl) <= sizeof(u32));
union TextureInstInfo {
u32 raw;
BitField<0, 8, TextureType> type;
BitField<8, 1, u32> has_bias;
BitField<9, 1, u32> has_lod_clamp;
BitField<10, 1, u32> relaxed_precision;
BitField<11, 2, u32> gather_component;
BitField<13, 2, u32> num_derivates;
BitField<8, 1, u32> is_depth;
BitField<9, 1, u32> has_bias;
BitField<10, 1, u32> has_lod_clamp;
BitField<11, 1, u32> relaxed_precision;
BitField<12, 2, u32> gather_component;
BitField<14, 2, u32> num_derivates;
BitField<16, 3, ImageFormat> image_format;
};
static_assert(sizeof(TextureInstInfo) <= sizeof(u32));

View file

@ -389,6 +389,8 @@ OPCODE(BindlessImageFetch, F32x4, U32,
OPCODE(BindlessImageQueryDimensions, U32x4, U32, U32, )
OPCODE(BindlessImageQueryLod, F32x4, U32, Opaque, )
OPCODE(BindlessImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
OPCODE(BindlessImageRead, U32x4, U32, Opaque, )
OPCODE(BindlessImageWrite, Void, U32, Opaque, U32x4, )
OPCODE(BoundImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
OPCODE(BoundImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
@ -400,6 +402,8 @@ OPCODE(BoundImageFetch, F32x4, U32,
OPCODE(BoundImageQueryDimensions, U32x4, U32, U32, )
OPCODE(BoundImageQueryLod, F32x4, U32, Opaque, )
OPCODE(BoundImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
OPCODE(BoundImageRead, U32x4, U32, Opaque, )
OPCODE(BoundImageWrite, Void, U32, Opaque, U32x4, )
OPCODE(ImageSampleImplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
OPCODE(ImageSampleExplicitLod, F32x4, U32, Opaque, Opaque, Opaque, )
@ -411,6 +415,8 @@ OPCODE(ImageFetch, F32x4, U32,
OPCODE(ImageQueryDimensions, U32x4, U32, U32, )
OPCODE(ImageQueryLod, F32x4, U32, Opaque, )
OPCODE(ImageGradient, F32x4, U32, Opaque, Opaque, Opaque, Opaque, )
OPCODE(ImageRead, U32x4, U32, Opaque, )
OPCODE(ImageWrite, Void, U32, Opaque, U32x4, )
// Warp operations
OPCODE(VoteAll, U1, U1, )