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