diff --git a/DEPS b/DEPS index 66aeaa0ab0..a8946c0026 100644 --- a/DEPS +++ b/DEPS @@ -90,7 +90,7 @@ deps = { # WGSL support 'third_party/tint': { - 'url': '{dawn_git}/tint@1995ddf876eff0fec462f91cbd5b3b9ecea112a3', + 'url': '{dawn_git}/tint@1980095da7f4325ab474166ab84ebe953afe80c3', 'condition': 'dawn_standalone', }, diff --git a/src/dawn_native/d3d12/ComputePipelineD3D12.cpp b/src/dawn_native/d3d12/ComputePipelineD3D12.cpp index dacc87af6f..68acce9e49 100644 --- a/src/dawn_native/d3d12/ComputePipelineD3D12.cpp +++ b/src/dawn_native/d3d12/ComputePipelineD3D12.cpp @@ -44,11 +44,14 @@ namespace dawn_native { namespace d3d12 { ShaderModule* module = ToBackend(descriptor->computeStage.module); const char* entryPoint = descriptor->computeStage.entryPoint; + std::string remappedEntryPoint; std::string hlslSource; if (device->IsToggleEnabled(Toggle::UseTintGenerator)) { - DAWN_TRY_ASSIGN(hlslSource, - module->TranslateToHLSLWithTint(entryPoint, SingleShaderStage::Compute, - ToBackend(GetLayout()))); + DAWN_TRY_ASSIGN(hlslSource, module->TranslateToHLSLWithTint( + entryPoint, SingleShaderStage::Compute, + ToBackend(GetLayout()), &remappedEntryPoint)); + entryPoint = remappedEntryPoint.c_str(); + } else { DAWN_TRY_ASSIGN(hlslSource, module->TranslateToHLSLWithSPIRVCross( diff --git a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp index 158a000fb2..5501308b56 100644 --- a/src/dawn_native/d3d12/RenderPipelineD3D12.cpp +++ b/src/dawn_native/d3d12/RenderPipelineD3D12.cpp @@ -313,10 +313,13 @@ namespace dawn_native { namespace d3d12 { for (auto stage : IterateStages(renderStages)) { std::string hlslSource; const char* entryPoint = GetStage(stage).entryPoint.c_str(); + std::string remappedEntryPoint; if (device->IsToggleEnabled(Toggle::UseTintGenerator)) { DAWN_TRY_ASSIGN(hlslSource, modules[stage]->TranslateToHLSLWithTint( - entryPoint, stage, ToBackend(GetLayout()))); + entryPoint, stage, ToBackend(GetLayout()), + &remappedEntryPoint)); + entryPoint = remappedEntryPoint.c_str(); } else { DAWN_TRY_ASSIGN(hlslSource, modules[stage]->TranslateToHLSLWithSPIRVCross( diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp index 36690887bc..36f75c5072 100644 --- a/src/dawn_native/d3d12/ShaderModuleD3D12.cpp +++ b/src/dawn_native/d3d12/ShaderModuleD3D12.cpp @@ -180,9 +180,11 @@ namespace dawn_native { namespace d3d12 { : ShaderModuleBase(device, descriptor) { } - ResultOrError ShaderModule::TranslateToHLSLWithTint(const char* entryPointName, - SingleShaderStage stage, - PipelineLayout* layout) const { + ResultOrError ShaderModule::TranslateToHLSLWithTint( + const char* entryPointName, + SingleShaderStage stage, + PipelineLayout* layout, + std::string* remappedEntryPointName) const { ASSERT(!IsError()); #ifdef DAWN_ENABLE_WGSL @@ -223,6 +225,10 @@ namespace dawn_native { namespace d3d12 { return DAWN_VALIDATION_ERROR(errorStream.str().c_str()); } + ASSERT(remappedEntryPointName != nullptr); + tint::inspector::Inspector inspector(module); + *remappedEntryPointName = inspector.GetRemappedNameForEntryPoint(entryPointName); + tint::writer::hlsl::Generator generator(std::move(module)); // TODO: Switch to GenerateEntryPoint once HLSL writer supports it. if (!generator.Generate()) { diff --git a/src/dawn_native/d3d12/ShaderModuleD3D12.h b/src/dawn_native/d3d12/ShaderModuleD3D12.h index dde759957d..4fc25321de 100644 --- a/src/dawn_native/d3d12/ShaderModuleD3D12.h +++ b/src/dawn_native/d3d12/ShaderModuleD3D12.h @@ -40,9 +40,11 @@ namespace dawn_native { namespace d3d12 { static ResultOrError Create(Device* device, const ShaderModuleDescriptor* descriptor); - ResultOrError TranslateToHLSLWithTint(const char* entryPointName, - SingleShaderStage stage, - PipelineLayout* layout) const; + ResultOrError TranslateToHLSLWithTint( + const char* entryPointName, + SingleShaderStage stage, + PipelineLayout* layout, + std::string* remappedEntryPointName) const; ResultOrError TranslateToHLSLWithSPIRVCross(const char* entryPointName, SingleShaderStage stage,