HLSL: allow destination swizzles when writing RWTexture/RWBuffer objects.
Reads and write syntax to UAV objects is turned into EOpImageLoad/Store operations. This translation did not support destination swizzles, for example, "mybuffer[tc].zyx = 3;", so such statements would fail to compile. Now they work. Parial updates are explicitly prohibited. New test: hlsl.rw.swizzle.frag
This commit is contained in:
parent
807a0d9e2f
commit
cd6829ba81
4 changed files with 381 additions and 4 deletions
28
Test/hlsl.rw.swizzle.frag
Normal file
28
Test/hlsl.rw.swizzle.frag
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
RWTexture2D<float3> rwtx;
|
||||
RWBuffer<float3> buf;
|
||||
|
||||
float3 SomeValue() { return float3(1,2,3); }
|
||||
|
||||
float4 main() : SV_Target0
|
||||
{
|
||||
int2 tc2 = { 0, 0 };
|
||||
int tc = 0;
|
||||
|
||||
// Test swizzles and partial updates of L-values when writing to buffers and writable textures.
|
||||
rwtx[tc2].zyx = float3(1,2,3); // full swizzle, simple RHS
|
||||
rwtx[tc2].zyx = SomeValue(); // full swizzle, complex RHS
|
||||
rwtx[tc2].zyx = 2; // full swizzle, modify op
|
||||
|
||||
// Partial updates not yet supported.
|
||||
// Partial values, which will use swizzles.
|
||||
// buf[tc].yz = 42; // partial swizzle, simple RHS
|
||||
// buf[tc].yz = SomeValue().x; // partial swizzle, complex RHS
|
||||
// buf[tc].yz += 43; // partial swizzle, modify op
|
||||
|
||||
// // Partial values, which will use index.
|
||||
// buf[tc].y = 44; // single index, simple RHS
|
||||
// buf[tc].y = SomeValue().x; // single index, complex RHS
|
||||
// buf[tc].y += 45; // single index, modify op
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue