Use remapped entry point name in D3D12
Tint may remap entry point names when translating a shader, so need to use the Inspector to get the remapped name for calling into DXC/FXC. Roll third_party/tint/ 1995ddf87..1980095da (1 commit) https://dawn.googlesource.com/tint/+log/1995ddf876ef..1980095da7f4 $ git log 1995ddf87..1980095da --date=short --no-merges --format='%ad %ae%s' 2020-11-12 rharrison [inspector] Convert GetRemapped to be a pass through Created with: roll-dep third_party/tint BUG=tint:273 Change-Id: I62cdd78334d4b3dacfdd7cf5668917622bc22ea2 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32540 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
parent
7ceffe8511
commit
2b4609bb02
2
DEPS
2
DEPS
|
@ -90,7 +90,7 @@ deps = {
|
||||||
|
|
||||||
# WGSL support
|
# WGSL support
|
||||||
'third_party/tint': {
|
'third_party/tint': {
|
||||||
'url': '{dawn_git}/tint@1995ddf876eff0fec462f91cbd5b3b9ecea112a3',
|
'url': '{dawn_git}/tint@1980095da7f4325ab474166ab84ebe953afe80c3',
|
||||||
'condition': 'dawn_standalone',
|
'condition': 'dawn_standalone',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -44,11 +44,14 @@ namespace dawn_native { namespace d3d12 {
|
||||||
ShaderModule* module = ToBackend(descriptor->computeStage.module);
|
ShaderModule* module = ToBackend(descriptor->computeStage.module);
|
||||||
|
|
||||||
const char* entryPoint = descriptor->computeStage.entryPoint;
|
const char* entryPoint = descriptor->computeStage.entryPoint;
|
||||||
|
std::string remappedEntryPoint;
|
||||||
std::string hlslSource;
|
std::string hlslSource;
|
||||||
if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
||||||
DAWN_TRY_ASSIGN(hlslSource,
|
DAWN_TRY_ASSIGN(hlslSource, module->TranslateToHLSLWithTint(
|
||||||
module->TranslateToHLSLWithTint(entryPoint, SingleShaderStage::Compute,
|
entryPoint, SingleShaderStage::Compute,
|
||||||
ToBackend(GetLayout())));
|
ToBackend(GetLayout()), &remappedEntryPoint));
|
||||||
|
entryPoint = remappedEntryPoint.c_str();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DAWN_TRY_ASSIGN(hlslSource,
|
DAWN_TRY_ASSIGN(hlslSource,
|
||||||
module->TranslateToHLSLWithSPIRVCross(
|
module->TranslateToHLSLWithSPIRVCross(
|
||||||
|
|
|
@ -313,10 +313,13 @@ namespace dawn_native { namespace d3d12 {
|
||||||
for (auto stage : IterateStages(renderStages)) {
|
for (auto stage : IterateStages(renderStages)) {
|
||||||
std::string hlslSource;
|
std::string hlslSource;
|
||||||
const char* entryPoint = GetStage(stage).entryPoint.c_str();
|
const char* entryPoint = GetStage(stage).entryPoint.c_str();
|
||||||
|
std::string remappedEntryPoint;
|
||||||
|
|
||||||
if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
if (device->IsToggleEnabled(Toggle::UseTintGenerator)) {
|
||||||
DAWN_TRY_ASSIGN(hlslSource, modules[stage]->TranslateToHLSLWithTint(
|
DAWN_TRY_ASSIGN(hlslSource, modules[stage]->TranslateToHLSLWithTint(
|
||||||
entryPoint, stage, ToBackend(GetLayout())));
|
entryPoint, stage, ToBackend(GetLayout()),
|
||||||
|
&remappedEntryPoint));
|
||||||
|
entryPoint = remappedEntryPoint.c_str();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DAWN_TRY_ASSIGN(hlslSource, modules[stage]->TranslateToHLSLWithSPIRVCross(
|
DAWN_TRY_ASSIGN(hlslSource, modules[stage]->TranslateToHLSLWithSPIRVCross(
|
||||||
|
|
|
@ -180,9 +180,11 @@ namespace dawn_native { namespace d3d12 {
|
||||||
: ShaderModuleBase(device, descriptor) {
|
: ShaderModuleBase(device, descriptor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<std::string> ShaderModule::TranslateToHLSLWithTint(const char* entryPointName,
|
ResultOrError<std::string> ShaderModule::TranslateToHLSLWithTint(
|
||||||
|
const char* entryPointName,
|
||||||
SingleShaderStage stage,
|
SingleShaderStage stage,
|
||||||
PipelineLayout* layout) const {
|
PipelineLayout* layout,
|
||||||
|
std::string* remappedEntryPointName) const {
|
||||||
ASSERT(!IsError());
|
ASSERT(!IsError());
|
||||||
|
|
||||||
#ifdef DAWN_ENABLE_WGSL
|
#ifdef DAWN_ENABLE_WGSL
|
||||||
|
@ -223,6 +225,10 @@ namespace dawn_native { namespace d3d12 {
|
||||||
return DAWN_VALIDATION_ERROR(errorStream.str().c_str());
|
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));
|
tint::writer::hlsl::Generator generator(std::move(module));
|
||||||
// TODO: Switch to GenerateEntryPoint once HLSL writer supports it.
|
// TODO: Switch to GenerateEntryPoint once HLSL writer supports it.
|
||||||
if (!generator.Generate()) {
|
if (!generator.Generate()) {
|
||||||
|
|
|
@ -40,9 +40,11 @@ namespace dawn_native { namespace d3d12 {
|
||||||
static ResultOrError<ShaderModule*> Create(Device* device,
|
static ResultOrError<ShaderModule*> Create(Device* device,
|
||||||
const ShaderModuleDescriptor* descriptor);
|
const ShaderModuleDescriptor* descriptor);
|
||||||
|
|
||||||
ResultOrError<std::string> TranslateToHLSLWithTint(const char* entryPointName,
|
ResultOrError<std::string> TranslateToHLSLWithTint(
|
||||||
|
const char* entryPointName,
|
||||||
SingleShaderStage stage,
|
SingleShaderStage stage,
|
||||||
PipelineLayout* layout) const;
|
PipelineLayout* layout,
|
||||||
|
std::string* remappedEntryPointName) const;
|
||||||
|
|
||||||
ResultOrError<std::string> TranslateToHLSLWithSPIRVCross(const char* entryPointName,
|
ResultOrError<std::string> TranslateToHLSLWithSPIRVCross(const char* entryPointName,
|
||||||
SingleShaderStage stage,
|
SingleShaderStage stage,
|
||||||
|
|
Loading…
Reference in New Issue