Produce tint::ast::Module in the frontend if UseTintGenerator

This factors code to move parsing of tint::ast::Module to the
frontend. All backends will use this code path when
UseTintGenerator is enabled for both SPIR-V and WGSL ingestion.

To avoid too much code explosion, parsing and validating the
shader is moved into ValidateShaderModuleDescriptor which
returns a result struct that gets passed into creation.

Bug: dawn:571
Change-Id: I598693ef36954fd0056a0744a2a0ebd7cc7d40a4
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/32301
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Austin Eng
2020-12-07 18:12:13 +00:00
committed by Commit Bot service account
parent 224a3a4ab5
commit 0d948f7752
23 changed files with 388 additions and 251 deletions

View File

@@ -127,9 +127,10 @@ namespace dawn_native { namespace null {
return new Sampler(this, descriptor);
}
ResultOrError<ShaderModuleBase*> Device::CreateShaderModuleImpl(
const ShaderModuleDescriptor* descriptor) {
const ShaderModuleDescriptor* descriptor,
ShaderModuleParseResult* parseResult) {
Ref<ShaderModule> module = AcquireRef(new ShaderModule(this, descriptor));
DAWN_TRY(module->Initialize());
DAWN_TRY(module->Initialize(parseResult));
return module.Detach();
}
ResultOrError<SwapChainBase*> Device::CreateSwapChainImpl(
@@ -395,8 +396,8 @@ namespace dawn_native { namespace null {
// ShaderModule
MaybeError ShaderModule::Initialize() {
return InitializeBase();
MaybeError ShaderModule::Initialize(ShaderModuleParseResult* parseResult) {
return InitializeBase(parseResult);
}
// OldSwapChain

View File

@@ -135,7 +135,8 @@ namespace dawn_native { namespace null {
const RenderPipelineDescriptor* descriptor) override;
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
ResultOrError<ShaderModuleBase*> CreateShaderModuleImpl(
const ShaderModuleDescriptor* descriptor) override;
const ShaderModuleDescriptor* descriptor,
ShaderModuleParseResult* parseResult) override;
ResultOrError<SwapChainBase*> CreateSwapChainImpl(
const SwapChainDescriptor* descriptor) override;
ResultOrError<NewSwapChainBase*> CreateSwapChainImpl(
@@ -246,7 +247,7 @@ namespace dawn_native { namespace null {
public:
using ShaderModuleBase::ShaderModuleBase;
MaybeError Initialize();
MaybeError Initialize(ShaderModuleParseResult* parseResult);
};
class SwapChain final : public NewSwapChainBase {