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().
This commit is contained in:
parent
5d313225ff
commit
36afbb6a0d
|
@ -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))
|
||||
|
|
|
@ -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<dawn::{{as_cppType(arg.type.name)}}>({{as_varName(arg.name)}})
|
||||
{%- elif arg.type.category == "structure" and arg.annotation != "value" -%}
|
||||
reinterpret_cast<const dawn::{{as_cppType(arg.type.name)}}*>({{as_varName(arg.name)}})
|
||||
reinterpret_cast<const {{as_cppType(arg.type.name)}}*>({{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<dawn::{{as_cppType(arg.type.name)}}>({{as_varName(arg.name)}})
|
||||
{%- elif arg.type.category == "structure" and arg.annotation != "value" -%}
|
||||
reinterpret_cast<const dawn::{{as_cppType(arg.type.name)}}*>({{as_varName(arg.name)}})
|
||||
reinterpret_cast<const {{as_cppType(arg.type.name)}}*>({{as_varName(arg.name)}})
|
||||
{%- else -%}
|
||||
{{as_varName(arg.name)}}
|
||||
{%- endif -%}
|
||||
|
|
|
@ -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 %}
|
||||
}
|
|
@ -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_
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
|
|
@ -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<kMaxBindingsPerGroup> 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) {
|
||||
|
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 <string>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace dawn_native {
|
|||
}
|
||||
|
||||
ResultOrError<BindGroupLayoutBase*> 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 {};
|
||||
|
|
|
@ -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<BindGroupLayoutBase*> 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<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
||||
const dawn::BindGroupLayoutDescriptor* descriptor) = 0;
|
||||
const BindGroupLayoutDescriptor* descriptor) = 0;
|
||||
virtual ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) = 0;
|
||||
const PipelineLayoutDescriptor* descriptor) = 0;
|
||||
virtual ResultOrError<QueueBase*> CreateQueueImpl() = 0;
|
||||
virtual ResultOrError<SamplerBase*> 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);
|
||||
|
||||
|
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#ifndef DAWNNATIVE_PASSRESOURCEUSAGE_H
|
||||
#define DAWNNATIVE_PASSRESOURCEUSAGE_H
|
||||
|
||||
#include "dawn/dawncpp.h"
|
||||
#include "dawn_native/dawn_platform.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "common/BitSetIterator.h"
|
||||
#include "common/Constants.h"
|
||||
|
||||
#include "dawn/dawncpp.h"
|
||||
#include "dawn_native/dawn_platform.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
|
|
@ -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<BindGroupLayoutBase*>(descriptor->bindGroupLayouts[group].Get());
|
||||
mBindGroupLayouts[group] = descriptor->bindGroupLayouts[group];
|
||||
mMask.set(group);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
@ -28,13 +28,13 @@
|
|||
namespace dawn_native {
|
||||
|
||||
MaybeError ValidatePipelineLayoutDescriptor(DeviceBase*,
|
||||
const dawn::PipelineLayoutDescriptor* descriptor);
|
||||
const PipelineLayoutDescriptor* descriptor);
|
||||
|
||||
using BindGroupLayoutArray = std::array<Ref<BindGroupLayoutBase>, 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<kMaxBindGroups> GetBindGroupLayoutsMask() const;
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <array>
|
||||
#include <bitset>
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -267,7 +267,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
return new BindGroup(this, builder);
|
||||
}
|
||||
ResultOrError<BindGroupLayoutBase*> 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<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) {
|
||||
const PipelineLayoutDescriptor* descriptor) {
|
||||
return new PipelineLayout(this, descriptor);
|
||||
}
|
||||
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
|
||||
|
@ -305,8 +305,7 @@ namespace dawn_native { namespace d3d12 {
|
|||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
}
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) {
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||
return new Sampler(this, descriptor);
|
||||
}
|
||||
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
|
||||
|
|
|
@ -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<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
||||
const dawn::BindGroupLayoutDescriptor* descriptor) override;
|
||||
const BindGroupLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) override;
|
||||
const PipelineLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<QueueBase*> CreateQueueImpl() override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
|
||||
|
||||
uint64_t mSerial = 0;
|
||||
ComPtr<ID3D12Fence> mFence;
|
||||
|
|
|
@ -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 <vector>
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 <array>
|
||||
|
||||
|
|
|
@ -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 <dawn/dawncpp.h>
|
||||
|
||||
// Use our autogenerated version of the dawn structures that point to dawn_native object types
|
||||
// (dawn::Buffer is dawn_native::BufferBase*)
|
||||
#include <dawn_native/dawn_structs_autogen.h>
|
||||
|
||||
#endif // DAWNNATIVE_DAWNPLATFORM_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<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
||||
const dawn::BindGroupLayoutDescriptor* descriptor) override;
|
||||
const BindGroupLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) override;
|
||||
const PipelineLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<QueueBase*> CreateQueueImpl() override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
|
||||
|
||||
void OnCompletedHandler();
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace dawn_native { namespace metal {
|
|||
return new BindGroup(builder);
|
||||
}
|
||||
ResultOrError<BindGroupLayoutBase*> 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<PipelineLayoutBase*> 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<QueueBase*> Device::CreateQueueImpl() {
|
||||
return new Queue(this);
|
||||
}
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) {
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||
return new Sampler(this, descriptor);
|
||||
}
|
||||
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
|
||||
|
|
|
@ -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<std::array<uint32_t, kMaxBindingsPerGroup>, kMaxBindGroups>;
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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<MTLSamplerState> GetMTLSamplerState();
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -40,7 +40,7 @@ namespace dawn_native { namespace null {
|
|||
return new BindGroup(builder);
|
||||
}
|
||||
ResultOrError<BindGroupLayoutBase*> 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<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) {
|
||||
const PipelineLayoutDescriptor* descriptor) {
|
||||
return new PipelineLayout(this, descriptor);
|
||||
}
|
||||
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
|
||||
|
@ -78,8 +78,7 @@ namespace dawn_native { namespace null {
|
|||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
}
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) {
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||
return new Sampler(this, descriptor);
|
||||
}
|
||||
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
|
||||
|
|
|
@ -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<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
||||
const dawn::BindGroupLayoutDescriptor* descriptor) override;
|
||||
const BindGroupLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) override;
|
||||
const PipelineLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<QueueBase*> CreateQueueImpl() override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
|
||||
|
||||
std::vector<std::unique_ptr<PendingOperation>> mPendingOperations;
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace dawn_native { namespace opengl {
|
|||
return new BindGroup(builder);
|
||||
}
|
||||
ResultOrError<BindGroupLayoutBase*> 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<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) {
|
||||
const PipelineLayoutDescriptor* descriptor) {
|
||||
return new PipelineLayout(this, descriptor);
|
||||
}
|
||||
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
|
||||
|
@ -92,8 +92,7 @@ namespace dawn_native { namespace opengl {
|
|||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
}
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) {
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||
return new Sampler(this, descriptor);
|
||||
}
|
||||
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
|
||||
|
|
|
@ -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<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
||||
const dawn::BindGroupLayoutDescriptor* descriptor) override;
|
||||
const BindGroupLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) override;
|
||||
const PipelineLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<QueueBase*> CreateQueueImpl() override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
|
||||
};
|
||||
|
||||
}} // namespace dawn_native::opengl
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<std::array<GLuint, kMaxBindingsPerGroup>, kMaxBindGroups>;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace dawn_native { namespace vulkan {
|
|||
return new BindGroup(builder);
|
||||
}
|
||||
ResultOrError<BindGroupLayoutBase*> 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<PipelineLayoutBase*> Device::CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) {
|
||||
const PipelineLayoutDescriptor* descriptor) {
|
||||
return new PipelineLayout(this, descriptor);
|
||||
}
|
||||
ResultOrError<QueueBase*> Device::CreateQueueImpl() {
|
||||
|
@ -263,8 +263,7 @@ namespace dawn_native { namespace vulkan {
|
|||
RenderPipelineBase* Device::CreateRenderPipeline(RenderPipelineBuilder* builder) {
|
||||
return new RenderPipeline(builder);
|
||||
}
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) {
|
||||
ResultOrError<SamplerBase*> Device::CreateSamplerImpl(const SamplerDescriptor* descriptor) {
|
||||
return new Sampler(this, descriptor);
|
||||
}
|
||||
ShaderModuleBase* Device::CreateShaderModule(ShaderModuleBuilder* builder) {
|
||||
|
|
|
@ -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<BindGroupLayoutBase*> CreateBindGroupLayoutImpl(
|
||||
const dawn::BindGroupLayoutDescriptor* descriptor) override;
|
||||
const BindGroupLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<PipelineLayoutBase*> CreatePipelineLayoutImpl(
|
||||
const dawn::PipelineLayoutDescriptor* descriptor) override;
|
||||
const PipelineLayoutDescriptor* descriptor) override;
|
||||
ResultOrError<QueueBase*> CreateQueueImpl() override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(
|
||||
const dawn::SamplerDescriptor* descriptor) override;
|
||||
ResultOrError<SamplerBase*> CreateSamplerImpl(const SamplerDescriptor* descriptor) override;
|
||||
|
||||
bool CreateInstance(VulkanGlobalKnobs* usedKnobs,
|
||||
const std::vector<const char*>& requiredExtensions);
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include "common/vulkan_platform.h"
|
||||
|
||||
#include "common/Constants.h"
|
||||
#include "dawn/dawncpp.h"
|
||||
#include "dawn_native/dawn_platform.h"
|
||||
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue