From 36afbb6a0dfd8575a22ca31e2932c437f5b44cf9 Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Wed, 25 Jul 2018 17:03:23 +0200 Subject: [PATCH] Make dawn_native use its own header for Dawn datatypes The dawn.h and dawncpp.h structure definitions references dawnFoo or dawn::Foo respectively when it should reference dawn_native::FooBase* in dawn_native. Autogenerate files to declare the dawn_native version of the structs and change the ProcTable generation to use it instead. This is important to make libdawn_native a shared library because currently it was depending on dawncpp's definition of .Get(). --- generator/main.py | 2 + generator/templates/dawn_native/ProcTable.cpp | 8 ++-- .../templates/dawn_native/api_structs.cpp | 37 +++++++++++++++ generator/templates/dawn_native/api_structs.h | 45 +++++++++++++++++++ src/dawn_native/BindGroup.h | 2 +- src/dawn_native/BindGroupLayout.cpp | 7 ++- src/dawn_native/BindGroupLayout.h | 6 +-- src/dawn_native/BlendState.h | 2 +- src/dawn_native/Buffer.h | 2 +- src/dawn_native/Builder.h | 2 +- src/dawn_native/CMakeLists.txt | 10 ++--- src/dawn_native/CommandBuffer.h | 2 +- src/dawn_native/Commands.h | 2 +- src/dawn_native/DepthStencilState.h | 2 +- src/dawn_native/Device.cpp | 14 +++--- src/dawn_native/Device.h | 24 +++++----- src/dawn_native/InputState.h | 2 +- src/dawn_native/PassResourceUsage.h | 2 +- src/dawn_native/PerStage.h | 2 +- src/dawn_native/Pipeline.cpp | 2 +- src/dawn_native/Pipeline.h | 2 +- src/dawn_native/PipelineLayout.cpp | 9 ++-- src/dawn_native/PipelineLayout.h | 6 +-- src/dawn_native/Queue.h | 2 +- src/dawn_native/RenderPassDescriptor.h | 2 +- src/dawn_native/RenderPipeline.h | 2 +- src/dawn_native/Sampler.cpp | 4 +- src/dawn_native/Sampler.h | 7 ++- src/dawn_native/ShaderModule.h | 2 +- src/dawn_native/SwapChain.h | 2 +- src/dawn_native/Texture.h | 2 +- .../d3d12/BindGroupLayoutD3D12.cpp | 3 +- src/dawn_native/d3d12/BindGroupLayoutD3D12.h | 2 +- src/dawn_native/d3d12/DeviceD3D12.cpp | 7 ++- src/dawn_native/d3d12/DeviceD3D12.h | 9 ++-- .../d3d12/NativeSwapChainImplD3D12.h | 2 +- src/dawn_native/d3d12/PipelineLayoutD3D12.cpp | 2 +- src/dawn_native/d3d12/PipelineLayoutD3D12.h | 2 +- src/dawn_native/d3d12/SamplerD3D12.cpp | 2 +- src/dawn_native/d3d12/SamplerD3D12.h | 2 +- src/dawn_native/d3d12/TextureCopySplitter.h | 2 +- src/dawn_native/dawn_platform.h | 25 +++++++++++ src/dawn_native/metal/DeviceMTL.h | 9 ++-- src/dawn_native/metal/DeviceMTL.mm | 7 ++- src/dawn_native/metal/PipelineLayoutMTL.h | 2 +- src/dawn_native/metal/PipelineLayoutMTL.mm | 2 +- src/dawn_native/metal/SamplerMTL.h | 2 +- src/dawn_native/metal/SamplerMTL.mm | 2 +- src/dawn_native/null/NullBackend.cpp | 7 ++- src/dawn_native/null/NullBackend.h | 9 ++-- src/dawn_native/opengl/DeviceGL.cpp | 7 ++- src/dawn_native/opengl/DeviceGL.h | 9 ++-- .../opengl/PersistentPipelineStateGL.h | 2 +- src/dawn_native/opengl/PipelineLayoutGL.cpp | 2 +- src/dawn_native/opengl/PipelineLayoutGL.h | 2 +- src/dawn_native/opengl/SamplerGL.cpp | 2 +- src/dawn_native/opengl/SamplerGL.h | 2 +- src/dawn_native/vulkan/BindGroupLayoutVk.cpp | 3 +- src/dawn_native/vulkan/BindGroupLayoutVk.h | 2 +- src/dawn_native/vulkan/DeviceVk.cpp | 7 ++- src/dawn_native/vulkan/DeviceVk.h | 9 ++-- .../vulkan/NativeSwapChainImplVk.h | 2 +- src/dawn_native/vulkan/PipelineLayoutVk.cpp | 2 +- src/dawn_native/vulkan/PipelineLayoutVk.h | 2 +- src/dawn_native/vulkan/RenderPassCache.h | 2 +- src/dawn_native/vulkan/SamplerVk.cpp | 2 +- src/dawn_native/vulkan/SamplerVk.h | 2 +- 67 files changed, 231 insertions(+), 141 deletions(-) create mode 100644 generator/templates/dawn_native/api_structs.cpp create mode 100644 generator/templates/dawn_native/api_structs.h create mode 100644 src/dawn_native/dawn_platform.h diff --git a/generator/main.py b/generator/main.py index 60d3571773..6202cbc622 100644 --- a/generator/main.py +++ b/generator/main.py @@ -479,6 +479,8 @@ def main(): if 'dawn_native_utils' in targets: renders.append(FileRender('dawn_native/ValidationUtils.h', 'dawn_native/ValidationUtils_autogen.h', base_backend_params)) renders.append(FileRender('dawn_native/ValidationUtils.cpp', 'dawn_native/ValidationUtils_autogen.cpp', base_backend_params)) + renders.append(FileRender('dawn_native/api_structs.h', 'dawn_native/dawn_structs_autogen.h', base_backend_params)) + renders.append(FileRender('dawn_native/api_structs.cpp', 'dawn_native/dawn_structs_autogen.cpp', base_backend_params)) if 'wire' in targets: renders.append(FileRender('wire/WireCmd.h', 'wire/WireCmd_autogen.h', base_backend_params)) diff --git a/generator/templates/dawn_native/ProcTable.cpp b/generator/templates/dawn_native/ProcTable.cpp index 69899e41bb..f8b102b201 100644 --- a/generator/templates/dawn_native/ProcTable.cpp +++ b/generator/templates/dawn_native/ProcTable.cpp @@ -12,11 +12,9 @@ //* See the License for the specific language governing permissions and //* limitations under the License. -#include "dawn/dawn.h" -#include "dawn/dawncpp.h" - #include "common/Assert.h" +#include "dawn_native/dawn_platform.h" #include "dawn_native/ErrorData.h" #include "dawn_native/ValidationUtils_autogen.h" #include "dawn_native/{{namespace}}/GeneratedCodeIncludes.h" @@ -51,7 +49,7 @@ namespace {{namespace}} { {%- if arg.type.category in ["enum", "bitmask"] -%} static_cast({{as_varName(arg.name)}}) {%- elif arg.type.category == "structure" and arg.annotation != "value" -%} - reinterpret_cast({{as_varName(arg.name)}}) + reinterpret_cast({{as_varName(arg.name)}}) {%- else -%} {{as_varName(arg.name)}} {%- endif -%} @@ -169,7 +167,7 @@ namespace {{namespace}} { {%- if arg.type.category in ["enum", "bitmask"] -%} static_cast({{as_varName(arg.name)}}) {%- elif arg.type.category == "structure" and arg.annotation != "value" -%} - reinterpret_cast({{as_varName(arg.name)}}) + reinterpret_cast({{as_varName(arg.name)}}) {%- else -%} {{as_varName(arg.name)}} {%- endif -%} diff --git a/generator/templates/dawn_native/api_structs.cpp b/generator/templates/dawn_native/api_structs.cpp new file mode 100644 index 0000000000..2956830c32 --- /dev/null +++ b/generator/templates/dawn_native/api_structs.cpp @@ -0,0 +1,37 @@ +//* Copyright 2018 The Dawn Authors +//* +//* Licensed under the Apache License, Version 2.0 (the "License"); +//* you may not use this file except in compliance with the License. +//* You may obtain a copy of the License at +//* +//* http://www.apache.org/licenses/LICENSE-2.0 +//* +//* Unless required by applicable law or agreed to in writing, software +//* distributed under the License is distributed on an "AS IS" BASIS, +//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//* See the License for the specific language governing permissions and +//* limitations under the License. + +#include "dawn_native/dawn_structs_autogen.h" + +namespace dawn_native { + + {% for type in by_category["structure"] %} + {% set CppType = as_cppType(type.name) %} + {% set CType = as_cType(type.name) %} + + static_assert(sizeof({{CppType}}) == sizeof({{CType}}), "sizeof mismatch for {{CppType}}"); + static_assert(alignof({{CppType}}) == alignof({{CType}}), "alignof mismatch for {{CppType}}"); + + {% if type.extensible %} + static_assert(offsetof({{CppType}}, nextInChain) == offsetof({{CType}}, nextInChain), + "offsetof mismatch for {{CppType}}::nextInChain"); + {% endif %} + {% for member in type.members %} + {% set memberName = member.name.camelCase() %} + static_assert(offsetof({{CppType}}, {{memberName}}) == offsetof({{CType}}, {{memberName}}), + "offsetof mismatch for {{CppType}}::{{memberName}}"); + {% endfor %} + + {% endfor %} +} diff --git a/generator/templates/dawn_native/api_structs.h b/generator/templates/dawn_native/api_structs.h new file mode 100644 index 0000000000..e6213315cc --- /dev/null +++ b/generator/templates/dawn_native/api_structs.h @@ -0,0 +1,45 @@ +//* Copyright 2017 The Dawn Authors +//* +//* Licensed under the Apache License, Version 2.0 (the "License"); +//* you may not use this file except in compliance with the License. +//* You may obtain a copy of the License at +//* +//* http://www.apache.org/licenses/LICENSE-2.0 +//* +//* Unless required by applicable law or agreed to in writing, software +//* distributed under the License is distributed on an "AS IS" BASIS, +//* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//* See the License for the specific language governing permissions and +//* limitations under the License. + +#ifndef DAWNNATIVE_DAWN_STRUCTS_H_ +#define DAWNNATIVE_DAWN_STRUCTS_H_ + +#include "dawn/dawncpp.h" +#include "dawn_native/Forward.h" + +namespace dawn_native { + + {% for type in by_category["structure"] %} + struct {{as_cppType(type.name)}} { + {% if type.extensible %} + const void* nextInChain = nullptr; + {% endif %} + {% for member in type.members %} + {% if member.type.category == "object" %} + {{decorate(as_varName(member.name), as_cppType(member.type.name) + "Base*", member)}}; + {% elif member.type.category == "structure" %} + {{as_annotated_cppType(member)}}; + {% elif member.type.category in ["enum", "bitmask"] %} + {{decorate(as_varName(member.name), "dawn::" + as_cppType(member.type.name), member)}}; + {% else %} + {{as_annotated_cppType(member)}}; + {% endif %} + {% endfor %} + }; + + {% endfor %} + +} // namespace dawn_native + +#endif // DAWNNATIVE_DAWN_STRUCTS_H_ diff --git a/src/dawn_native/BindGroup.h b/src/dawn_native/BindGroup.h index 46c272eb97..3fbad9e3d8 100644 --- a/src/dawn_native/BindGroup.h +++ b/src/dawn_native/BindGroup.h @@ -21,7 +21,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include diff --git a/src/dawn_native/BindGroupLayout.cpp b/src/dawn_native/BindGroupLayout.cpp index 86f5dbae98..c02b300e77 100644 --- a/src/dawn_native/BindGroupLayout.cpp +++ b/src/dawn_native/BindGroupLayout.cpp @@ -23,9 +23,8 @@ namespace dawn_native { - MaybeError ValidateBindGroupLayoutDescriptor( - DeviceBase*, - const dawn::BindGroupLayoutDescriptor* descriptor) { + MaybeError ValidateBindGroupLayoutDescriptor(DeviceBase*, + const BindGroupLayoutDescriptor* descriptor) { DAWN_TRY_ASSERT(descriptor->nextInChain == nullptr, "nextInChain must be nullptr"); std::bitset bindingsSet; @@ -74,7 +73,7 @@ namespace dawn_native { // BindGroupLayoutBase BindGroupLayoutBase::BindGroupLayoutBase(DeviceBase* device, - const dawn::BindGroupLayoutDescriptor* descriptor, + const BindGroupLayoutDescriptor* descriptor, bool blueprint) : mDevice(device), mIsBlueprint(blueprint) { for (uint32_t i = 0; i < descriptor->numBindings; ++i) { diff --git a/src/dawn_native/BindGroupLayout.h b/src/dawn_native/BindGroupLayout.h index 8cdf4ffd9a..62cd8e3943 100644 --- a/src/dawn_native/BindGroupLayout.h +++ b/src/dawn_native/BindGroupLayout.h @@ -20,7 +20,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include @@ -28,12 +28,12 @@ namespace dawn_native { MaybeError ValidateBindGroupLayoutDescriptor(DeviceBase*, - const dawn::BindGroupLayoutDescriptor* descriptor); + const BindGroupLayoutDescriptor* descriptor); class BindGroupLayoutBase : public RefCounted { public: BindGroupLayoutBase(DeviceBase* device, - const dawn::BindGroupLayoutDescriptor* descriptor, + const BindGroupLayoutDescriptor* descriptor, bool blueprint = false); ~BindGroupLayoutBase() override; diff --git a/src/dawn_native/BlendState.h b/src/dawn_native/BlendState.h index 793a70dfa7..636dc2f6f5 100644 --- a/src/dawn_native/BlendState.h +++ b/src/dawn_native/BlendState.h @@ -19,7 +19,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { diff --git a/src/dawn_native/Buffer.h b/src/dawn_native/Buffer.h index 282dde6b11..df1695e49e 100644 --- a/src/dawn_native/Buffer.h +++ b/src/dawn_native/Buffer.h @@ -20,7 +20,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { diff --git a/src/dawn_native/Builder.h b/src/dawn_native/Builder.h index f8c7b85d22..3739a51692 100644 --- a/src/dawn_native/Builder.h +++ b/src/dawn_native/Builder.h @@ -18,7 +18,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include diff --git a/src/dawn_native/CMakeLists.txt b/src/dawn_native/CMakeLists.txt index 9aca791690..aa825252d2 100644 --- a/src/dawn_native/CMakeLists.txt +++ b/src/dawn_native/CMakeLists.txt @@ -28,7 +28,6 @@ Generate( ${GENERATOR_COMMON_ARGS} -T dawn_native_utils ) -target_link_libraries(dawn_native_utils_autogen) function(GenerateProcTable backend) Generate( @@ -327,6 +326,7 @@ endif() ################################################################################ list(APPEND DAWN_NATIVE_SOURCES + ${DAWN_NATIVE_DIR}/dawn_platform.h ${DAWN_NATIVE_DIR}/BindGroup.cpp ${DAWN_NATIVE_DIR}/BindGroup.h ${DAWN_NATIVE_DIR}/BindGroupLayout.cpp @@ -337,18 +337,18 @@ list(APPEND DAWN_NATIVE_SOURCES ${DAWN_NATIVE_DIR}/Builder.h ${DAWN_NATIVE_DIR}/Buffer.cpp ${DAWN_NATIVE_DIR}/Buffer.h + ${DAWN_NATIVE_DIR}/Commands.cpp + ${DAWN_NATIVE_DIR}/Commands.h ${DAWN_NATIVE_DIR}/CommandAllocator.cpp ${DAWN_NATIVE_DIR}/CommandAllocator.h ${DAWN_NATIVE_DIR}/CommandBuffer.cpp ${DAWN_NATIVE_DIR}/CommandBuffer.h - ${DAWN_NATIVE_DIR}/Commands.cpp - ${DAWN_NATIVE_DIR}/Commands.h ${DAWN_NATIVE_DIR}/ComputePipeline.cpp ${DAWN_NATIVE_DIR}/ComputePipeline.h - ${DAWN_NATIVE_DIR}/DepthStencilState.cpp - ${DAWN_NATIVE_DIR}/DepthStencilState.h ${DAWN_NATIVE_DIR}/CommandBufferStateTracker.cpp ${DAWN_NATIVE_DIR}/CommandBufferStateTracker.h + ${DAWN_NATIVE_DIR}/DepthStencilState.cpp + ${DAWN_NATIVE_DIR}/DepthStencilState.h ${DAWN_NATIVE_DIR}/Device.cpp ${DAWN_NATIVE_DIR}/Device.h ${DAWN_NATIVE_DIR}/Error.cpp diff --git a/src/dawn_native/CommandBuffer.h b/src/dawn_native/CommandBuffer.h index a378936ae4..d829ba0015 100644 --- a/src/dawn_native/CommandBuffer.h +++ b/src/dawn_native/CommandBuffer.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_COMMANDBUFFER_H_ #define DAWNNATIVE_COMMANDBUFFER_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include "dawn_native/Builder.h" #include "dawn_native/CommandAllocator.h" diff --git a/src/dawn_native/Commands.h b/src/dawn_native/Commands.h index a10ef3aa3f..e0a9558fd3 100644 --- a/src/dawn_native/Commands.h +++ b/src/dawn_native/Commands.h @@ -18,7 +18,7 @@ #include "dawn_native/RenderPassDescriptor.h" #include "dawn_native/Texture.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { diff --git a/src/dawn_native/DepthStencilState.h b/src/dawn_native/DepthStencilState.h index d795d5dd84..cf687ba143 100644 --- a/src/dawn_native/DepthStencilState.h +++ b/src/dawn_native/DepthStencilState.h @@ -19,7 +19,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { diff --git a/src/dawn_native/Device.cpp b/src/dawn_native/Device.cpp index b364f77657..a5da9fef84 100644 --- a/src/dawn_native/Device.cpp +++ b/src/dawn_native/Device.cpp @@ -74,7 +74,7 @@ namespace dawn_native { } ResultOrError DeviceBase::GetOrCreateBindGroupLayout( - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { BindGroupLayoutBase blueprint(this, descriptor, true); auto iter = mCaches->bindGroupLayouts.find(&blueprint); @@ -99,7 +99,7 @@ namespace dawn_native { return new BindGroupBuilder(this); } BindGroupLayoutBase* DeviceBase::CreateBindGroupLayout( - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { BindGroupLayoutBase* result = nullptr; if (ConsumedError(CreateBindGroupLayoutInternal(&result, descriptor))) { @@ -127,7 +127,7 @@ namespace dawn_native { return new InputStateBuilder(this); } PipelineLayoutBase* DeviceBase::CreatePipelineLayout( - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { PipelineLayoutBase* result = nullptr; if (ConsumedError(CreatePipelineLayoutInternal(&result, descriptor))) { @@ -151,7 +151,7 @@ namespace dawn_native { RenderPipelineBuilder* DeviceBase::CreateRenderPipelineBuilder() { return new RenderPipelineBuilder(this); } - SamplerBase* DeviceBase::CreateSampler(const dawn::SamplerDescriptor* descriptor) { + SamplerBase* DeviceBase::CreateSampler(const SamplerDescriptor* descriptor) { SamplerBase* result = nullptr; if (ConsumedError(CreateSamplerInternal(&result, descriptor))) { @@ -193,7 +193,7 @@ namespace dawn_native { MaybeError DeviceBase::CreateBindGroupLayoutInternal( BindGroupLayoutBase** result, - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { DAWN_TRY(ValidateBindGroupLayoutDescriptor(this, descriptor)); DAWN_TRY_ASSIGN(*result, GetOrCreateBindGroupLayout(descriptor)); return {}; @@ -201,7 +201,7 @@ namespace dawn_native { MaybeError DeviceBase::CreatePipelineLayoutInternal( PipelineLayoutBase** result, - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { DAWN_TRY(ValidatePipelineLayoutDescriptor(this, descriptor)); DAWN_TRY_ASSIGN(*result, CreatePipelineLayoutImpl(descriptor)); return {}; @@ -213,7 +213,7 @@ namespace dawn_native { } MaybeError DeviceBase::CreateSamplerInternal(SamplerBase** result, - const dawn::SamplerDescriptor* descriptor) { + const SamplerDescriptor* descriptor) { DAWN_TRY(ValidateSamplerDescriptor(this, descriptor)); DAWN_TRY_ASSIGN(*result, CreateSamplerImpl(descriptor)); return {}; diff --git a/src/dawn_native/Device.h b/src/dawn_native/Device.h index f10e378d70..fd154e7cdb 100644 --- a/src/dawn_native/Device.h +++ b/src/dawn_native/Device.h @@ -19,7 +19,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { @@ -77,24 +77,23 @@ namespace dawn_native { // instead of a backend Foo object. If the blueprint doesn't match an object in the // cache, then the builder is used to make a new object. ResultOrError GetOrCreateBindGroupLayout( - const dawn::BindGroupLayoutDescriptor* descriptor); + const BindGroupLayoutDescriptor* descriptor); void UncacheBindGroupLayout(BindGroupLayoutBase* obj); // Dawn API BindGroupBuilder* CreateBindGroupBuilder(); - BindGroupLayoutBase* CreateBindGroupLayout( - const dawn::BindGroupLayoutDescriptor* descriptor); + BindGroupLayoutBase* CreateBindGroupLayout(const BindGroupLayoutDescriptor* descriptor); BlendStateBuilder* CreateBlendStateBuilder(); BufferBuilder* CreateBufferBuilder(); CommandBufferBuilder* CreateCommandBufferBuilder(); ComputePipelineBuilder* CreateComputePipelineBuilder(); DepthStencilStateBuilder* CreateDepthStencilStateBuilder(); InputStateBuilder* CreateInputStateBuilder(); - PipelineLayoutBase* CreatePipelineLayout(const dawn::PipelineLayoutDescriptor* descriptor); + PipelineLayoutBase* CreatePipelineLayout(const PipelineLayoutDescriptor* descriptor); QueueBase* CreateQueue(); RenderPassDescriptorBuilder* CreateRenderPassDescriptorBuilder(); RenderPipelineBuilder* CreateRenderPipelineBuilder(); - SamplerBase* CreateSampler(const dawn::SamplerDescriptor* descriptor); + SamplerBase* CreateSampler(const SamplerDescriptor* descriptor); ShaderModuleBuilder* CreateShaderModuleBuilder(); SwapChainBuilder* CreateSwapChainBuilder(); TextureBuilder* CreateTextureBuilder(); @@ -106,20 +105,19 @@ namespace dawn_native { private: virtual ResultOrError CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) = 0; + const BindGroupLayoutDescriptor* descriptor) = 0; virtual ResultOrError CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) = 0; + const PipelineLayoutDescriptor* descriptor) = 0; virtual ResultOrError CreateQueueImpl() = 0; virtual ResultOrError CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) = 0; + const SamplerDescriptor* descriptor) = 0; MaybeError CreateBindGroupLayoutInternal(BindGroupLayoutBase** result, - const dawn::BindGroupLayoutDescriptor* descriptor); + const BindGroupLayoutDescriptor* descriptor); MaybeError CreatePipelineLayoutInternal(PipelineLayoutBase** result, - const dawn::PipelineLayoutDescriptor* descriptor); + const PipelineLayoutDescriptor* descriptor); MaybeError CreateQueueInternal(QueueBase** result); - MaybeError CreateSamplerInternal(SamplerBase** result, - const dawn::SamplerDescriptor* descriptor); + MaybeError CreateSamplerInternal(SamplerBase** result, const SamplerDescriptor* descriptor); void ConsumeError(ErrorData* error); diff --git a/src/dawn_native/InputState.h b/src/dawn_native/InputState.h index f3ed944574..9c4b0817f7 100644 --- a/src/dawn_native/InputState.h +++ b/src/dawn_native/InputState.h @@ -20,7 +20,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include diff --git a/src/dawn_native/PassResourceUsage.h b/src/dawn_native/PassResourceUsage.h index 1824b9d12b..5bae2e46f0 100644 --- a/src/dawn_native/PassResourceUsage.h +++ b/src/dawn_native/PassResourceUsage.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_PASSRESOURCEUSAGE_H #define DAWNNATIVE_PASSRESOURCEUSAGE_H -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include diff --git a/src/dawn_native/PerStage.h b/src/dawn_native/PerStage.h index e6a0b9d9a1..536127042f 100644 --- a/src/dawn_native/PerStage.h +++ b/src/dawn_native/PerStage.h @@ -19,7 +19,7 @@ #include "common/BitSetIterator.h" #include "common/Constants.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include diff --git a/src/dawn_native/Pipeline.cpp b/src/dawn_native/Pipeline.cpp index 6ea7505e97..4f27aa23d7 100644 --- a/src/dawn_native/Pipeline.cpp +++ b/src/dawn_native/Pipeline.cpp @@ -27,7 +27,7 @@ namespace dawn_native { PipelineBase::PipelineBase(PipelineBuilder* builder) : mStageMask(builder->mStageMask), mLayout(std::move(builder->mLayout)) { if (!mLayout) { - dawn::PipelineLayoutDescriptor descriptor; + PipelineLayoutDescriptor descriptor; descriptor.numBindGroupLayouts = 0; descriptor.bindGroupLayouts = nullptr; mLayout = builder->GetParentBuilder()->GetDevice()->CreatePipelineLayout(&descriptor); diff --git a/src/dawn_native/Pipeline.h b/src/dawn_native/Pipeline.h index 35d4ca3866..31b81be10a 100644 --- a/src/dawn_native/Pipeline.h +++ b/src/dawn_native/Pipeline.h @@ -22,7 +22,7 @@ #include "dawn_native/RefCounted.h" #include "dawn_native/ShaderModule.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include diff --git a/src/dawn_native/PipelineLayout.cpp b/src/dawn_native/PipelineLayout.cpp index 75ec3b052f..fd04bf1d40 100644 --- a/src/dawn_native/PipelineLayout.cpp +++ b/src/dawn_native/PipelineLayout.cpp @@ -21,12 +21,12 @@ namespace dawn_native { MaybeError ValidatePipelineLayoutDescriptor(DeviceBase*, - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { DAWN_TRY_ASSERT(descriptor->nextInChain == nullptr, "nextInChain must be nullptr"); DAWN_TRY_ASSERT(descriptor->numBindGroupLayouts <= kMaxBindGroups, "too many bind group layouts"); for (uint32_t i = 0; i < descriptor->numBindGroupLayouts; ++i) { - DAWN_TRY_ASSERT(descriptor->bindGroupLayouts[i].Get() != nullptr, + DAWN_TRY_ASSERT(descriptor->bindGroupLayouts[i] != nullptr, "bind group layouts may not be null"); } return {}; @@ -35,12 +35,11 @@ namespace dawn_native { // PipelineLayoutBase PipelineLayoutBase::PipelineLayoutBase(DeviceBase* device, - const dawn::PipelineLayoutDescriptor* descriptor) + const PipelineLayoutDescriptor* descriptor) : mDevice(device) { ASSERT(descriptor->numBindGroupLayouts <= kMaxBindGroups); for (uint32_t group = 0; group < descriptor->numBindGroupLayouts; ++group) { - mBindGroupLayouts[group] = - reinterpret_cast(descriptor->bindGroupLayouts[group].Get()); + mBindGroupLayouts[group] = descriptor->bindGroupLayouts[group]; mMask.set(group); } } diff --git a/src/dawn_native/PipelineLayout.h b/src/dawn_native/PipelineLayout.h index 31ac6cfbab..3d6b581b0d 100644 --- a/src/dawn_native/PipelineLayout.h +++ b/src/dawn_native/PipelineLayout.h @@ -20,7 +20,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include @@ -28,13 +28,13 @@ namespace dawn_native { MaybeError ValidatePipelineLayoutDescriptor(DeviceBase*, - const dawn::PipelineLayoutDescriptor* descriptor); + const PipelineLayoutDescriptor* descriptor); using BindGroupLayoutArray = std::array, kMaxBindGroups>; class PipelineLayoutBase : public RefCounted { public: - PipelineLayoutBase(DeviceBase* device, const dawn::PipelineLayoutDescriptor* descriptor); + PipelineLayoutBase(DeviceBase* device, const PipelineLayoutDescriptor* descriptor); const BindGroupLayoutBase* GetBindGroupLayout(size_t group) const; const std::bitset GetBindGroupLayoutsMask() const; diff --git a/src/dawn_native/Queue.h b/src/dawn_native/Queue.h index 3284d8e4cb..07a38434b8 100644 --- a/src/dawn_native/Queue.h +++ b/src/dawn_native/Queue.h @@ -20,7 +20,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { diff --git a/src/dawn_native/RenderPassDescriptor.h b/src/dawn_native/RenderPassDescriptor.h index cdc5d92a0d..b48a044460 100644 --- a/src/dawn_native/RenderPassDescriptor.h +++ b/src/dawn_native/RenderPassDescriptor.h @@ -20,7 +20,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include diff --git a/src/dawn_native/RenderPipeline.h b/src/dawn_native/RenderPipeline.h index b3580dbee3..a192d6157d 100644 --- a/src/dawn_native/RenderPipeline.h +++ b/src/dawn_native/RenderPipeline.h @@ -20,7 +20,7 @@ #include "dawn_native/InputState.h" #include "dawn_native/Pipeline.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include diff --git a/src/dawn_native/Sampler.cpp b/src/dawn_native/Sampler.cpp index b5f418ff9a..853104319c 100644 --- a/src/dawn_native/Sampler.cpp +++ b/src/dawn_native/Sampler.cpp @@ -19,7 +19,7 @@ namespace dawn_native { - MaybeError ValidateSamplerDescriptor(DeviceBase*, const dawn::SamplerDescriptor* descriptor) { + MaybeError ValidateSamplerDescriptor(DeviceBase*, const SamplerDescriptor* descriptor) { DAWN_TRY_ASSERT(descriptor->nextInChain == nullptr, "nextInChain must be nullptr"); DAWN_TRY(ValidateFilterMode(descriptor->minFilter)); DAWN_TRY(ValidateFilterMode(descriptor->magFilter)); @@ -32,7 +32,7 @@ namespace dawn_native { // SamplerBase - SamplerBase::SamplerBase(DeviceBase*, const dawn::SamplerDescriptor*) { + SamplerBase::SamplerBase(DeviceBase*, const SamplerDescriptor*) { } } // namespace dawn_native diff --git a/src/dawn_native/Sampler.h b/src/dawn_native/Sampler.h index 7573043bda..5134bb3007 100644 --- a/src/dawn_native/Sampler.h +++ b/src/dawn_native/Sampler.h @@ -18,18 +18,17 @@ #include "dawn_native/Error.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { class DeviceBase; - MaybeError ValidateSamplerDescriptor(DeviceBase* device, - const dawn::SamplerDescriptor* descriptor); + MaybeError ValidateSamplerDescriptor(DeviceBase* device, const SamplerDescriptor* descriptor); class SamplerBase : public RefCounted { public: - SamplerBase(DeviceBase* device, const dawn::SamplerDescriptor* descriptor); + SamplerBase(DeviceBase* device, const SamplerDescriptor* descriptor); }; } // namespace dawn_native diff --git a/src/dawn_native/ShaderModule.h b/src/dawn_native/ShaderModule.h index 6ae92755d2..c64cb627f5 100644 --- a/src/dawn_native/ShaderModule.h +++ b/src/dawn_native/ShaderModule.h @@ -20,7 +20,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include diff --git a/src/dawn_native/SwapChain.h b/src/dawn_native/SwapChain.h index 29bbf23868..021dc9e1cc 100644 --- a/src/dawn_native/SwapChain.h +++ b/src/dawn_native/SwapChain.h @@ -20,7 +20,7 @@ #include "dawn_native/RefCounted.h" #include "dawn/dawn_wsi.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { diff --git a/src/dawn_native/Texture.h b/src/dawn_native/Texture.h index 3fc283704c..d35d7eaae4 100644 --- a/src/dawn_native/Texture.h +++ b/src/dawn_native/Texture.h @@ -19,7 +19,7 @@ #include "dawn_native/Forward.h" #include "dawn_native/RefCounted.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { diff --git a/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp b/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp index 08775bcef8..91cd51f66a 100644 --- a/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp +++ b/src/dawn_native/d3d12/BindGroupLayoutD3D12.cpp @@ -19,8 +19,7 @@ namespace dawn_native { namespace d3d12 { - BindGroupLayout::BindGroupLayout(Device* device, - const dawn::BindGroupLayoutDescriptor* descriptor) + BindGroupLayout::BindGroupLayout(Device* device, const BindGroupLayoutDescriptor* descriptor) : BindGroupLayoutBase(device, descriptor), mDescriptorCounts{} { const auto& groupInfo = GetBindingInfo(); diff --git a/src/dawn_native/d3d12/BindGroupLayoutD3D12.h b/src/dawn_native/d3d12/BindGroupLayoutD3D12.h index c55fbd2ad3..e5766e635d 100644 --- a/src/dawn_native/d3d12/BindGroupLayoutD3D12.h +++ b/src/dawn_native/d3d12/BindGroupLayoutD3D12.h @@ -25,7 +25,7 @@ namespace dawn_native { namespace d3d12 { class BindGroupLayout : public BindGroupLayoutBase { public: - BindGroupLayout(Device* device, const dawn::BindGroupLayoutDescriptor* descriptor); + BindGroupLayout(Device* device, const BindGroupLayoutDescriptor* descriptor); enum DescriptorType { CBV, diff --git a/src/dawn_native/d3d12/DeviceD3D12.cpp b/src/dawn_native/d3d12/DeviceD3D12.cpp index a2aba668a9..b8505525e8 100644 --- a/src/dawn_native/d3d12/DeviceD3D12.cpp +++ b/src/dawn_native/d3d12/DeviceD3D12.cpp @@ -267,7 +267,7 @@ namespace dawn_native { namespace d3d12 { return new BindGroup(this, builder); } ResultOrError Device::CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { return new BindGroupLayout(this, descriptor); } BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) { @@ -292,7 +292,7 @@ namespace dawn_native { namespace d3d12 { return new InputState(this, builder); } ResultOrError Device::CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { return new PipelineLayout(this, descriptor); } ResultOrError Device::CreateQueueImpl() { @@ -305,8 +305,7 @@ namespace dawn_native { namespace d3d12 { RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) { return new RenderPipeline(builder); } - ResultOrError Device::CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) { + ResultOrError Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) { return new Sampler(this, descriptor); } ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) { diff --git a/src/dawn_native/d3d12/DeviceD3D12.h b/src/dawn_native/d3d12/DeviceD3D12.h index d0180e3fc9..4041cb91b8 100644 --- a/src/dawn_native/d3d12/DeviceD3D12.h +++ b/src/dawn_native/d3d12/DeviceD3D12.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_D3D12_DEVICED3D12_H_ #define DAWNNATIVE_D3D12_DEVICED3D12_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include "common/SerialQueue.h" #include "dawn_native/Device.h" @@ -78,12 +78,11 @@ namespace dawn_native { namespace d3d12 { private: ResultOrError CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) override; + const BindGroupLayoutDescriptor* descriptor) override; ResultOrError CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) override; + const PipelineLayoutDescriptor* descriptor) override; ResultOrError CreateQueueImpl() override; - ResultOrError CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) override; + ResultOrError CreateSamplerImpl(const SamplerDescriptor* descriptor) override; uint64_t mSerial = 0; ComPtr mFence; diff --git a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h index 62d0afa10a..f953da5e62 100644 --- a/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h +++ b/src/dawn_native/d3d12/NativeSwapChainImplD3D12.h @@ -18,7 +18,7 @@ #include "dawn_native/d3d12/d3d12_platform.h" #include "dawn/dawn_wsi.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include diff --git a/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp b/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp index b5c62a21fa..a0f2da4e2b 100644 --- a/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp +++ b/src/dawn_native/d3d12/PipelineLayoutD3D12.cpp @@ -23,7 +23,7 @@ using Microsoft::WRL::ComPtr; namespace dawn_native { namespace d3d12 { - PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor) + PipelineLayout::PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor) : PipelineLayoutBase(device, descriptor) { D3D12_ROOT_PARAMETER rootParameters[kMaxBindGroups * 2]; diff --git a/src/dawn_native/d3d12/PipelineLayoutD3D12.h b/src/dawn_native/d3d12/PipelineLayoutD3D12.h index b0f5f45787..90c1802a4c 100644 --- a/src/dawn_native/d3d12/PipelineLayoutD3D12.h +++ b/src/dawn_native/d3d12/PipelineLayoutD3D12.h @@ -25,7 +25,7 @@ namespace dawn_native { namespace d3d12 { class PipelineLayout : public PipelineLayoutBase { public: - PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor); + PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor); uint32_t GetCbvUavSrvRootParameterIndex(uint32_t group) const; uint32_t GetSamplerRootParameterIndex(uint32_t group) const; diff --git a/src/dawn_native/d3d12/SamplerD3D12.cpp b/src/dawn_native/d3d12/SamplerD3D12.cpp index 28cc13233d..9c3559c25e 100644 --- a/src/dawn_native/d3d12/SamplerD3D12.cpp +++ b/src/dawn_native/d3d12/SamplerD3D12.cpp @@ -33,7 +33,7 @@ namespace dawn_native { namespace d3d12 { } } // namespace - Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor) + Sampler::Sampler(Device* device, const SamplerDescriptor* descriptor) : SamplerBase(device, descriptor) { // https://msdn.microsoft.com/en-us/library/windows/desktop/dn770367(v=vs.85).aspx // hex value, decimal value, min linear, mag linear, mip linear diff --git a/src/dawn_native/d3d12/SamplerD3D12.h b/src/dawn_native/d3d12/SamplerD3D12.h index eebe12f828..46e82b5852 100644 --- a/src/dawn_native/d3d12/SamplerD3D12.h +++ b/src/dawn_native/d3d12/SamplerD3D12.h @@ -25,7 +25,7 @@ namespace dawn_native { namespace d3d12 { class Sampler : public SamplerBase { public: - Sampler(Device* device, const dawn::SamplerDescriptor* descriptor); + Sampler(Device* device, const SamplerDescriptor* descriptor); const D3D12_SAMPLER_DESC& GetSamplerDescriptor() const; diff --git a/src/dawn_native/d3d12/TextureCopySplitter.h b/src/dawn_native/d3d12/TextureCopySplitter.h index 58e91225da..eec55e2986 100644 --- a/src/dawn_native/d3d12/TextureCopySplitter.h +++ b/src/dawn_native/d3d12/TextureCopySplitter.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_D3D12_TEXTURECOPYSPLITTER_H_ #define DAWNNATIVE_D3D12_TEXTURECOPYSPLITTER_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include diff --git a/src/dawn_native/dawn_platform.h b/src/dawn_native/dawn_platform.h new file mode 100644 index 0000000000..795c371225 --- /dev/null +++ b/src/dawn_native/dawn_platform.h @@ -0,0 +1,25 @@ +// Copyright 2018 The Dawn Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef DAWNNATIVE_DAWNPLATFORM_H_ +#define DAWNNATIVE_DAWNPLATFORM_H_ + +// Use dawncpp to have the enum and bitfield definitions +#include + +// Use our autogenerated version of the dawn structures that point to dawn_native object types +// (dawn::Buffer is dawn_native::BufferBase*) +#include + +#endif // DAWNNATIVE_DAWNPLATFORM_H_ diff --git a/src/dawn_native/metal/DeviceMTL.h b/src/dawn_native/metal/DeviceMTL.h index 2f4e34474c..57390c112c 100644 --- a/src/dawn_native/metal/DeviceMTL.h +++ b/src/dawn_native/metal/DeviceMTL.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_METAL_DEVICEMTL_H_ #define DAWNNATIVE_METAL_DEVICEMTL_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include "common/Serial.h" #include "dawn_native/Device.h" @@ -64,12 +64,11 @@ namespace dawn_native { namespace metal { private: ResultOrError CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) override; + const BindGroupLayoutDescriptor* descriptor) override; ResultOrError CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) override; + const PipelineLayoutDescriptor* descriptor) override; ResultOrError CreateQueueImpl() override; - ResultOrError CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) override; + ResultOrError CreateSamplerImpl(const SamplerDescriptor* descriptor) override; void OnCompletedHandler(); diff --git a/src/dawn_native/metal/DeviceMTL.mm b/src/dawn_native/metal/DeviceMTL.mm index b3dcc97f1a..a2929279a8 100644 --- a/src/dawn_native/metal/DeviceMTL.mm +++ b/src/dawn_native/metal/DeviceMTL.mm @@ -86,7 +86,7 @@ namespace dawn_native { namespace metal { return new BindGroup(builder); } ResultOrError Device::CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { return new BindGroupLayout(this, descriptor); } BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) { @@ -111,7 +111,7 @@ namespace dawn_native { namespace metal { return new InputState(builder); } ResultOrError Device::CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { return new PipelineLayout(this, descriptor); } RenderPassDescriptorBase* Device::CreateRenderPassDescriptor( @@ -124,8 +124,7 @@ namespace dawn_native { namespace metal { ResultOrError Device::CreateQueueImpl() { return new Queue(this); } - ResultOrError Device::CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) { + ResultOrError Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) { return new Sampler(this, descriptor); } ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) { diff --git a/src/dawn_native/metal/PipelineLayoutMTL.h b/src/dawn_native/metal/PipelineLayoutMTL.h index d7c5f27bcb..149f375fa3 100644 --- a/src/dawn_native/metal/PipelineLayoutMTL.h +++ b/src/dawn_native/metal/PipelineLayoutMTL.h @@ -31,7 +31,7 @@ namespace dawn_native { namespace metal { class PipelineLayout : public PipelineLayoutBase { public: - PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor); + PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor); using BindingIndexInfo = std::array, kMaxBindGroups>; diff --git a/src/dawn_native/metal/PipelineLayoutMTL.mm b/src/dawn_native/metal/PipelineLayoutMTL.mm index 0e039c859e..9912f94de2 100644 --- a/src/dawn_native/metal/PipelineLayoutMTL.mm +++ b/src/dawn_native/metal/PipelineLayoutMTL.mm @@ -20,7 +20,7 @@ namespace dawn_native { namespace metal { - PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor) + PipelineLayout::PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor) : PipelineLayoutBase(device, descriptor) { // Each stage has its own numbering namespace in CompilerMSL. for (auto stage : IterateStages(kAllStages)) { diff --git a/src/dawn_native/metal/SamplerMTL.h b/src/dawn_native/metal/SamplerMTL.h index 56786895a3..776c935629 100644 --- a/src/dawn_native/metal/SamplerMTL.h +++ b/src/dawn_native/metal/SamplerMTL.h @@ -25,7 +25,7 @@ namespace dawn_native { namespace metal { class Sampler : public SamplerBase { public: - Sampler(Device* device, const dawn::SamplerDescriptor* descriptor); + Sampler(Device* device, const SamplerDescriptor* descriptor); ~Sampler(); id GetMTLSamplerState(); diff --git a/src/dawn_native/metal/SamplerMTL.mm b/src/dawn_native/metal/SamplerMTL.mm index 0961358d38..539431ce78 100644 --- a/src/dawn_native/metal/SamplerMTL.mm +++ b/src/dawn_native/metal/SamplerMTL.mm @@ -49,7 +49,7 @@ namespace dawn_native { namespace metal { } } - Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor) + Sampler::Sampler(Device* device, const SamplerDescriptor* descriptor) : SamplerBase(device, descriptor) { MTLSamplerDescriptor* mtlDesc = [MTLSamplerDescriptor new]; [mtlDesc autorelease]; diff --git a/src/dawn_native/null/NullBackend.cpp b/src/dawn_native/null/NullBackend.cpp index 5de42ecf8c..eb0d56107c 100644 --- a/src/dawn_native/null/NullBackend.cpp +++ b/src/dawn_native/null/NullBackend.cpp @@ -40,7 +40,7 @@ namespace dawn_native { namespace null { return new BindGroup(builder); } ResultOrError Device::CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { return new BindGroupLayout(this, descriptor); } BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) { @@ -65,7 +65,7 @@ namespace dawn_native { namespace null { return new InputState(builder); } ResultOrError Device::CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { return new PipelineLayout(this, descriptor); } ResultOrError Device::CreateQueueImpl() { @@ -78,8 +78,7 @@ namespace dawn_native { namespace null { RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) { return new RenderPipeline(builder); } - ResultOrError Device::CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) { + ResultOrError Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) { return new Sampler(this, descriptor); } ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) { diff --git a/src/dawn_native/null/NullBackend.h b/src/dawn_native/null/NullBackend.h index da5ef23de0..383163f72c 100644 --- a/src/dawn_native/null/NullBackend.h +++ b/src/dawn_native/null/NullBackend.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_NULL_NULLBACKEND_H_ #define DAWNNATIVE_NULL_NULLBACKEND_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include "dawn_native/BindGroup.h" #include "dawn_native/BindGroupLayout.h" @@ -118,12 +118,11 @@ namespace dawn_native { namespace null { private: ResultOrError CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) override; + const BindGroupLayoutDescriptor* descriptor) override; ResultOrError CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) override; + const PipelineLayoutDescriptor* descriptor) override; ResultOrError CreateQueueImpl() override; - ResultOrError CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) override; + ResultOrError CreateSamplerImpl(const SamplerDescriptor* descriptor) override; std::vector> mPendingOperations; }; diff --git a/src/dawn_native/opengl/DeviceGL.cpp b/src/dawn_native/opengl/DeviceGL.cpp index 137525a439..2d27e00535 100644 --- a/src/dawn_native/opengl/DeviceGL.cpp +++ b/src/dawn_native/opengl/DeviceGL.cpp @@ -54,7 +54,7 @@ namespace dawn_native { namespace opengl { return new BindGroup(builder); } ResultOrError Device::CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { return new BindGroupLayout(this, descriptor); } BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) { @@ -79,7 +79,7 @@ namespace dawn_native { namespace opengl { return new InputState(builder); } ResultOrError Device::CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { return new PipelineLayout(this, descriptor); } ResultOrError Device::CreateQueueImpl() { @@ -92,8 +92,7 @@ namespace dawn_native { namespace opengl { RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) { return new RenderPipeline(builder); } - ResultOrError Device::CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) { + ResultOrError Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) { return new Sampler(this, descriptor); } ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) { diff --git a/src/dawn_native/opengl/DeviceGL.h b/src/dawn_native/opengl/DeviceGL.h index 862b22ef95..e77a24036a 100644 --- a/src/dawn_native/opengl/DeviceGL.h +++ b/src/dawn_native/opengl/DeviceGL.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_OPENGL_DEVICEGL_H_ #define DAWNNATIVE_OPENGL_DEVICEGL_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include "common/Platform.h" #include "dawn_native/Device.h" @@ -52,12 +52,11 @@ namespace dawn_native { namespace opengl { private: ResultOrError CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) override; + const BindGroupLayoutDescriptor* descriptor) override; ResultOrError CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) override; + const PipelineLayoutDescriptor* descriptor) override; ResultOrError CreateQueueImpl() override; - ResultOrError CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) override; + ResultOrError CreateSamplerImpl(const SamplerDescriptor* descriptor) override; }; }} // namespace dawn_native::opengl diff --git a/src/dawn_native/opengl/PersistentPipelineStateGL.h b/src/dawn_native/opengl/PersistentPipelineStateGL.h index c67f2a54ac..3519e2a905 100644 --- a/src/dawn_native/opengl/PersistentPipelineStateGL.h +++ b/src/dawn_native/opengl/PersistentPipelineStateGL.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_OPENGL_PERSISTENTPIPELINESTATEGL_H_ #define DAWNNATIVE_OPENGL_PERSISTENTPIPELINESTATEGL_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include "glad/glad.h" diff --git a/src/dawn_native/opengl/PipelineLayoutGL.cpp b/src/dawn_native/opengl/PipelineLayoutGL.cpp index 4f5c5a410d..8f2cdaaf96 100644 --- a/src/dawn_native/opengl/PipelineLayoutGL.cpp +++ b/src/dawn_native/opengl/PipelineLayoutGL.cpp @@ -20,7 +20,7 @@ namespace dawn_native { namespace opengl { - PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor) + PipelineLayout::PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor) : PipelineLayoutBase(device, descriptor) { GLuint uboIndex = 0; GLuint samplerIndex = 0; diff --git a/src/dawn_native/opengl/PipelineLayoutGL.h b/src/dawn_native/opengl/PipelineLayoutGL.h index e824e3f202..abf6acf91e 100644 --- a/src/dawn_native/opengl/PipelineLayoutGL.h +++ b/src/dawn_native/opengl/PipelineLayoutGL.h @@ -25,7 +25,7 @@ namespace dawn_native { namespace opengl { class PipelineLayout : public PipelineLayoutBase { public: - PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor); + PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor); using BindingIndexInfo = std::array, kMaxBindGroups>; diff --git a/src/dawn_native/opengl/SamplerGL.cpp b/src/dawn_native/opengl/SamplerGL.cpp index d8ee7a4fd2..ebf47578af 100644 --- a/src/dawn_native/opengl/SamplerGL.cpp +++ b/src/dawn_native/opengl/SamplerGL.cpp @@ -71,7 +71,7 @@ namespace dawn_native { namespace opengl { } // namespace - Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor) + Sampler::Sampler(Device* device, const SamplerDescriptor* descriptor) : SamplerBase(device, descriptor) { glGenSamplers(1, &mHandle); glSamplerParameteri(mHandle, GL_TEXTURE_MAG_FILTER, MagFilterMode(descriptor->magFilter)); diff --git a/src/dawn_native/opengl/SamplerGL.h b/src/dawn_native/opengl/SamplerGL.h index a94f239071..3e6e84c86a 100644 --- a/src/dawn_native/opengl/SamplerGL.h +++ b/src/dawn_native/opengl/SamplerGL.h @@ -25,7 +25,7 @@ namespace dawn_native { namespace opengl { class Sampler : public SamplerBase { public: - Sampler(Device* device, const dawn::SamplerDescriptor* descriptor); + Sampler(Device* device, const SamplerDescriptor* descriptor); GLuint GetHandle() const; diff --git a/src/dawn_native/vulkan/BindGroupLayoutVk.cpp b/src/dawn_native/vulkan/BindGroupLayoutVk.cpp index 3361898a66..94a3429184 100644 --- a/src/dawn_native/vulkan/BindGroupLayoutVk.cpp +++ b/src/dawn_native/vulkan/BindGroupLayoutVk.cpp @@ -54,8 +54,7 @@ namespace dawn_native { namespace vulkan { } } - BindGroupLayout::BindGroupLayout(Device* device, - const dawn::BindGroupLayoutDescriptor* descriptor) + BindGroupLayout::BindGroupLayout(Device* device, const BindGroupLayoutDescriptor* descriptor) : BindGroupLayoutBase(device, descriptor) { const auto& info = GetBindingInfo(); diff --git a/src/dawn_native/vulkan/BindGroupLayoutVk.h b/src/dawn_native/vulkan/BindGroupLayoutVk.h index 15444482fc..6a6d8cd58c 100644 --- a/src/dawn_native/vulkan/BindGroupLayoutVk.h +++ b/src/dawn_native/vulkan/BindGroupLayoutVk.h @@ -27,7 +27,7 @@ namespace dawn_native { namespace vulkan { class BindGroupLayout : public BindGroupLayoutBase { public: - BindGroupLayout(Device* device, const dawn::BindGroupLayoutDescriptor* descriptor); + BindGroupLayout(Device* device, const BindGroupLayoutDescriptor* descriptor); ~BindGroupLayout(); VkDescriptorSetLayout GetHandle() const; diff --git a/src/dawn_native/vulkan/DeviceVk.cpp b/src/dawn_native/vulkan/DeviceVk.cpp index 0c186f5d5b..fcd2106e35 100644 --- a/src/dawn_native/vulkan/DeviceVk.cpp +++ b/src/dawn_native/vulkan/DeviceVk.cpp @@ -225,7 +225,7 @@ namespace dawn_native { namespace vulkan { return new BindGroup(builder); } ResultOrError Device::CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) { + const BindGroupLayoutDescriptor* descriptor) { return new BindGroupLayout(this, descriptor); } BlendStateBase* Device::CreateBlendState(BlendStateBuilder* builder) { @@ -250,7 +250,7 @@ namespace dawn_native { namespace vulkan { return new InputState(builder); } ResultOrError Device::CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) { + const PipelineLayoutDescriptor* descriptor) { return new PipelineLayout(this, descriptor); } ResultOrError Device::CreateQueueImpl() { @@ -263,8 +263,7 @@ namespace dawn_native { namespace vulkan { RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) { return new RenderPipeline(builder); } - ResultOrError Device::CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) { + ResultOrError Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) { return new Sampler(this, descriptor); } ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) { diff --git a/src/dawn_native/vulkan/DeviceVk.h b/src/dawn_native/vulkan/DeviceVk.h index 7a9b5db888..f59cd98acb 100644 --- a/src/dawn_native/vulkan/DeviceVk.h +++ b/src/dawn_native/vulkan/DeviceVk.h @@ -15,7 +15,7 @@ #ifndef DAWNNATIVE_VULKAN_DEVICEVK_H_ #define DAWNNATIVE_VULKAN_DEVICEVK_H_ -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include "common/DynamicLib.h" #include "common/Serial.h" @@ -83,12 +83,11 @@ namespace dawn_native { namespace vulkan { private: ResultOrError CreateBindGroupLayoutImpl( - const dawn::BindGroupLayoutDescriptor* descriptor) override; + const BindGroupLayoutDescriptor* descriptor) override; ResultOrError CreatePipelineLayoutImpl( - const dawn::PipelineLayoutDescriptor* descriptor) override; + const PipelineLayoutDescriptor* descriptor) override; ResultOrError CreateQueueImpl() override; - ResultOrError CreateSamplerImpl( - const dawn::SamplerDescriptor* descriptor) override; + ResultOrError CreateSamplerImpl(const SamplerDescriptor* descriptor) override; bool CreateInstance(VulkanGlobalKnobs* usedKnobs, const std::vector& requiredExtensions); diff --git a/src/dawn_native/vulkan/NativeSwapChainImplVk.h b/src/dawn_native/vulkan/NativeSwapChainImplVk.h index 8a95647596..114439afb3 100644 --- a/src/dawn_native/vulkan/NativeSwapChainImplVk.h +++ b/src/dawn_native/vulkan/NativeSwapChainImplVk.h @@ -18,7 +18,7 @@ #include "dawn_native/vulkan/VulkanInfo.h" #include "dawn/dawn_wsi.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" namespace dawn_native { namespace vulkan { diff --git a/src/dawn_native/vulkan/PipelineLayoutVk.cpp b/src/dawn_native/vulkan/PipelineLayoutVk.cpp index 11b059cd10..3c4ad1bc17 100644 --- a/src/dawn_native/vulkan/PipelineLayoutVk.cpp +++ b/src/dawn_native/vulkan/PipelineLayoutVk.cpp @@ -22,7 +22,7 @@ namespace dawn_native { namespace vulkan { - PipelineLayout::PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor) + PipelineLayout::PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor) : PipelineLayoutBase(device, descriptor) { // Compute the array of VkDescriptorSetLayouts that will be chained in the create info. // TODO(cwallez@chromium.org) Vulkan doesn't allow holes in this array, should we expose diff --git a/src/dawn_native/vulkan/PipelineLayoutVk.h b/src/dawn_native/vulkan/PipelineLayoutVk.h index 77b6bca490..a5072eb572 100644 --- a/src/dawn_native/vulkan/PipelineLayoutVk.h +++ b/src/dawn_native/vulkan/PipelineLayoutVk.h @@ -25,7 +25,7 @@ namespace dawn_native { namespace vulkan { class PipelineLayout : public PipelineLayoutBase { public: - PipelineLayout(Device* device, const dawn::PipelineLayoutDescriptor* descriptor); + PipelineLayout(Device* device, const PipelineLayoutDescriptor* descriptor); ~PipelineLayout(); VkPipelineLayout GetHandle() const; diff --git a/src/dawn_native/vulkan/RenderPassCache.h b/src/dawn_native/vulkan/RenderPassCache.h index a93d46fd14..9f678a5a46 100644 --- a/src/dawn_native/vulkan/RenderPassCache.h +++ b/src/dawn_native/vulkan/RenderPassCache.h @@ -18,7 +18,7 @@ #include "common/vulkan_platform.h" #include "common/Constants.h" -#include "dawn/dawncpp.h" +#include "dawn_native/dawn_platform.h" #include #include diff --git a/src/dawn_native/vulkan/SamplerVk.cpp b/src/dawn_native/vulkan/SamplerVk.cpp index 113ac40403..d54f358b0d 100644 --- a/src/dawn_native/vulkan/SamplerVk.cpp +++ b/src/dawn_native/vulkan/SamplerVk.cpp @@ -56,7 +56,7 @@ namespace dawn_native { namespace vulkan { } } // anonymous namespace - Sampler::Sampler(Device* device, const dawn::SamplerDescriptor* descriptor) + Sampler::Sampler(Device* device, const SamplerDescriptor* descriptor) : SamplerBase(device, descriptor), mDevice(device) { VkSamplerCreateInfo createInfo; createInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; diff --git a/src/dawn_native/vulkan/SamplerVk.h b/src/dawn_native/vulkan/SamplerVk.h index 076c9afeb4..2bd51f1792 100644 --- a/src/dawn_native/vulkan/SamplerVk.h +++ b/src/dawn_native/vulkan/SamplerVk.h @@ -24,7 +24,7 @@ namespace dawn_native { namespace vulkan { class Sampler : public SamplerBase { public: - Sampler(Device* device, const dawn::SamplerDescriptor* descriptor); + Sampler(Device* device, const SamplerDescriptor* descriptor); ~Sampler(); VkSampler GetHandle() const;