Jim Van Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 1 | /* |
Jim Van Verth | 03b8ab2 | 2020-02-24 11:36:15 -0500 | [diff] [blame] | 2 | * Copyright 2020 Google LLC |
Jim Van Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 3 | * |
| 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 Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 8 | #include "src/gpu/d3d/GrD3DGpu.h" |
| 9 | |
Greg Daniel | 31a7b07 | 2020-02-26 15:31:49 -0500 | [diff] [blame] | 10 | #include "src/gpu/d3d/GrD3DCaps.h" |
| 11 | #include "src/gpu/d3d/GrD3DOpsRenderPass.h" |
| 12 | |
Jim Van Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 13 | sk_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 | |
| 18 | GrD3DGpu::GrD3DGpu(GrContext* context, const GrContextOptions& contextOptions, |
| 19 | const GrD3DBackendContext& backendContext) |
Jim Van Verth | 03b8ab2 | 2020-02-24 11:36:15 -0500 | [diff] [blame] | 20 | : INHERITED(context) |
| 21 | , fDevice(backendContext.fDevice) |
Greg Daniel | 02c4590 | 2020-03-09 10:58:09 -0400 | [diff] [blame^] | 22 | |
| 23 | , fQueue(backendContext.fQueue) |
| 24 | , fResourceProvider(this) { |
Jim Van Verth | 8ec1330 | 2020-02-26 12:59:56 -0500 | [diff] [blame] | 25 | fCaps.reset(new GrD3DCaps(contextOptions, |
| 26 | backendContext.fAdapter.Get(), |
| 27 | backendContext.fDevice.Get())); |
Jim Van Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 28 | } |
| 29 | |
Greg Daniel | 31a7b07 | 2020-02-26 15:31:49 -0500 | [diff] [blame] | 30 | GrD3DGpu::~GrD3DGpu() {} |
| 31 | |
Jim Van Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 32 | GrOpsRenderPass* GrD3DGpu::getOpsRenderPass( |
| 33 | GrRenderTarget* rt, GrSurfaceOrigin origin, const SkIRect& bounds, |
| 34 | const GrOpsRenderPass::LoadAndStoreInfo& colorInfo, |
Greg Daniel | 31a7b07 | 2020-02-26 15:31:49 -0500 | [diff] [blame] | 35 | const GrOpsRenderPass::StencilLoadAndStoreInfo& stencilInfo, |
Jim Van Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 36 | const SkTArray<GrSurfaceProxy*, true>& sampledProxies) { |
Greg Daniel | 31a7b07 | 2020-02-26 15:31:49 -0500 | [diff] [blame] | 37 | 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 Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | void GrD3DGpu::submit(GrOpsRenderPass* renderPass) { |
| 48 | // TODO: actually submit something here |
| 49 | delete renderPass; |
| 50 | } |
| 51 | |
| 52 | void GrD3DGpu::querySampleLocations(GrRenderTarget* rt, SkTArray<SkPoint>* sampleLocations) { |
| 53 | // TODO |
| 54 | } |
| 55 | |
| 56 | sk_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 | |
| 68 | sk_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 | |
| 78 | sk_sp<GrTexture> GrD3DGpu::onWrapBackendTexture(const GrBackendTexture& tex, GrColorType colorType, |
| 79 | GrWrapOwnership ownership, |
| 80 | GrWrapCacheable wrapType, GrIOType ioType) { |
| 81 | // TODO |
| 82 | return nullptr; |
| 83 | } |
| 84 | |
| 85 | sk_sp<GrTexture> GrD3DGpu::onWrapCompressedBackendTexture(const GrBackendTexture& tex, |
| 86 | GrWrapOwnership ownership, |
| 87 | GrWrapCacheable wrapType) { |
| 88 | return nullptr; |
| 89 | } |
| 90 | |
| 91 | sk_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 | |
| 100 | sk_sp<GrRenderTarget> GrD3DGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt, |
| 101 | GrColorType colorType) { |
| 102 | // TODO |
| 103 | return nullptr; |
| 104 | } |
| 105 | |
| 106 | sk_sp<GrRenderTarget> GrD3DGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex, |
| 107 | int sampleCnt, |
| 108 | GrColorType colorType) { |
| 109 | // TODO |
| 110 | return nullptr; |
| 111 | } |
| 112 | |
| 113 | sk_sp<GrGpuBuffer> GrD3DGpu::onCreateBuffer(size_t sizeInBytes, GrGpuBufferType type, |
| 114 | GrAccessPattern accessPattern, const void*) { |
| 115 | // TODO |
| 116 | return nullptr; |
| 117 | } |
| 118 | |
| 119 | GrStencilAttachment* GrD3DGpu::createStencilAttachmentForRenderTarget( |
| 120 | const GrRenderTarget* rt, int width, int height, int numStencilSamples) { |
| 121 | // TODO |
| 122 | return nullptr; |
| 123 | } |
| 124 | |
| 125 | GrBackendTexture 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 | |
| 135 | GrBackendTexture GrD3DGpu::onCreateCompressedBackendTexture(SkISize dimensions, |
| 136 | const GrBackendFormat& format, |
| 137 | GrMipMapped mipMapped, |
| 138 | GrProtected, |
| 139 | const BackendTextureData*) { |
| 140 | // TODO |
| 141 | return GrBackendTexture(); |
| 142 | } |
| 143 | |
| 144 | void GrD3DGpu::deleteBackendTexture(const GrBackendTexture& tex) { |
| 145 | // TODO |
| 146 | } |
| 147 | |
Robert Phillips | 979b223 | 2020-02-20 10:47:29 -0500 | [diff] [blame] | 148 | bool GrD3DGpu::compile(const GrProgramDesc&, const GrProgramInfo&) { |
| 149 | return false; |
| 150 | } |
| 151 | |
Jim Van Verth | d2d4c5e | 2020-02-19 14:57:58 -0500 | [diff] [blame] | 152 | #if GR_TEST_UTILS |
| 153 | bool GrD3DGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { |
| 154 | // TODO |
| 155 | return false; |
| 156 | } |
| 157 | |
| 158 | GrBackendRenderTarget GrD3DGpu::createTestingOnlyBackendRenderTarget(int w, int h, |
| 159 | GrColorType colorType) { |
| 160 | // TODO |
| 161 | return GrBackendRenderTarget(); |
| 162 | } |
| 163 | |
| 164 | void GrD3DGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) {} |
| 165 | #endif |