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