Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrD3DTexture.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google LLC
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
8#ifndef GrD3DTexture_DEFINED
9#define GrD3DTexture_DEFINED
10
12#include "src/core/SkLRUCache.h"
17
18class GrD3DTexture : public GrTexture, public virtual GrD3DTextureResource {
19public:
23 const D3D12_RESOURCE_DESC&,
26 std::string_view label);
27
34
37 const D3D12_RESOURCE_DESC& newDesc,
38 D3D12_RESOURCE_STATES);
39
40 ~GrD3DTexture() override {}
41
42 GrBackendTexture getBackendTexture() const override;
43
44 GrBackendFormat backendFormat() const override { return this->getBackendFormat(); }
45 D3D12_CPU_DESCRIPTOR_HANDLE shaderResourceView() { return fShaderResourceView.fHandle; }
46
47 void textureParamsModified() override {}
48
49protected:
56 std::string_view label);
57
58 GrD3DGpu* getD3DGpu() const;
59
60 void onAbandon() override;
61 void onRelease() override;
62
66
67 void onSetLabel() override;
68
69private:
77 std::string_view label);
84 std::string_view label);
85
86 // In D3D we call the release proc after we are finished with the underlying
87 // GrSurfaceResource::Resource object (which occurs after the GPU has finished all work on it).
88 void onSetRelease(sk_sp<RefCntedReleaseProc> releaseHelper) override {
89 // Forward the release proc on to GrSurfaceResource
90 this->setResourceRelease(std::move(releaseHelper));
91 }
92
93 struct SamplerHash {
94 uint32_t operator()(GrSamplerState state) const {
95 // In D3D anisotropic filtering uses the same field (D3D12_SAMPLER_DESC::Filter) as
96 // min/mag/mip settings and so is not orthogonal to them.
97 return state.asKey(/*anisoIsOrthogonal=*/false);
98 }
99 };
100
101 GrD3DDescriptorHeap::CPUHandle fShaderResourceView;
102
103 using INHERITED = GrTexture;
104};
105
106#endif
GrWrapCacheable
Definition GrTypesPriv.h:84
GrIOType
GrMipmapStatus
GrBackendFormat getBackendFormat() const
void setResourceRelease(sk_sp< GrSurface::RefCntedReleaseProc > releaseHelper)
GrD3DGpu * getD3DGpu() const
void onRelease() override
void onSetRelease(sk_sp< RefCntedReleaseProc > releaseHelper) override
static sk_sp< GrD3DTexture > MakeNewTexture(GrD3DGpu *, skgpu::Budgeted, SkISize dimensions, const D3D12_RESOURCE_DESC &, GrProtected, GrMipmapStatus, std::string_view label)
static sk_sp< GrD3DTexture > MakeAliasingTexture(GrD3DGpu *, sk_sp< GrD3DTexture >, const D3D12_RESOURCE_DESC &newDesc, D3D12_RESOURCE_STATES)
GrBackendTexture getBackendTexture() const override
~GrD3DTexture() override
static sk_sp< GrD3DTexture > MakeWrappedTexture(GrD3DGpu *, SkISize dimensions, GrWrapCacheable, GrIOType, const GrD3DTextureResourceInfo &, sk_sp< GrD3DResourceState >)
D3D12_CPU_DESCRIPTOR_HANDLE shaderResourceView()
void onSetLabel() override
void textureParamsModified() override
void onAbandon() override
bool onStealBackendTexture(GrBackendTexture *, SkImages::BackendTextureReleaseProc *) override
GrBackendFormat backendFormat() const override
SkISize dimensions() const
Definition GrSurface.h:27
AtkStateType state
std::function< void(GrBackendTexture)> BackendTextureReleaseProc
Budgeted
Definition GpuTypes.h:35
Protected
Definition GpuTypes.h:61
D3D12_CPU_DESCRIPTOR_HANDLE fHandle