Skip to content

Commit 356c4b7

Browse files
author
joaosaffran
committed
adding samplers
1 parent 4d34b01 commit 356c4b7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

llvm/lib/Target/DirectX/DXILPostOptimizationValidation.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "llvm/IR/IntrinsicsDirectX.h"
2323
#include "llvm/IR/Module.h"
2424
#include "llvm/InitializePasses.h"
25+
#include "llvm/Support/DXILABI.h"
2526

2627
#define DEBUG_TYPE "dxil-post-optimization-validation"
2728

@@ -376,6 +377,17 @@ static bool reportOverlappingRanges(Module &M,
376377
}
377378
}
378379

380+
for (const dxbc::RTS0::v1::StaticSampler &Sampler : RSD.StaticSamplers) {
381+
RangeInfo Info;
382+
Info.Space = Sampler.RegisterSpace;
383+
Info.LowerBound = Sampler.ShaderRegister;
384+
Info.UpperBound = Info.LowerBound;
385+
Info.Class = ResourceClass::Sampler;
386+
Info.Visibility = (dxbc::ShaderVisibility)Sampler.ShaderVisibility;
387+
388+
Infos.push_back(Info);
389+
}
390+
379391
llvm::SmallVector<OverlappingRanges> Overlaps =
380392
llvm::hlsl::rootsig::findOverlappingRanges(Infos);
381393
for (OverlappingRanges Overlap : Overlaps)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s
2+
; CHECK: error: register Sampler (space=0, register=42) is overlapping with register Sampler (space=0, register=42), verify your root signature definition.
3+
4+
define void @CSMain() "hlsl.shader"="compute" {
5+
entry:
6+
ret void
7+
}
8+
9+
; RootConstants(num32BitConstants=4, b2), DescriptorTable(CBV(b0, numDescriptors=3))
10+
!dx.rootsignatures = !{!0}
11+
!0 = !{ptr @CSMain, !1, i32 2}
12+
!1 = !{!2, !3}
13+
!2 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }
14+
!3 = !{ !"StaticSampler", i32 4, i32 2, i32 3, i32 5, float 0x3FF6CCCCC0000000, i32 9, i32 3, i32 2, float -1.280000e+02, float 1.280000e+02, i32 42, i32 0, i32 0 }

0 commit comments

Comments
 (0)