blob: 6ac87a5fc958996a69ab25f10262330ea7ce41f5 [file] [log] [blame]
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -05001/*
Jim Van Verth03b8ab22020-02-24 11:36:15 -05002 * Copyright 2020 Google LLC
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -05003 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -05008#include "src/gpu/d3d/GrD3DGpu.h"
9
Greg Daniel31a7b072020-02-26 15:31:49 -050010#include "src/gpu/d3d/GrD3DCaps.h"
11#include "src/gpu/d3d/GrD3DOpsRenderPass.h"
12
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050013sk_sp<GrGpu> GrD3DGpu::Make(const GrD3DBackendContext& backendContext,
14 const GrContextOptions& contextOptions, GrContext* context) {
15 return sk_sp<GrGpu>(new GrD3DGpu(context, contextOptions, backendContext));
16}
17
18GrD3DGpu::GrD3DGpu(GrContext* context, const GrContextOptions& contextOptions,
19 const GrD3DBackendContext& backendContext)
Jim Van Verth03b8ab22020-02-24 11:36:15 -050020 : INHERITED(context)
21 , fDevice(backendContext.fDevice)
Greg Daniel02c45902020-03-09 10:58:09 -040022
23 , fQueue(backendContext.fQueue)
24 , fResourceProvider(this) {
Jim Van Verth8ec13302020-02-26 12:59:56 -050025 fCaps.reset(new GrD3DCaps(contextOptions,
26 backendContext.fAdapter.Get(),
27 backendContext.fDevice.Get()));
Greg Daniel85da3362020-03-09 15:18:35 -040028
29 fCurrentDirectCommandList = fResourceProvider.findOrCreateDirectCommandList();
Greg Daniele52c9782020-03-23 14:18:37 -040030 SkASSERT(fCurrentDirectCommandList);
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050031}
32
Greg Daniel31a7b072020-02-26 15:31:49 -050033GrD3DGpu::~GrD3DGpu() {}
34
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050035GrOpsRenderPass* GrD3DGpu::getOpsRenderPass(
36 GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
37 const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
Greg Daniel31a7b072020-02-26 15:31:49 -050038 const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo,
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050039 const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
Greg Daniel31a7b072020-02-26 15:31:49 -050040 if (!fCachedOpsRenderPass) {
41 fCachedOpsRenderPass.reset(new GrD3DOpsRenderPass(this));
42 }
43
44 if (!fCachedOpsRenderPass->set(rt, origin, bounds, colorInfo, stencilInfo, sampledProxies)) {
45 return nullptr;
46 }
47 return fCachedOpsRenderPass.get();
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050048}
49
50void GrD3DGpu::submit(GrOpsRenderPass* renderPass) {
51 // TODO: actually submit something here
52 delete renderPass;
53}
54
55void GrD3DGpu::querySampleLocations(GrRenderTarget* rt, SkTArray<SkPoint>* sampleLocations) {
56 // TODO
57}
58
59sk_sp<GrTexture> GrD3DGpu::onCreateTexture(SkISize dimensions,
60 const GrBackendFormat& format,
61 GrRenderable renderable,
62 int renderTargetSampleCnt,
63 SkBudgeted budgeted,
64 GrProtected isProtected,
65 int mipLevelCount,
66 uint32_t levelClearMask) {
67 // TODO
68 return nullptr;
69}
70
71sk_sp<GrTexture> GrD3DGpu::onCreateCompressedTexture(SkISize dimensions,
72 const GrBackendFormat& format,
73 SkBudgeted budgeted,
74 GrMipMapped mipMapped,
75 GrProtected isProtected,
76 const void* data, size_t dataSize) {
77 // TODO
78 return nullptr;
79}
80
81sk_sp<GrTexture> GrD3DGpu::onWrapBackendTexture(const GrBackendTexture& tex, GrColorType colorType,
82 GrWrapOwnership ownership,
83 GrWrapCacheable wrapType, GrIOType ioType) {
84 // TODO
85 return nullptr;
86}
87
88sk_sp<GrTexture> GrD3DGpu::onWrapCompressedBackendTexture(const GrBackendTexture& tex,
89 GrWrapOwnership ownership,
90 GrWrapCacheable wrapType) {
91 return nullptr;
92}
93
94sk_sp<GrTexture> GrD3DGpu::onWrapRenderableBackendTexture(const GrBackendTexture& tex,
95 int sampleCnt,
96 GrColorType colorType,
97 GrWrapOwnership ownership,
98 GrWrapCacheable cacheable) {
99 // TODO
100 return nullptr;
101}
102
103sk_sp<GrRenderTarget> GrD3DGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt,
104 GrColorType colorType) {
105 // TODO
106 return nullptr;
107}
108
109sk_sp<GrRenderTarget> GrD3DGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
110 int sampleCnt,
111 GrColorType colorType) {
112 // TODO
113 return nullptr;
114}
115
116sk_sp<GrGpuBuffer> GrD3DGpu::onCreateBuffer(size_t sizeInBytes, GrGpuBufferType type,
117 GrAccessPattern accessPattern, const void*) {
118 // TODO
119 return nullptr;
120}
121
122GrStencilAttachment* GrD3DGpu::createStencilAttachmentForRenderTarget(
123 const GrRenderTarget* rt, int width, int height, int numStencilSamples) {
124 // TODO
125 return nullptr;
126}
127
128GrBackendTexture GrD3DGpu::onCreateBackendTexture(SkISize dimensions,
129 const GrBackendFormat& format,
130 GrRenderable,
131 GrMipMapped mipMapped,
132 GrProtected,
133 const BackendTextureData*) {
134 // TODO
135 return GrBackendTexture();
136}
137
138GrBackendTexture GrD3DGpu::onCreateCompressedBackendTexture(SkISize dimensions,
139 const GrBackendFormat& format,
140 GrMipMapped mipMapped,
141 GrProtected,
142 const BackendTextureData*) {
143 // TODO
144 return GrBackendTexture();
145}
146
147void GrD3DGpu::deleteBackendTexture(const GrBackendTexture& tex) {
148 // TODO
149}
150
Robert Phillips979b2232020-02-20 10:47:29 -0500151bool GrD3DGpu::compile(const GrProgramDesc&, const GrProgramInfo&) {
152 return false;
153}
154
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -0500155#if GR_TEST_UTILS
156bool GrD3DGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
157 // TODO
158 return false;
159}
160
161GrBackendRenderTarget GrD3DGpu::createTestingOnlyBackendRenderTarget(int w, int h,
162 GrColorType colorType) {
163 // TODO
164 return GrBackendRenderTarget();
165}
166
167void GrD3DGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) {}
168#endif