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