• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The Dawn Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include "dawn_native/d3d12/QueueD3D12.h"
16 
17 #include "common/Math.h"
18 #include "dawn_native/CommandValidation.h"
19 #include "dawn_native/Commands.h"
20 #include "dawn_native/DynamicUploader.h"
21 #include "dawn_native/d3d12/CommandBufferD3D12.h"
22 #include "dawn_native/d3d12/D3D12Error.h"
23 #include "dawn_native/d3d12/DeviceD3D12.h"
24 #include "dawn_platform/DawnPlatform.h"
25 #include "dawn_platform/tracing/TraceEvent.h"
26 
27 namespace dawn_native { namespace d3d12 {
28 
Queue(Device * device)29     Queue::Queue(Device* device) : QueueBase(device) {
30     }
31 
SubmitImpl(uint32_t commandCount,CommandBufferBase * const * commands)32     MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) {
33         Device* device = ToBackend(GetDevice());
34 
35         DAWN_TRY(device->Tick());
36 
37         CommandRecordingContext* commandContext;
38         DAWN_TRY_ASSIGN(commandContext, device->GetPendingCommandContext());
39 
40         TRACE_EVENT_BEGIN0(GetDevice()->GetPlatform(), Recording,
41                            "CommandBufferD3D12::RecordCommands");
42         for (uint32_t i = 0; i < commandCount; ++i) {
43             DAWN_TRY(ToBackend(commands[i])->RecordCommands(commandContext));
44         }
45         TRACE_EVENT_END0(GetDevice()->GetPlatform(), Recording,
46                          "CommandBufferD3D12::RecordCommands");
47 
48         DAWN_TRY(device->ExecutePendingCommandContext());
49 
50         DAWN_TRY(device->NextSerial());
51         return {};
52     }
53 
54 }}  // namespace dawn_native::d3d12
55