Return Dawn result upon submit.
Missing OOM error should submit fail to create a descriptor heap. BUG=dawn:177 Change-Id: I6ccc10f3e0b8de0bd21caa9aca35f4f269ce51e3 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/11540 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
27a35eb2a9
commit
41f8aa550b
|
@ -39,7 +39,9 @@ namespace dawn_native {
|
||||||
}
|
}
|
||||||
ASSERT(!IsError());
|
ASSERT(!IsError());
|
||||||
|
|
||||||
SubmitImpl(commandCount, commands);
|
if (device->ConsumedError(SubmitImpl(commandCount, commands))) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
device->GetErrorScopeTracker()->TrackUntilLastSubmitComplete(
|
device->GetErrorScopeTracker()->TrackUntilLastSubmitComplete(
|
||||||
device->GetCurrentErrorScope());
|
device->GetCurrentErrorScope());
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace dawn_native {
|
||||||
FenceBase* CreateFence(const FenceDescriptor* descriptor);
|
FenceBase* CreateFence(const FenceDescriptor* descriptor);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) = 0;
|
virtual MaybeError SubmitImpl(uint32_t commandCount,
|
||||||
|
CommandBufferBase* const* commands) = 0;
|
||||||
|
|
||||||
MaybeError ValidateSubmit(uint32_t commandCount, CommandBufferBase* const* commands);
|
MaybeError ValidateSubmit(uint32_t commandCount, CommandBufferBase* const* commands);
|
||||||
MaybeError ValidateSignal(const FenceBase* fence, uint64_t signalValue);
|
MaybeError ValidateSignal(const FenceBase* fence, uint64_t signalValue);
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
mInCompute = inCompute_;
|
mInCompute = inCompute_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllocateDescriptorHeaps(Device* device) {
|
MaybeError AllocateDescriptorHeaps(Device* device) {
|
||||||
// This function should only be called once.
|
// This function should only be called once.
|
||||||
ASSERT(mCbvSrvUavGPUDescriptorHeap.Get() == nullptr &&
|
ASSERT(mCbvSrvUavGPUDescriptorHeap.Get() == nullptr &&
|
||||||
mSamplerGPUDescriptorHeap.Get() == nullptr);
|
mSamplerGPUDescriptorHeap.Get() == nullptr);
|
||||||
|
@ -90,13 +90,16 @@ namespace dawn_native { namespace d3d12 {
|
||||||
DescriptorHeapAllocator* descriptorHeapAllocator = device->GetDescriptorHeapAllocator();
|
DescriptorHeapAllocator* descriptorHeapAllocator = device->GetDescriptorHeapAllocator();
|
||||||
|
|
||||||
if (mCbvSrvUavDescriptorHeapSize > 0) {
|
if (mCbvSrvUavDescriptorHeapSize > 0) {
|
||||||
mCbvSrvUavGPUDescriptorHeap = descriptorHeapAllocator->AllocateGPUHeap(
|
DAWN_TRY_ASSIGN(
|
||||||
D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, mCbvSrvUavDescriptorHeapSize);
|
mCbvSrvUavGPUDescriptorHeap,
|
||||||
|
descriptorHeapAllocator->AllocateGPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV,
|
||||||
|
mCbvSrvUavDescriptorHeapSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mSamplerDescriptorHeapSize > 0) {
|
if (mSamplerDescriptorHeapSize > 0) {
|
||||||
mSamplerGPUDescriptorHeap = descriptorHeapAllocator->AllocateGPUHeap(
|
DAWN_TRY_ASSIGN(mSamplerGPUDescriptorHeap, descriptorHeapAllocator->AllocateGPUHeap(
|
||||||
D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER, mSamplerDescriptorHeapSize);
|
D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER,
|
||||||
|
mSamplerDescriptorHeapSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t cbvSrvUavDescriptorIndex = 0;
|
uint32_t cbvSrvUavDescriptorIndex = 0;
|
||||||
|
@ -115,6 +118,8 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
ASSERT(cbvSrvUavDescriptorIndex == mCbvSrvUavDescriptorHeapSize);
|
ASSERT(cbvSrvUavDescriptorIndex == mCbvSrvUavDescriptorHeapSize);
|
||||||
ASSERT(samplerDescriptorIndex == mSamplerDescriptorHeapSize);
|
ASSERT(samplerDescriptorIndex == mSamplerDescriptorHeapSize);
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function must only be called before calling AllocateDescriptorHeaps().
|
// This function must only be called before calling AllocateDescriptorHeaps().
|
||||||
|
@ -281,16 +286,19 @@ namespace dawn_native { namespace d3d12 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllocateRTVAndDSVHeaps() {
|
MaybeError AllocateRTVAndDSVHeaps() {
|
||||||
// This function should only be called once.
|
// This function should only be called once.
|
||||||
DAWN_ASSERT(mRTVHeap.Get() == nullptr && mDSVHeap.Get() == nullptr);
|
DAWN_ASSERT(mRTVHeap.Get() == nullptr && mDSVHeap.Get() == nullptr);
|
||||||
DescriptorHeapAllocator* allocator = mDevice->GetDescriptorHeapAllocator();
|
DescriptorHeapAllocator* allocator = mDevice->GetDescriptorHeapAllocator();
|
||||||
if (mNumRTVs > 0) {
|
if (mNumRTVs > 0) {
|
||||||
mRTVHeap = allocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_RTV, mNumRTVs);
|
DAWN_TRY_ASSIGN(
|
||||||
|
mRTVHeap, allocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_RTV, mNumRTVs));
|
||||||
}
|
}
|
||||||
if (mNumDSVs > 0) {
|
if (mNumDSVs > 0) {
|
||||||
mDSVHeap = allocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_DSV, mNumDSVs);
|
DAWN_TRY_ASSIGN(
|
||||||
|
mDSVHeap, allocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_DSV, mNumDSVs));
|
||||||
}
|
}
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(jiawei.shao@intel.com): use hash map <RenderPass, OMSetRenderTargetArgs> as
|
// TODO(jiawei.shao@intel.com): use hash map <RenderPass, OMSetRenderTargetArgs> as
|
||||||
|
@ -445,11 +453,11 @@ namespace dawn_native { namespace d3d12 {
|
||||||
D3D12_INDEX_BUFFER_VIEW mD3D12BufferView = {};
|
D3D12_INDEX_BUFFER_VIEW mD3D12BufferView = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
void AllocateAndSetDescriptorHeaps(Device* device,
|
MaybeError AllocateAndSetDescriptorHeaps(Device* device,
|
||||||
BindGroupStateTracker* bindingTracker,
|
BindGroupStateTracker* bindingTracker,
|
||||||
RenderPassDescriptorHeapTracker* renderPassTracker,
|
RenderPassDescriptorHeapTracker* renderPassTracker,
|
||||||
CommandIterator* commands,
|
CommandIterator* commands,
|
||||||
uint32_t indexInSubmit) {
|
uint32_t indexInSubmit) {
|
||||||
{
|
{
|
||||||
Command type;
|
Command type;
|
||||||
|
|
||||||
|
@ -495,8 +503,9 @@ namespace dawn_native { namespace d3d12 {
|
||||||
commands->Reset();
|
commands->Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
renderPassTracker->AllocateRTVAndDSVHeaps();
|
DAWN_TRY(renderPassTracker->AllocateRTVAndDSVHeaps());
|
||||||
bindingTracker->AllocateDescriptorHeaps(device);
|
DAWN_TRY(bindingTracker->AllocateDescriptorHeaps(device));
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResolveMultisampledRenderPass(ComPtr<ID3D12GraphicsCommandList> commandList,
|
void ResolveMultisampledRenderPass(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||||
|
@ -542,8 +551,8 @@ namespace dawn_native { namespace d3d12 {
|
||||||
FreeCommands(&mCommands);
|
FreeCommands(&mCommands);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBuffer::RecordCommands(ComPtr<ID3D12GraphicsCommandList> commandList,
|
MaybeError CommandBuffer::RecordCommands(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||||
uint32_t indexInSubmit) {
|
uint32_t indexInSubmit) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
BindGroupStateTracker bindingTracker(device);
|
BindGroupStateTracker bindingTracker(device);
|
||||||
RenderPassDescriptorHeapTracker renderPassTracker(device);
|
RenderPassDescriptorHeapTracker renderPassTracker(device);
|
||||||
|
@ -553,8 +562,8 @@ namespace dawn_native { namespace d3d12 {
|
||||||
// should have a system where commands and descriptors are recorded in parallel then the
|
// should have a system where commands and descriptors are recorded in parallel then the
|
||||||
// heaps set using a small CommandList inserted just before the main CommandList.
|
// heaps set using a small CommandList inserted just before the main CommandList.
|
||||||
{
|
{
|
||||||
AllocateAndSetDescriptorHeaps(device, &bindingTracker, &renderPassTracker, &mCommands,
|
DAWN_TRY(AllocateAndSetDescriptorHeaps(device, &bindingTracker, &renderPassTracker,
|
||||||
indexInSubmit);
|
&mCommands, indexInSubmit));
|
||||||
bindingTracker.Reset();
|
bindingTracker.Reset();
|
||||||
bindingTracker.SetID3D12DescriptorHeaps(commandList);
|
bindingTracker.SetID3D12DescriptorHeaps(commandList);
|
||||||
}
|
}
|
||||||
|
@ -765,6 +774,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_ASSERT(renderPassTracker.IsHeapAllocationCompleted());
|
DAWN_ASSERT(renderPassTracker.IsHeapAllocationCompleted());
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBuffer::RecordComputePass(ComPtr<ID3D12GraphicsCommandList> commandList,
|
void CommandBuffer::RecordComputePass(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "common/Constants.h"
|
#include "common/Constants.h"
|
||||||
#include "dawn_native/CommandAllocator.h"
|
#include "dawn_native/CommandAllocator.h"
|
||||||
#include "dawn_native/CommandBuffer.h"
|
#include "dawn_native/CommandBuffer.h"
|
||||||
|
#include "dawn_native/Error.h"
|
||||||
|
|
||||||
#include "dawn_native/d3d12/Forward.h"
|
#include "dawn_native/d3d12/Forward.h"
|
||||||
#include "dawn_native/d3d12/d3d12_platform.h"
|
#include "dawn_native/d3d12/d3d12_platform.h"
|
||||||
|
@ -40,7 +41,8 @@ namespace dawn_native { namespace d3d12 {
|
||||||
CommandBuffer(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
CommandBuffer(CommandEncoderBase* encoder, const CommandBufferDescriptor* descriptor);
|
||||||
~CommandBuffer();
|
~CommandBuffer();
|
||||||
|
|
||||||
void RecordCommands(ComPtr<ID3D12GraphicsCommandList> commandList, uint32_t indexInSubmit);
|
MaybeError RecordCommands(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||||
|
uint32_t indexInSubmit);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void RecordComputePass(ComPtr<ID3D12GraphicsCommandList> commandList,
|
void RecordComputePass(ComPtr<ID3D12GraphicsCommandList> commandList,
|
||||||
|
|
|
@ -61,11 +61,12 @@ namespace dawn_native { namespace d3d12 {
|
||||||
} {
|
} {
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorHeapHandle DescriptorHeapAllocator::Allocate(D3D12_DESCRIPTOR_HEAP_TYPE type,
|
ResultOrError<DescriptorHeapHandle> DescriptorHeapAllocator::Allocate(
|
||||||
uint32_t count,
|
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||||
uint32_t allocationSize,
|
uint32_t count,
|
||||||
DescriptorHeapInfo* heapInfo,
|
uint32_t allocationSize,
|
||||||
D3D12_DESCRIPTOR_HEAP_FLAGS flags) {
|
DescriptorHeapInfo* heapInfo,
|
||||||
|
D3D12_DESCRIPTOR_HEAP_FLAGS flags) {
|
||||||
// TODO(enga@google.com): This is just a linear allocator so the heap will quickly run out
|
// TODO(enga@google.com): This is just a linear allocator so the heap will quickly run out
|
||||||
// of space causing a new one to be allocated We should reuse heap subranges that have been
|
// of space causing a new one to be allocated We should reuse heap subranges that have been
|
||||||
// released
|
// released
|
||||||
|
@ -94,8 +95,10 @@ namespace dawn_native { namespace d3d12 {
|
||||||
heapDescriptor.Flags = flags;
|
heapDescriptor.Flags = flags;
|
||||||
heapDescriptor.NodeMask = 0;
|
heapDescriptor.NodeMask = 0;
|
||||||
ComPtr<ID3D12DescriptorHeap> heap;
|
ComPtr<ID3D12DescriptorHeap> heap;
|
||||||
ASSERT_SUCCESS(
|
if (FAILED(mDevice->GetD3D12Device()->CreateDescriptorHeap(&heapDescriptor,
|
||||||
mDevice->GetD3D12Device()->CreateDescriptorHeap(&heapDescriptor, IID_PPV_ARGS(&heap)));
|
IID_PPV_ARGS(&heap)))) {
|
||||||
|
return DAWN_OUT_OF_MEMORY_ERROR("Unable to allocate heap");
|
||||||
|
}
|
||||||
|
|
||||||
AllocationInfo allocationInfo = {allocationSize, allocationSize - count};
|
AllocationInfo allocationInfo = {allocationSize, allocationSize - count};
|
||||||
*heapInfo = std::make_pair(heap, allocationInfo);
|
*heapInfo = std::make_pair(heap, allocationInfo);
|
||||||
|
@ -105,14 +108,16 @@ namespace dawn_native { namespace d3d12 {
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorHeapHandle DescriptorHeapAllocator::AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type,
|
ResultOrError<DescriptorHeapHandle> DescriptorHeapAllocator::AllocateCPUHeap(
|
||||||
uint32_t count) {
|
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||||
|
uint32_t count) {
|
||||||
return Allocate(type, count, count, &mCpuDescriptorHeapInfos[type],
|
return Allocate(type, count, count, &mCpuDescriptorHeapInfos[type],
|
||||||
D3D12_DESCRIPTOR_HEAP_FLAG_NONE);
|
D3D12_DESCRIPTOR_HEAP_FLAG_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorHeapHandle DescriptorHeapAllocator::AllocateGPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type,
|
ResultOrError<DescriptorHeapHandle> DescriptorHeapAllocator::AllocateGPUHeap(
|
||||||
uint32_t count) {
|
D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||||
|
uint32_t count) {
|
||||||
ASSERT(type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV ||
|
ASSERT(type == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV ||
|
||||||
type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
type == D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER);
|
||||||
unsigned int heapSize =
|
unsigned int heapSize =
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/SerialQueue.h"
|
#include "common/SerialQueue.h"
|
||||||
|
|
||||||
|
#include "dawn_native/Error.h"
|
||||||
|
|
||||||
namespace dawn_native { namespace d3d12 {
|
namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
class Device;
|
class Device;
|
||||||
|
@ -46,8 +48,10 @@ namespace dawn_native { namespace d3d12 {
|
||||||
public:
|
public:
|
||||||
DescriptorHeapAllocator(Device* device);
|
DescriptorHeapAllocator(Device* device);
|
||||||
|
|
||||||
DescriptorHeapHandle AllocateGPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count);
|
ResultOrError<DescriptorHeapHandle> AllocateGPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||||
DescriptorHeapHandle AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type, uint32_t count);
|
uint32_t count);
|
||||||
|
ResultOrError<DescriptorHeapHandle> AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||||
|
uint32_t count);
|
||||||
void Tick(uint64_t lastCompletedSerial);
|
void Tick(uint64_t lastCompletedSerial);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -63,11 +67,11 @@ namespace dawn_native { namespace d3d12 {
|
||||||
|
|
||||||
using DescriptorHeapInfo = std::pair<ComPtr<ID3D12DescriptorHeap>, AllocationInfo>;
|
using DescriptorHeapInfo = std::pair<ComPtr<ID3D12DescriptorHeap>, AllocationInfo>;
|
||||||
|
|
||||||
DescriptorHeapHandle Allocate(D3D12_DESCRIPTOR_HEAP_TYPE type,
|
ResultOrError<DescriptorHeapHandle> Allocate(D3D12_DESCRIPTOR_HEAP_TYPE type,
|
||||||
uint32_t count,
|
uint32_t count,
|
||||||
uint32_t allocationSize,
|
uint32_t allocationSize,
|
||||||
DescriptorHeapInfo* heapInfo,
|
DescriptorHeapInfo* heapInfo,
|
||||||
D3D12_DESCRIPTOR_HEAP_FLAGS flags);
|
D3D12_DESCRIPTOR_HEAP_FLAGS flags);
|
||||||
void Release(DescriptorHeapHandle handle);
|
void Release(DescriptorHeapHandle handle);
|
||||||
|
|
||||||
Device* mDevice;
|
Device* mDevice;
|
||||||
|
|
|
@ -22,20 +22,21 @@ namespace dawn_native { namespace d3d12 {
|
||||||
Queue::Queue(Device* device) : QueueBase(device) {
|
Queue::Queue(Device* device) : QueueBase(device) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
device->Tick();
|
device->Tick();
|
||||||
|
|
||||||
device->OpenCommandList(&mCommandList);
|
device->OpenCommandList(&mCommandList);
|
||||||
for (uint32_t i = 0; i < commandCount; ++i) {
|
for (uint32_t i = 0; i < commandCount; ++i) {
|
||||||
ToBackend(commands[i])->RecordCommands(mCommandList, i);
|
DAWN_TRY(ToBackend(commands[i])->RecordCommands(mCommandList, i));
|
||||||
}
|
}
|
||||||
ASSERT_SUCCESS(mCommandList->Close());
|
ASSERT_SUCCESS(mCommandList->Close());
|
||||||
|
|
||||||
device->ExecuteCommandList(mCommandList.Get());
|
device->ExecuteCommandList(mCommandList.Get());
|
||||||
|
|
||||||
device->NextSerial();
|
device->NextSerial();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_native::d3d12
|
}} // namespace dawn_native::d3d12
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace dawn_native { namespace d3d12 {
|
||||||
Queue(Device* device);
|
Queue(Device* device);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
||||||
|
|
||||||
ComPtr<ID3D12GraphicsCommandList> mCommandList;
|
ComPtr<ID3D12GraphicsCommandList> mCommandList;
|
||||||
};
|
};
|
||||||
|
|
|
@ -494,8 +494,9 @@ namespace dawn_native { namespace d3d12 {
|
||||||
if (GetFormat().isRenderable) {
|
if (GetFormat().isRenderable) {
|
||||||
if (GetFormat().HasDepthOrStencil()) {
|
if (GetFormat().HasDepthOrStencil()) {
|
||||||
TransitionUsageNow(commandList, D3D12_RESOURCE_STATE_DEPTH_WRITE);
|
TransitionUsageNow(commandList, D3D12_RESOURCE_STATE_DEPTH_WRITE);
|
||||||
DescriptorHeapHandle dsvHeap =
|
DescriptorHeapHandle dsvHeap;
|
||||||
descriptorHeapAllocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_DSV, 1);
|
DAWN_TRY_ASSIGN(dsvHeap, descriptorHeapAllocator->AllocateCPUHeap(
|
||||||
|
D3D12_DESCRIPTOR_HEAP_TYPE_DSV, 1));
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = dsvHeap.GetCPUHandle(0);
|
D3D12_CPU_DESCRIPTOR_HANDLE dsvHandle = dsvHeap.GetCPUHandle(0);
|
||||||
D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = GetDSVDescriptor(baseMipLevel);
|
D3D12_DEPTH_STENCIL_VIEW_DESC dsvDesc = GetDSVDescriptor(baseMipLevel);
|
||||||
device->GetD3D12Device()->CreateDepthStencilView(mResource.Get(), &dsvDesc,
|
device->GetD3D12Device()->CreateDepthStencilView(mResource.Get(), &dsvDesc,
|
||||||
|
@ -513,8 +514,9 @@ namespace dawn_native { namespace d3d12 {
|
||||||
nullptr);
|
nullptr);
|
||||||
} else {
|
} else {
|
||||||
TransitionUsageNow(commandList, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
TransitionUsageNow(commandList, D3D12_RESOURCE_STATE_RENDER_TARGET);
|
||||||
DescriptorHeapHandle rtvHeap =
|
DescriptorHeapHandle rtvHeap;
|
||||||
descriptorHeapAllocator->AllocateCPUHeap(D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 1);
|
DAWN_TRY_ASSIGN(rtvHeap, descriptorHeapAllocator->AllocateCPUHeap(
|
||||||
|
D3D12_DESCRIPTOR_HEAP_TYPE_RTV, 1));
|
||||||
D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = rtvHeap.GetCPUHandle(0);
|
D3D12_CPU_DESCRIPTOR_HANDLE rtvHandle = rtvHeap.GetCPUHandle(0);
|
||||||
const float clearColorRGBA[4] = {clearColor, clearColor, clearColor, clearColor};
|
const float clearColorRGBA[4] = {clearColor, clearColor, clearColor, clearColor};
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace dawn_native { namespace metal {
|
||||||
Queue(Device* device);
|
Queue(Device* device);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}} // namespace dawn_native::metal
|
}} // namespace dawn_native::metal
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace dawn_native { namespace metal {
|
||||||
Queue::Queue(Device* device) : QueueBase(device) {
|
Queue::Queue(Device* device) : QueueBase(device) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
device->Tick();
|
device->Tick();
|
||||||
id<MTLCommandBuffer> commandBuffer = device->GetPendingCommandBuffer();
|
id<MTLCommandBuffer> commandBuffer = device->GetPendingCommandBuffer();
|
||||||
|
@ -37,6 +37,7 @@ namespace dawn_native { namespace metal {
|
||||||
"CommandBufferMTL::FillCommands");
|
"CommandBufferMTL::FillCommands");
|
||||||
|
|
||||||
device->SubmitPendingCommandBuffer();
|
device->SubmitPendingCommandBuffer();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_native::metal
|
}} // namespace dawn_native::metal
|
||||||
|
|
|
@ -318,8 +318,9 @@ namespace dawn_native { namespace null {
|
||||||
Queue::~Queue() {
|
Queue::~Queue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Queue::SubmitImpl(uint32_t, CommandBufferBase* const*) {
|
MaybeError Queue::SubmitImpl(uint32_t, CommandBufferBase* const*) {
|
||||||
ToBackend(GetDevice())->SubmitPendingOperations();
|
ToBackend(GetDevice())->SubmitPendingOperations();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
// SwapChain
|
// SwapChain
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace dawn_native { namespace null {
|
||||||
~Queue();
|
~Queue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SwapChain : public SwapChainBase {
|
class SwapChain : public SwapChainBase {
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace dawn_native { namespace opengl {
|
||||||
Queue::Queue(Device* device) : QueueBase(device) {
|
Queue::Queue(Device* device) : QueueBase(device) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
for (uint32_t i = 0; i < commandCount; ++i) {
|
for (uint32_t i = 0; i < commandCount; ++i) {
|
||||||
|
@ -30,6 +30,7 @@ namespace dawn_native { namespace opengl {
|
||||||
}
|
}
|
||||||
|
|
||||||
device->SubmitFenceSync();
|
device->SubmitFenceSync();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_native::opengl
|
}} // namespace dawn_native::opengl
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace dawn_native { namespace opengl {
|
||||||
Queue(Device* device);
|
Queue(Device* device);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}} // namespace dawn_native::opengl
|
}} // namespace dawn_native::opengl
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
Queue::~Queue() {
|
Queue::~Queue() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
device->Tick();
|
device->Tick();
|
||||||
|
@ -37,6 +37,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
}
|
}
|
||||||
|
|
||||||
device->SubmitPendingCommands();
|
device->SubmitPendingCommands();
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
}} // namespace dawn_native::vulkan
|
}} // namespace dawn_native::vulkan
|
||||||
|
|
|
@ -28,7 +28,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
~Queue();
|
~Queue();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
MaybeError SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}} // namespace dawn_native::vulkan
|
}} // namespace dawn_native::vulkan
|
||||||
|
|
Loading…
Reference in New Issue