Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set RaytracingTier1_1 based on subobjects; enable flag validation #6320

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions lib/DXIL/DxilModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,27 +288,6 @@ unsigned DxilModule::GetGlobalFlags() const {
return Flags;
}

static bool RequiresRaytracingTier1_1(const DxilSubobjects *pSubobjects) {
if (!pSubobjects)
return false;
for (const auto &it : pSubobjects->GetSubobjects()) {
switch (it.second->GetKind()) {
case DXIL::SubobjectKind::RaytracingPipelineConfig1:
return true;
case DXIL::SubobjectKind::StateObjectConfig: {
uint32_t configFlags;
if (it.second->GetStateObjectConfig(configFlags) &&
((configFlags &
(unsigned)DXIL::StateObjectFlags::AllowStateObjectAdditions) != 0))
return true;
} break;
default:
break;
}
}
return false;
}

void DxilModule::CollectShaderFlagsForModule(ShaderFlags &Flags) {
ComputeShaderCompatInfo();
for (auto &itInfo : m_FuncToShaderCompat)
Expand Down Expand Up @@ -380,10 +359,6 @@ void DxilModule::CollectShaderFlagsForModule(ShaderFlags &Flags) {
bool hasCSRawAndStructuredViaShader4X =
hasRawAndStructuredBuffer && m_pSM->GetMajor() == 4 && m_pSM->IsCS();
Flags.SetCSRawAndStructuredViaShader4X(hasCSRawAndStructuredViaShader4X);

if (!Flags.GetRaytracingTier1_1()) {
Flags.SetRaytracingTier1_1(RequiresRaytracingTier1_1(GetSubobjects()));
}
pow2clk marked this conversation as resolved.
Show resolved Hide resolved
}

void DxilModule::CollectShaderFlagsForModule() {
Expand Down
4 changes: 0 additions & 4 deletions lib/HLSL/DxilValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4448,10 +4448,6 @@ static void ValidateResources(ValidationContext &ValCtx) {
}

static void ValidateShaderFlags(ValidationContext &ValCtx) {
// TODO: validate flags foreach entry.
if (ValCtx.isLibProfile)
return;

ShaderFlags calcFlags;
ValCtx.DxilMod.CollectShaderFlagsForModule(calcFlags);
const uint64_t mask = ShaderFlags::GetShaderFlagsRawForCollection();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// RUN: %dxilver 1.5 | %dxc -T lib_6_3 %s | FileCheck %s

// RaytracingTier1_1 flag should not be set on the module based on subobjects.
// This is not even set for compatibility with validator 1.7 because that
// validator did not validate the flags.
// CHECK-NOT: Raytracing tier 1.1 features

// CHECK: ; GlobalRootSignature grs = { <48 bytes> };
// CHECK: ; StateObjectConfig soc = { STATE_OBJECT_FLAG_ALLOW_LOCAL_DEPENDENCIES_ON_EXTERNAL_DEFINITIONS | STATE_OBJECT_FLAG_ALLOW_STATE_OBJECT_ADDITIONS };
// CHECK: ; LocalRootSignature lrs = { <48 bytes> };
Expand Down Expand Up @@ -27,6 +32,7 @@ RaytracingPipelineConfig1 rpc2 = {32, RAYTRACING_PIPELINE_FLAG_NONE };
TriangleHitGroup trHitGt = {"a", "b"};
ProceduralPrimitiveHitGroup ppHitGt = { "a", "b", "c"};

int main(int i : INDEX) : SV_Target {
return 1;
}
// DXR entry point to ensure RDAT flags match during validation.
[shader("raygeneration")]
void main(void) {
}
Loading