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 #ifndef DAWNNATIVE_D3D12_COMMANDBUFFERD3D12_H_ 16 #define DAWNNATIVE_D3D12_COMMANDBUFFERD3D12_H_ 17 18 #include "dawn_native/CommandBuffer.h" 19 #include "dawn_native/Error.h" 20 21 namespace dawn_native { 22 struct BeginRenderPassCmd; 23 } // namespace dawn_native 24 25 namespace dawn_native { namespace d3d12 { 26 27 class BindGroupStateTracker; 28 class CommandRecordingContext; 29 class RenderPassBuilder; 30 31 class CommandBuffer final : public CommandBufferBase { 32 public: 33 static Ref<CommandBuffer> Create(CommandEncoder* encoder, 34 const CommandBufferDescriptor* descriptor); 35 36 MaybeError RecordCommands(CommandRecordingContext* commandContext); 37 38 private: 39 CommandBuffer(CommandEncoder* encoder, const CommandBufferDescriptor* descriptor); 40 41 MaybeError RecordComputePass(CommandRecordingContext* commandContext, 42 BindGroupStateTracker* bindingTracker, 43 const ComputePassResourceUsage& resourceUsages); 44 MaybeError RecordRenderPass(CommandRecordingContext* commandContext, 45 BindGroupStateTracker* bindingTracker, 46 BeginRenderPassCmd* renderPass, 47 bool passHasUAV); 48 MaybeError SetupRenderPass(CommandRecordingContext* commandContext, 49 BeginRenderPassCmd* renderPass, 50 RenderPassBuilder* renderPassBuilder); 51 void EmulateBeginRenderPass(CommandRecordingContext* commandContext, 52 const RenderPassBuilder* renderPassBuilder) const; 53 }; 54 55 }} // namespace dawn_native::d3d12 56 57 #endif // DAWNNATIVE_D3D12_COMMANDBUFFERD3D12_H_ 58