| 15 | } |
| 16 | |
| 17 | CommandQueue::CommandQueue(WMT::Device device) : |
| 18 | encodeThread([this]() { this->EncodingThread(); }), |
| 19 | finishThread([this]() { this->WaitForFinishThread(); }), |
| 20 | device(device), |
| 21 | commandQueue(device.newCommandQueue(kCommandChunkCount)), |
| 22 | shared_event_listener(SharedEventListener_create()), |
| 23 | event_listener_thread([this]() { SharedEventListener_start(this->shared_event_listener); }), |
| 24 | staging_allocator({ |
| 25 | device, WMTResourceOptionCPUCacheModeWriteCombined | WMTResourceHazardTrackingModeUntracked | |
| 26 | WMTResourceStorageModeManaged, false |
| 27 | }), |
| 28 | copy_temp_allocator({device, WMTResourceHazardTrackingModeUntracked | WMTResourceStorageModePrivate}), |
| 29 | argbuf_allocator({ |
| 30 | device, |
| 31 | WMTResourceHazardTrackingModeUntracked | WMTResourceCPUCacheModeWriteCombined | WMTResourceStorageModeShared |
| 32 | }), |
| 33 | cpu_command_allocator({}), |
| 34 | reftracker_storage_allocator({}), |
| 35 | cmd_library(device), |
| 36 | argument_encoding_ctx(*this, device, cmd_library), |
| 37 | initializer(device) { |
| 38 | for (unsigned i = 0; i < kCommandChunkCount; i++) { |
| 39 | auto &chunk = chunks[i]; |
| 40 | chunk.queue = this; |
| 41 | chunk.reset(); |
| 42 | }; |
| 43 | event = device.newSharedEvent(); |
| 44 | |
| 45 | std::string env = env::getEnvVar("DXMT_CAPTURE_FRAME"); |
| 46 | |
| 47 | if (!env.empty()) { |
| 48 | try { |
| 49 | capture_state.scheduleNextFrameCapture(std::stoull(env)); |
| 50 | } catch (const std::invalid_argument &) { |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | CommandQueue::~CommandQueue() { |
| 56 | TRACE("Destructing command queue"); |
nothing calls this directly
no test coverage detected