| 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 GrD3DTypesMinimal_DEFINED |
| 9 |
#define GrD3DTypesMinimal_DEFINED |
| 10 |
|
| 11 |
// Minimal definitions of Direct3D types, without including d3d12.h |
| 12 |
|
| 13 |
#include "include/core/SkRefCnt.h" |
| 14 |
|
| 15 |
#include <dxgiformat.h> |
| 16 |
#include <memory> |
| 17 |
|
| 18 |
#include "include/gpu/ganesh/GrTypes.h" |
| 19 |
|
| 20 |
struct ID3D12Resource; |
| 21 |
class GrD3DResourceState; |
| 22 |
typedef int GrD3DResourceStateEnum; |
| 23 |
struct GrD3DSurfaceInfo; |
| 24 |
struct GrD3DTextureResourceInfo; |
| 25 |
struct GrD3DTextureResourceSpec; |
| 26 |
struct GrD3DFenceInfo; |
| 27 |
|
| 28 |
// This struct is to used to store the the actual information about the Direct3D backend image on |
| 29 |
// GrBackendTexture and GrBackendRenderTarget. When a client calls getD3DTextureInfo on a |
| 30 |
// GrBackendTexture/RenderTarget, we use the GrD3DBackendSurfaceInfo to create a snapshot |
| 31 |
// GrD3DTextureResourceInfo object. Internally, this uses a ref count GrD3DResourceState object to |
| 32 |
// track the current D3D12_RESOURCE_STATES which can be shared with an internal GrD3DTextureResource |
| 33 |
// so that state updates can be seen by all users of the texture. |
| 34 |
struct GrD3DBackendSurfaceInfo { |
| 35 |
GrD3DBackendSurfaceInfo(); |
| 36 |
GrD3DBackendSurfaceInfo(const GrD3DTextureResourceInfo& info, sk_sp<GrD3DResourceState> state); |
| 37 |
~GrD3DBackendSurfaceInfo(); |
| 38 |
|
| 39 |
GrD3DBackendSurfaceInfo(const GrD3DBackendSurfaceInfo&); |
| 40 |
GrD3DBackendSurfaceInfo& operator=(const GrD3DBackendSurfaceInfo&); |
| 41 |
|
| 42 |
GrD3DBackendSurfaceInfo(GrD3DBackendSurfaceInfo&&); |
| 43 |
GrD3DBackendSurfaceInfo& operator=(GrD3DBackendSurfaceInfo&&); |
| 44 |
|
| 45 |
void setResourceState(GrD3DResourceStateEnum state); |
| 46 |
|
| 47 |
sk_sp<GrD3DResourceState> getGrD3DResourceState() const; |
| 48 |
|
| 49 |
GrD3DTextureResourceInfo snapTextureResourceInfo() const; |
| 50 |
|
| 51 |
bool isProtected() const; |
| 52 |
#if defined(GPU_TEST_UTILS) |
| 53 |
bool operator==(const GrD3DBackendSurfaceInfo& that) const; |
| 54 |
#endif |
| 55 |
|
| 56 |
private: |
| 57 |
std::unique_ptr<GrD3DTextureResourceInfo> fTextureResourceInfo; |
| 58 |
sk_sp<GrD3DResourceState> fResourceState; |
| 59 |
}; |
| 60 |
|
| 61 |
#endif |