Ver código fonte

By-ref indexer for RWStructuredBuffer.

Eric Mellino 8 anos atrás
pai
commit
b679eaeb77

+ 2 - 4
src/ShaderGen.Primitives/RWStructuredBuffer.cs

@@ -2,16 +2,14 @@
 {
     public class RWStructuredBuffer<T> where T : struct
     {
-        public T this[int index]
+        public ref T this[int index]
         {
             get => throw new ShaderBuiltinException();
-            set => throw new ShaderBuiltinException();
         }
 
-        public T this[uint index]
+        public ref T this[uint index]
         {
             get => throw new ShaderBuiltinException();
-            set => throw new ShaderBuiltinException();
         }
     }
 }

+ 1 - 0
src/ShaderGen.Tests/TestAssets/SimpleCompute.cs

@@ -13,6 +13,7 @@ namespace TestShaders
         public void CS()
         {
             StructuredInOut[DispatchThreadID.X] = StructuredInput[DispatchThreadID.Y];
+            StructuredInOut[DispatchThreadID.Y].Z = 1;
         }
     }
 }