[clang] [HLSL] Implement Texture2D::mips[][] (PR #186143)

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 07:08:14 PDT 2026


================
@@ -5132,7 +5132,45 @@ void SemaHLSL::handleGlobalStructOrArrayOfWithResources(VarDecl *VD) {
   }
 }
 
+bool SemaHLSL::CheckForMipsIntermediateType(QualType T, SourceLocation Loc) {
----------------
Keenuts wrote:

Seems like there is a way to go around this and fail with a crash:

```hlsl
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-pixel -x hlsl -emit-llvm -O3 -finclude-default-header -o - %s | llvm-cxxfilt | FileCheck %s --check-prefixes=CHECK,DXIL

Texture2D<float4> t;

template<typename T>
float4 foo(T t) {
  return t[int2(0, 0)];
}

[shader("pixel")]
float4 test_mips() : SV_Target {
  return t.mips[0][int2(0, 0)] + foo(t.mips[0]);
}
```

https://github.com/llvm/llvm-project/pull/186143


More information about the cfe-commits mailing list