1 // Copyright 2018 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/vulkan/QueueVk.h" 16 17 #include "common/Math.h" 18 #include "dawn_native/Buffer.h" 19 #include "dawn_native/CommandValidation.h" 20 #include "dawn_native/Commands.h" 21 #include "dawn_native/DynamicUploader.h" 22 #include "dawn_native/vulkan/CommandBufferVk.h" 23 #include "dawn_native/vulkan/CommandRecordingContext.h" 24 #include "dawn_native/vulkan/DeviceVk.h" 25 #include "dawn_platform/DawnPlatform.h" 26 #include "dawn_platform/tracing/TraceEvent.h" 27 28 namespace dawn_native { namespace vulkan { 29 30 // static Create(Device * device)31 Queue* Queue::Create(Device* device) { 32 return new Queue(device); 33 } 34 Queue(Device * device)35 Queue::Queue(Device* device) : QueueBase(device) { 36 } 37 ~Queue()38 Queue::~Queue() { 39 } 40 SubmitImpl(uint32_t commandCount,CommandBufferBase * const * commands)41 MaybeError Queue::SubmitImpl(uint32_t commandCount, CommandBufferBase* const* commands) { 42 Device* device = ToBackend(GetDevice()); 43 44 DAWN_TRY(device->Tick()); 45 46 TRACE_EVENT_BEGIN0(GetDevice()->GetPlatform(), Recording, 47 "CommandBufferVk::RecordCommands"); 48 CommandRecordingContext* recordingContext = device->GetPendingRecordingContext(); 49 for (uint32_t i = 0; i < commandCount; ++i) { 50 DAWN_TRY(ToBackend(commands[i])->RecordCommands(recordingContext)); 51 } 52 TRACE_EVENT_END0(GetDevice()->GetPlatform(), Recording, "CommandBufferVk::RecordCommands"); 53 54 DAWN_TRY(device->SubmitPendingCommands()); 55 56 return {}; 57 } 58 59 }} // namespace dawn_native::vulkan 60