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