d3d11: add BindGroup, BindGroupLayout and PipelineLayout
Bug: dawn:1705 Change-Id: I9bc7545328409c7ce8fd8adc26a35b872cda1420 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/126302 Reviewed-by: Austin Eng <enga@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Peng Huang <penghuang@chromium.org>
This commit is contained in:
parent
4faf3d31ba
commit
86e6a13649
|
@ -427,6 +427,10 @@ source_set("sources") {
|
||||||
"d3d11/AdapterD3D11.h",
|
"d3d11/AdapterD3D11.h",
|
||||||
"d3d11/BackendD3D11.cpp",
|
"d3d11/BackendD3D11.cpp",
|
||||||
"d3d11/BackendD3D11.h",
|
"d3d11/BackendD3D11.h",
|
||||||
|
"d3d11/BindGroupD3D11.cpp",
|
||||||
|
"d3d11/BindGroupD3D11.h",
|
||||||
|
"d3d11/BindGroupLayoutD3D11.cpp",
|
||||||
|
"d3d11/BindGroupLayoutD3D11.h",
|
||||||
"d3d11/CommandRecordingContextD3D11.cpp",
|
"d3d11/CommandRecordingContextD3D11.cpp",
|
||||||
"d3d11/CommandRecordingContextD3D11.h",
|
"d3d11/CommandRecordingContextD3D11.h",
|
||||||
"d3d11/D3D11Backend.cpp",
|
"d3d11/D3D11Backend.cpp",
|
||||||
|
@ -435,6 +439,8 @@ source_set("sources") {
|
||||||
"d3d11/DeviceInfoD3D11.cpp",
|
"d3d11/DeviceInfoD3D11.cpp",
|
||||||
"d3d11/DeviceInfoD3D11.h",
|
"d3d11/DeviceInfoD3D11.h",
|
||||||
"d3d11/Forward.h",
|
"d3d11/Forward.h",
|
||||||
|
"d3d11/PipelineLayoutD3D11.cpp",
|
||||||
|
"d3d11/PipelineLayoutD3D11.h",
|
||||||
"d3d11/PlatformFunctionsD3D11.cpp",
|
"d3d11/PlatformFunctionsD3D11.cpp",
|
||||||
"d3d11/PlatformFunctionsD3D11.h",
|
"d3d11/PlatformFunctionsD3D11.h",
|
||||||
"d3d11/QueueD3D11.cpp",
|
"d3d11/QueueD3D11.cpp",
|
||||||
|
|
|
@ -284,6 +284,10 @@ if (DAWN_ENABLE_D3D11)
|
||||||
"d3d11/AdapterD3D11.h"
|
"d3d11/AdapterD3D11.h"
|
||||||
"d3d11/BackendD3D11.cpp"
|
"d3d11/BackendD3D11.cpp"
|
||||||
"d3d11/BackendD3D11.h"
|
"d3d11/BackendD3D11.h"
|
||||||
|
"d3d11/BindGroupD3D11.cpp"
|
||||||
|
"d3d11/BindGroupD3D11.h"
|
||||||
|
"d3d11/BindGroupLayoutD3D11.cpp"
|
||||||
|
"d3d11/BindGroupLayoutD3D11.h"
|
||||||
"d3d11/CommandRecordingContextD3D11.cpp"
|
"d3d11/CommandRecordingContextD3D11.cpp"
|
||||||
"d3d11/CommandRecordingContextD3D11.h"
|
"d3d11/CommandRecordingContextD3D11.h"
|
||||||
"d3d11/D3D11Backend.cpp"
|
"d3d11/D3D11Backend.cpp"
|
||||||
|
@ -292,6 +296,8 @@ if (DAWN_ENABLE_D3D11)
|
||||||
"d3d11/DeviceInfoD3D11.cpp"
|
"d3d11/DeviceInfoD3D11.cpp"
|
||||||
"d3d11/DeviceInfoD3D11.h"
|
"d3d11/DeviceInfoD3D11.h"
|
||||||
"d3d11/Forward.h"
|
"d3d11/Forward.h"
|
||||||
|
"d3d11/PipelineLayoutD3D11.cpp"
|
||||||
|
"d3d11/PipelineLayoutD3D11.h"
|
||||||
"d3d11/PlatformFunctionsD3D11.cpp"
|
"d3d11/PlatformFunctionsD3D11.cpp"
|
||||||
"d3d11/PlatformFunctionsD3D11.h"
|
"d3d11/PlatformFunctionsD3D11.h"
|
||||||
"d3d11/QueueD3D11.cpp"
|
"d3d11/QueueD3D11.cpp"
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright 2023 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/d3d11/BindGroupD3D11.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "dawn/native/Texture.h"
|
||||||
|
#include "dawn/native/d3d11/BindGroupLayoutD3D11.h"
|
||||||
|
#include "dawn/native/d3d11/DeviceD3D11.h"
|
||||||
|
|
||||||
|
namespace dawn::native::d3d11 {
|
||||||
|
|
||||||
|
// static
|
||||||
|
Ref<BindGroup> BindGroup::Create(Device* device, const BindGroupDescriptor* descriptor) {
|
||||||
|
return ToBackend(descriptor->layout)->AllocateBindGroup(device, descriptor);
|
||||||
|
}
|
||||||
|
|
||||||
|
BindGroup::BindGroup(Device* device, const BindGroupDescriptor* descriptor)
|
||||||
|
: BindGroupBase(this, device, descriptor) {}
|
||||||
|
|
||||||
|
BindGroup::~BindGroup() = default;
|
||||||
|
|
||||||
|
void BindGroup::DestroyImpl() {
|
||||||
|
BindGroupBase::DestroyImpl();
|
||||||
|
ToBackend(GetLayout())->DeallocateBindGroup(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dawn::native::d3d11
|
|
@ -0,0 +1,40 @@
|
||||||
|
// Copyright 2023 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 SRC_DAWN_NATIVE_D3D11_BINDGROUPD3D11_H_
|
||||||
|
#define SRC_DAWN_NATIVE_D3D11_BINDGROUPD3D11_H_
|
||||||
|
|
||||||
|
#include "dawn/common/PlacementAllocated.h"
|
||||||
|
#include "dawn/native/BindGroup.h"
|
||||||
|
|
||||||
|
namespace dawn::native::d3d11 {
|
||||||
|
|
||||||
|
class Device;
|
||||||
|
|
||||||
|
class BindGroup final : public BindGroupBase, public PlacementAllocated {
|
||||||
|
public:
|
||||||
|
static Ref<BindGroup> Create(Device* device, const BindGroupDescriptor* descriptor);
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend SlabAllocator<BindGroup>;
|
||||||
|
|
||||||
|
BindGroup(Device* device, const BindGroupDescriptor* descriptor);
|
||||||
|
~BindGroup() override;
|
||||||
|
|
||||||
|
void DestroyImpl() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dawn::native::d3d11
|
||||||
|
|
||||||
|
#endif // SRC_DAWN_NATIVE_D3D11_BINDGROUPD3D11_H_
|
|
@ -0,0 +1,43 @@
|
||||||
|
// Copyright 2023 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/d3d11/BindGroupLayoutD3D11.h"
|
||||||
|
|
||||||
|
#include "dawn/native/d3d11/DeviceD3D11.h"
|
||||||
|
|
||||||
|
namespace dawn::native::d3d11 {
|
||||||
|
|
||||||
|
ResultOrError<Ref<BindGroupLayout>> BindGroupLayout::Create(
|
||||||
|
Device* device,
|
||||||
|
const BindGroupLayoutDescriptor* descriptor,
|
||||||
|
PipelineCompatibilityToken pipelineCompatibilityToken) {
|
||||||
|
return AcquireRef(new BindGroupLayout(device, descriptor, pipelineCompatibilityToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
BindGroupLayout::BindGroupLayout(Device* device,
|
||||||
|
const BindGroupLayoutDescriptor* descriptor,
|
||||||
|
PipelineCompatibilityToken pipelineCompatibilityToken)
|
||||||
|
: BindGroupLayoutBase(device, descriptor, pipelineCompatibilityToken),
|
||||||
|
mBindGroupAllocator(MakeFrontendBindGroupAllocator<BindGroup>(4096)) {}
|
||||||
|
|
||||||
|
Ref<BindGroup> BindGroupLayout::AllocateBindGroup(Device* device,
|
||||||
|
const BindGroupDescriptor* descriptor) {
|
||||||
|
return AcquireRef(mBindGroupAllocator.Allocate(device, descriptor));
|
||||||
|
}
|
||||||
|
|
||||||
|
void BindGroupLayout::DeallocateBindGroup(BindGroup* bindGroup) {
|
||||||
|
mBindGroupAllocator.Deallocate(bindGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dawn::native::d3d11
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Copyright 2023 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 SRC_DAWN_NATIVE_D3D11_BINDGROUPLAYOUTD3D11_H_
|
||||||
|
#define SRC_DAWN_NATIVE_D3D11_BINDGROUPLAYOUTD3D11_H_
|
||||||
|
|
||||||
|
#include "dawn/common/SlabAllocator.h"
|
||||||
|
#include "dawn/native/BindGroupLayout.h"
|
||||||
|
#include "dawn/native/d3d11/BindGroupD3D11.h"
|
||||||
|
|
||||||
|
namespace dawn::native::d3d11 {
|
||||||
|
|
||||||
|
class Device;
|
||||||
|
|
||||||
|
class BindGroupLayout final : public BindGroupLayoutBase {
|
||||||
|
public:
|
||||||
|
static ResultOrError<Ref<BindGroupLayout>> Create(
|
||||||
|
Device* device,
|
||||||
|
const BindGroupLayoutDescriptor* descriptor,
|
||||||
|
PipelineCompatibilityToken pipelineCompatibilityToken);
|
||||||
|
|
||||||
|
Ref<BindGroup> AllocateBindGroup(Device* device, const BindGroupDescriptor* descriptor);
|
||||||
|
void DeallocateBindGroup(BindGroup* bindGroup);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BindGroupLayout(Device* device,
|
||||||
|
const BindGroupLayoutDescriptor* descriptor,
|
||||||
|
PipelineCompatibilityToken pipelineCompatibilityToken);
|
||||||
|
~BindGroupLayout() override = default;
|
||||||
|
|
||||||
|
SlabAllocator<BindGroup> mBindGroupAllocator;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dawn::native::d3d11
|
||||||
|
|
||||||
|
#endif // SRC_DAWN_NATIVE_D3D11_BINDGROUPLAYOUTD3D11_H_
|
|
@ -30,6 +30,9 @@
|
||||||
#include "dawn/native/d3d/D3DError.h"
|
#include "dawn/native/d3d/D3DError.h"
|
||||||
#include "dawn/native/d3d11/AdapterD3D11.h"
|
#include "dawn/native/d3d11/AdapterD3D11.h"
|
||||||
#include "dawn/native/d3d11/BackendD3D11.h"
|
#include "dawn/native/d3d11/BackendD3D11.h"
|
||||||
|
#include "dawn/native/d3d11/BindGroupD3D11.h"
|
||||||
|
#include "dawn/native/d3d11/BindGroupLayoutD3D11.h"
|
||||||
|
#include "dawn/native/d3d11/PipelineLayoutD3D11.h"
|
||||||
#include "dawn/native/d3d11/PlatformFunctionsD3D11.h"
|
#include "dawn/native/d3d11/PlatformFunctionsD3D11.h"
|
||||||
#include "dawn/native/d3d11/QueueD3D11.h"
|
#include "dawn/native/d3d11/QueueD3D11.h"
|
||||||
#include "dawn/native/d3d11/SamplerD3D11.h"
|
#include "dawn/native/d3d11/SamplerD3D11.h"
|
||||||
|
@ -229,13 +232,13 @@ MaybeError Device::ExecutePendingCommandContext() {
|
||||||
|
|
||||||
ResultOrError<Ref<BindGroupBase>> Device::CreateBindGroupImpl(
|
ResultOrError<Ref<BindGroupBase>> Device::CreateBindGroupImpl(
|
||||||
const BindGroupDescriptor* descriptor) {
|
const BindGroupDescriptor* descriptor) {
|
||||||
return DAWN_UNIMPLEMENTED_ERROR("CreateBindGroupImpl");
|
return BindGroup::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<Ref<BindGroupLayoutBase>> Device::CreateBindGroupLayoutImpl(
|
ResultOrError<Ref<BindGroupLayoutBase>> Device::CreateBindGroupLayoutImpl(
|
||||||
const BindGroupLayoutDescriptor* descriptor,
|
const BindGroupLayoutDescriptor* descriptor,
|
||||||
PipelineCompatibilityToken pipelineCompatibilityToken) {
|
PipelineCompatibilityToken pipelineCompatibilityToken) {
|
||||||
return DAWN_UNIMPLEMENTED_ERROR("CreateBindGroupLayoutImpl");
|
return BindGroupLayout::Create(this, descriptor, pipelineCompatibilityToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<Ref<BufferBase>> Device::CreateBufferImpl(const BufferDescriptor* descriptor) {
|
ResultOrError<Ref<BufferBase>> Device::CreateBufferImpl(const BufferDescriptor* descriptor) {
|
||||||
|
@ -255,7 +258,7 @@ Ref<ComputePipelineBase> Device::CreateUninitializedComputePipelineImpl(
|
||||||
|
|
||||||
ResultOrError<Ref<PipelineLayoutBase>> Device::CreatePipelineLayoutImpl(
|
ResultOrError<Ref<PipelineLayoutBase>> Device::CreatePipelineLayoutImpl(
|
||||||
const PipelineLayoutDescriptor* descriptor) {
|
const PipelineLayoutDescriptor* descriptor) {
|
||||||
return DAWN_UNIMPLEMENTED_ERROR("CreatePipelineLayoutImpl");
|
return PipelineLayout::Create(this, descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultOrError<Ref<QuerySetBase>> Device::CreateQuerySetImpl(const QuerySetDescriptor* descriptor) {
|
ResultOrError<Ref<QuerySetBase>> Device::CreateQuerySetImpl(const QuerySetDescriptor* descriptor) {
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
// Copyright 2023 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/d3d11/PipelineLayoutD3D11.h"
|
||||||
|
|
||||||
|
#include "dawn/common/BitSetIterator.h"
|
||||||
|
#include "dawn/native/BindGroupLayout.h"
|
||||||
|
#include "dawn/native/d3d11/DeviceD3D11.h"
|
||||||
|
|
||||||
|
namespace dawn::native::d3d11 {
|
||||||
|
|
||||||
|
// static
|
||||||
|
ResultOrError<Ref<PipelineLayout>> PipelineLayout::Create(
|
||||||
|
Device* device,
|
||||||
|
const PipelineLayoutDescriptor* descriptor) {
|
||||||
|
Ref<PipelineLayout> pipelineLayout = AcquireRef(new PipelineLayout(device, descriptor));
|
||||||
|
DAWN_TRY(pipelineLayout->Initialize());
|
||||||
|
return pipelineLayout;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaybeError PipelineLayout::Initialize() {
|
||||||
|
unsigned int constantBufferIndex = 0;
|
||||||
|
unsigned int samplerIndex = 0;
|
||||||
|
unsigned int shaderResourceViewIndex = 0;
|
||||||
|
unsigned int unorderedAccessViewIndex = 0;
|
||||||
|
unsigned int storageTextureIndex = 0;
|
||||||
|
|
||||||
|
for (BindGroupIndex group : IterateBitSet(GetBindGroupLayoutsMask())) {
|
||||||
|
const BindGroupLayoutBase* bgl = GetBindGroupLayout(group);
|
||||||
|
mIndexInfo[group].resize(bgl->GetBindingCount());
|
||||||
|
|
||||||
|
for (BindingIndex bindingIndex{0}; bindingIndex < bgl->GetBindingCount(); ++bindingIndex) {
|
||||||
|
const BindingInfo& bindingInfo = bgl->GetBindingInfo(bindingIndex);
|
||||||
|
switch (bindingInfo.bindingType) {
|
||||||
|
case BindingInfoType::Buffer:
|
||||||
|
switch (bindingInfo.buffer.type) {
|
||||||
|
case wgpu::BufferBindingType::Uniform:
|
||||||
|
mIndexInfo[group][bindingIndex] = constantBufferIndex++;
|
||||||
|
break;
|
||||||
|
case wgpu::BufferBindingType::Storage:
|
||||||
|
case kInternalStorageBufferBinding:
|
||||||
|
case wgpu::BufferBindingType::ReadOnlyStorage:
|
||||||
|
mIndexInfo[group][bindingIndex] = unorderedAccessViewIndex++;
|
||||||
|
break;
|
||||||
|
case wgpu::BufferBindingType::Undefined:
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BindingInfoType::Sampler:
|
||||||
|
mIndexInfo[group][bindingIndex] = samplerIndex++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BindingInfoType::Texture:
|
||||||
|
case BindingInfoType::ExternalTexture:
|
||||||
|
mIndexInfo[group][bindingIndex] = shaderResourceViewIndex++;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BindingInfoType::StorageTexture:
|
||||||
|
mIndexInfo[group][bindingIndex] = storageTextureIndex++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const PipelineLayout::BindingIndexInfo& PipelineLayout::GetBindingIndexInfo() const {
|
||||||
|
return mIndexInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace dawn::native::d3d11
|
|
@ -0,0 +1,61 @@
|
||||||
|
// Copyright 2023 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 SRC_DAWN_NATIVE_D3D11_PIPELINELAYOUTD3D11_H_
|
||||||
|
#define SRC_DAWN_NATIVE_D3D11_PIPELINELAYOUTD3D11_H_
|
||||||
|
|
||||||
|
#include "dawn/native/PipelineLayout.h"
|
||||||
|
|
||||||
|
#include "dawn/common/ityp_array.h"
|
||||||
|
#include "dawn/common/ityp_vector.h"
|
||||||
|
#include "dawn/native/BindingInfo.h"
|
||||||
|
#include "dawn/native/d3d/d3d_platform.h"
|
||||||
|
|
||||||
|
namespace dawn::native::d3d11 {
|
||||||
|
|
||||||
|
class Device;
|
||||||
|
|
||||||
|
// For D3D11, uniform buffers, samplers, sampled textures, and storage buffers are bind to
|
||||||
|
// different kind of slots. The number of slots for each type is limited by the D3D11 spec.
|
||||||
|
// So we need to pack the bindings by type into the slots tightly.
|
||||||
|
// And D3D11 uses SM 5.0 which doesn't support spaces(binding groups). so we need to flatten
|
||||||
|
// the binding groups into a single array.
|
||||||
|
class PipelineLayout final : public PipelineLayoutBase {
|
||||||
|
public:
|
||||||
|
// constant buffer slot reserved for index offsets and num workgroups.
|
||||||
|
static constexpr uint32_t kReservedConstantBufferSlot =
|
||||||
|
D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1;
|
||||||
|
static constexpr uint32_t kFirstIndexOffsetConstantBufferSlot = kReservedConstantBufferSlot;
|
||||||
|
static constexpr uint32_t kNumWorkgroupsConstantBufferSlot = kReservedConstantBufferSlot;
|
||||||
|
|
||||||
|
static ResultOrError<Ref<PipelineLayout>> Create(Device* device,
|
||||||
|
const PipelineLayoutDescriptor* descriptor);
|
||||||
|
|
||||||
|
using BindingIndexInfo =
|
||||||
|
ityp::array<BindGroupIndex, ityp::vector<BindingIndex, uint32_t>, kMaxBindGroups>;
|
||||||
|
const BindingIndexInfo& GetBindingIndexInfo() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
using PipelineLayoutBase::PipelineLayoutBase;
|
||||||
|
|
||||||
|
~PipelineLayout() override = default;
|
||||||
|
|
||||||
|
MaybeError Initialize();
|
||||||
|
|
||||||
|
BindingIndexInfo mIndexInfo;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace dawn::native::d3d11
|
||||||
|
|
||||||
|
#endif // SRC_DAWN_NATIVE_D3D11_PIPELINELAYOUTD3D11_H_
|
Loading…
Reference in New Issue