blob: 8299fe6d12aec85adf3283f0ac384a7706c64661 [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()));
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050028}
29
Greg Daniel31a7b072020-02-26 15:31:49 -050030GrD3DGpu::~GrD3DGpu() {}
31
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050032GrOpsRenderPass* GrD3DGpu::getOpsRenderPass(
33 GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds,
34 const GrOpsRenderPass::LoadAndStoreInfo& colorInfo,
Greg Daniel31a7b072020-02-26 15:31:49 -050035 const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo,
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050036 const SkTArray<GrSurfaceProxy*, true>& sampledProxies) {
Greg Daniel31a7b072020-02-26 15:31:49 -050037 if (!fCachedOpsRenderPass) {
38 fCachedOpsRenderPass.reset(new GrD3DOpsRenderPass(this));
39 }
40
41 if (!fCachedOpsRenderPass->set(rt, origin, bounds, colorInfo, stencilInfo, sampledProxies)) {
42 return nullptr;
43 }
44 return fCachedOpsRenderPass.get();
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -050045}
46
47void GrD3DGpu::submit(GrOpsRenderPass* renderPass) {
48 // TODO: actually submit something here
49 delete renderPass;
50}
51
52void GrD3DGpu::querySampleLocations(GrRenderTarget* rt, SkTArray<SkPoint>* sampleLocations) {
53 // TODO
54}
55
56sk_sp<GrTexture> GrD3DGpu::onCreateTexture(SkISize dimensions,
57 const GrBackendFormat& format,
58 GrRenderable renderable,
59 int renderTargetSampleCnt,
60 SkBudgeted budgeted,
61 GrProtected isProtected,
62 int mipLevelCount,
63 uint32_t levelClearMask) {
64 // TODO
65 return nullptr;
66}
67
68sk_sp<GrTexture> GrD3DGpu::onCreateCompressedTexture(SkISize dimensions,
69 const GrBackendFormat& format,
70 SkBudgeted budgeted,
71 GrMipMapped mipMapped,
72 GrProtected isProtected,
73 const void* data, size_t dataSize) {
74 // TODO
75 return nullptr;
76}
77
78sk_sp<GrTexture> GrD3DGpu::onWrapBackendTexture(const GrBackendTexture& tex, GrColorType colorType,
79 GrWrapOwnership ownership,
80 GrWrapCacheable wrapType, GrIOType ioType) {
81 // TODO
82 return nullptr;
83}
84
85sk_sp<GrTexture> GrD3DGpu::onWrapCompressedBackendTexture(const GrBackendTexture& tex,
86 GrWrapOwnership ownership,
87 GrWrapCacheable wrapType) {
88 return nullptr;
89}
90
91sk_sp<GrTexture> GrD3DGpu::onWrapRenderableBackendTexture(const GrBackendTexture& tex,
92 int sampleCnt,
93 GrColorType colorType,
94 GrWrapOwnership ownership,
95 GrWrapCacheable cacheable) {
96 // TODO
97 return nullptr;
98}
99
100sk_sp<GrRenderTarget> GrD3DGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt,
101 GrColorType colorType) {
102 // TODO
103 return nullptr;
104}
105
106sk_sp<GrRenderTarget> GrD3DGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
107 int sampleCnt,
108 GrColorType colorType) {
109 // TODO
110 return nullptr;
111}
112
113sk_sp<GrGpuBuffer> GrD3DGpu::onCreateBuffer(size_t sizeInBytes, GrGpuBufferType type,
114 GrAccessPattern accessPattern, const void*) {
115 // TODO
116 return nullptr;
117}
118
119GrStencilAttachment* GrD3DGpu::createStencilAttachmentForRenderTarget(
120 const GrRenderTarget* rt, int width, int height, int numStencilSamples) {
121 // TODO
122 return nullptr;
123}
124
125GrBackendTexture GrD3DGpu::onCreateBackendTexture(SkISize dimensions,
126 const GrBackendFormat& format,
127 GrRenderable,
128 GrMipMapped mipMapped,
129 GrProtected,
130 const BackendTextureData*) {
131 // TODO
132 return GrBackendTexture();
133}
134
135GrBackendTexture GrD3DGpu::onCreateCompressedBackendTexture(SkISize dimensions,
136 const GrBackendFormat& format,
137 GrMipMapped mipMapped,
138 GrProtected,
139 const BackendTextureData*) {
140 // TODO
141 return GrBackendTexture();
142}
143
144void GrD3DGpu::deleteBackendTexture(const GrBackendTexture& tex) {
145 // TODO
146}
147
Robert Phillips979b2232020-02-20 10:47:29 -0500148bool GrD3DGpu::compile(const GrProgramDesc&, const GrProgramInfo&) {
149 return false;
150}
151
Jim Van Verthd2d4c5e2020-02-19 14:57:58 -0500152#if GR_TEST_UTILS
153bool GrD3DGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
154 // TODO
155 return false;
156}
157
158GrBackendRenderTarget GrD3DGpu::createTestingOnlyBackendRenderTarget(int w, int h,
159 GrColorType colorType) {
160 // TODO
161 return GrBackendRenderTarget();
162}
163
164void GrD3DGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) {}
165#endif