Przeglądaj źródła

Support globallycoherent on uav array. (#2460)

Xiang Li 6 lat temu
rodzic
commit
70809e1bcb

+ 1 - 0
tools/clang/lib/Sema/SemaHLSL.cpp

@@ -11666,6 +11666,7 @@ bool Sema::DiagnoseHLSLDecl(Declarator &D, DeclContext *DC, Expr *BitWidth,
     if (hlsl::IsObjectType(this, eltQt, &bDeprecatedEffectObject)) {
     if (hlsl::IsObjectType(this, eltQt, &bDeprecatedEffectObject)) {
       // Add methods if not ready.
       // Add methods if not ready.
       hlslSource->AddHLSLObjectMethodsIfNotReady(eltQt);
       hlslSource->AddHLSLObjectMethodsIfNotReady(eltQt);
+      bIsObject = true;
     }
     }
   }
   }
 
 

+ 10 - 0
tools/clang/test/HLSLFileCheck/hlsl/types/modifiers/globallycoherent/globallycoherent4.hlsl

@@ -0,0 +1,10 @@
+// RUN: %dxc -E main -T ps_6_0 %s | FileCheck %s
+
+// Make sure uav array can has globallycoherent.
+// CHECK:i32 12, i32 2, i1 true
+
+globallycoherent RWTexture2D<float> tex[12] : register(u1);
+
+float main(float2 c:C) : SV_Target {
+  return tex[0][c];
+}