• 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 #ifndef DAWNNATIVE_D3D12_RENDERPIPELINED3D12_H_
16 #define DAWNNATIVE_D3D12_RENDERPIPELINED3D12_H_
17 
18 #include "dawn_native/RenderPipeline.h"
19 
20 #include "dawn_native/d3d12/ShaderModuleD3D12.h"
21 #include "dawn_native/d3d12/d3d12_platform.h"
22 
23 namespace dawn_native { namespace d3d12 {
24 
25     class Device;
26 
27     class RenderPipeline final : public RenderPipelineBase {
28       public:
29         static Ref<RenderPipeline> CreateUninitialized(Device* device,
30                                                        const RenderPipelineDescriptor* descriptor);
31         static void InitializeAsync(Ref<RenderPipelineBase> renderPipeline,
32                                     WGPUCreateRenderPipelineAsyncCallback callback,
33                                     void* userdata);
34         RenderPipeline() = delete;
35 
36         MaybeError Initialize() override;
37 
38         D3D12_PRIMITIVE_TOPOLOGY GetD3D12PrimitiveTopology() const;
39         ID3D12PipelineState* GetPipelineState() const;
40 
41         const FirstOffsetInfo& GetFirstOffsetInfo() const;
42 
43         // Dawn API
44         void SetLabelImpl() override;
45 
46       private:
47         ~RenderPipeline() override;
48 
49         void DestroyImpl() override;
50 
51         using RenderPipelineBase::RenderPipelineBase;
52         D3D12_INPUT_LAYOUT_DESC ComputeInputLayout(
53             std::array<D3D12_INPUT_ELEMENT_DESC, kMaxVertexAttributes>* inputElementDescriptors);
54 
55         D3D12_PRIMITIVE_TOPOLOGY mD3d12PrimitiveTopology;
56         ComPtr<ID3D12PipelineState> mPipelineState;
57         FirstOffsetInfo mFirstOffsetInfo;
58     };
59 
60 }}  // namespace dawn_native::d3d12
61 
62 #endif  // DAWNNATIVE_D3D12_RENDERPIPELINED3D12_H_
63