Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions | Variables
GrD3DGpu.cpp File Reference
#include "src/gpu/ganesh/d3d/GrD3DGpu.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkTextureCompressionType.h"
#include "include/gpu/GrBackendSurface.h"
#include "include/gpu/d3d/GrD3DBackendContext.h"
#include "src/base/SkRectMemcpy.h"
#include "src/core/SkCompressedDataUtils.h"
#include "src/core/SkMipmap.h"
#include "src/gpu/ganesh/GrBackendUtils.h"
#include "src/gpu/ganesh/GrDataUtils.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrImageInfo.h"
#include "src/gpu/ganesh/GrResourceProvider.h"
#include "src/gpu/ganesh/GrTexture.h"
#include "src/gpu/ganesh/GrThreadSafePipelineBuilder.h"
#include "src/gpu/ganesh/d3d/GrD3DAMDMemoryAllocator.h"
#include "src/gpu/ganesh/d3d/GrD3DAttachment.h"
#include "src/gpu/ganesh/d3d/GrD3DBuffer.h"
#include "src/gpu/ganesh/d3d/GrD3DCaps.h"
#include "src/gpu/ganesh/d3d/GrD3DOpsRenderPass.h"
#include "src/gpu/ganesh/d3d/GrD3DSemaphore.h"
#include "src/gpu/ganesh/d3d/GrD3DTexture.h"
#include "src/gpu/ganesh/d3d/GrD3DTextureRenderTarget.h"
#include "src/gpu/ganesh/d3d/GrD3DUtil.h"
#include "src/sksl/SkSLCompiler.h"

Go to the source code of this file.

Functions

static void copy_compressed_data (char *mapPtr, DXGI_FORMAT dxgiFormat, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *placedFootprints, UINT *numRows, UINT64 *rowSizeInBytes, const void *compressedData, int numMipLevels)
 
static int get_surface_sample_cnt (GrSurface *surf)
 
static bool check_resource_info (const GrD3DTextureResourceInfo &info)
 
static bool check_tex_resource_info (const GrD3DCaps &caps, const GrD3DTextureResourceInfo &info)
 
static bool check_rt_resource_info (const GrD3DCaps &caps, const GrD3DTextureResourceInfo &info, int sampleCnt)
 
static bool is_odd (int x)
 
static bool is_bgra (DXGI_FORMAT format)
 
static bool copy_color_data (const GrD3DCaps &caps, char *mapPtr, DXGI_FORMAT dxgiFormat, SkISize dimensions, D3D12_PLACED_SUBRESOURCE_FOOTPRINT *placedFootprints, std::array< float, 4 > color)
 

Variables

static const int kDefaultOutstandingAllocCnt = 8
 
constexpr int kConstantAlignment = 256
 

Function Documentation

◆ check_resource_info()

static bool check_resource_info ( const GrD3DTextureResourceInfo info)
static

Definition at line 961 of file GrD3DGpu.cpp.

961 {
962 if (!info.fResource.get()) {
963 return false;
964 }
965 return true;
966}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213

◆ check_rt_resource_info()

static bool check_rt_resource_info ( const GrD3DCaps caps,
const GrD3DTextureResourceInfo info,
int  sampleCnt 
)
static

Definition at line 979 of file GrD3DGpu.cpp.

980 {
981 if (!caps.isFormatRenderable(info.fFormat, sampleCnt)) {
982 return false;
983 }
984 return true;
985}
bool isFormatRenderable(const GrBackendFormat &format, int sampleCount) const override

◆ check_tex_resource_info()

static bool check_tex_resource_info ( const GrD3DCaps caps,
const GrD3DTextureResourceInfo info 
)
static

Definition at line 968 of file GrD3DGpu.cpp.

968 {
969 if (!caps.isFormatTexturable(info.fFormat)) {
970 return false;
971 }
972 // We don't support sampling from multisampled textures.
973 if (info.fSampleCount != 1) {
974 return false;
975 }
976 return true;
977}
bool isFormatTexturable(const GrBackendFormat &, GrTextureType) const override

◆ copy_color_data()

static bool copy_color_data ( const GrD3DCaps caps,
char *  mapPtr,
DXGI_FORMAT  dxgiFormat,
SkISize  dimensions,
D3D12_PLACED_SUBRESOURCE_FOOTPRINT *  placedFootprints,
std::array< float, 4 >  color 
)
static

Definition at line 1434 of file GrD3DGpu.cpp.

1439 {
1440 auto colorType = caps.getFormatColorType(dxgiFormat);
1442 return false;
1443 }
1444 GrImageInfo ii(colorType, kUnpremul_SkAlphaType, nullptr, dimensions);
1445 if (!GrClearImage(ii, mapPtr, placedFootprints[0].Footprint.RowPitch, color)) {
1446 return false;
1447 }
1448
1449 return true;
1450}
bool GrClearImage(const GrImageInfo &dstInfo, void *dst, size_t dstRB, std::array< float, 4 > color)
SkColor4f color
kUnpremul_SkAlphaType
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
GrColorType getFormatColorType(DXGI_FORMAT) const

◆ copy_compressed_data()

static void copy_compressed_data ( char *  mapPtr,
DXGI_FORMAT  dxgiFormat,
D3D12_PLACED_SUBRESOURCE_FOOTPRINT *  placedFootprints,
UINT numRows,
UINT64 *  rowSizeInBytes,
const void *  compressedData,
int  numMipLevels 
)
static

Definition at line 339 of file GrD3DGpu.cpp.

342 {
343 SkASSERT(compressedData && numMipLevels);
345 SkASSERT(mapPtr);
346
347 const char* src = static_cast<const char*>(compressedData);
348 for (int currentMipLevel = 0; currentMipLevel < numMipLevels; currentMipLevel++) {
349 // copy data into the buffer, skipping any trailing bytes
350 char* dst = mapPtr + placedFootprints[currentMipLevel].Offset;
351 SkRectMemcpy(dst, placedFootprints[currentMipLevel].Footprint.RowPitch,
352 src, rowSizeInBytes[currentMipLevel], rowSizeInBytes[currentMipLevel],
353 numRows[currentMipLevel]);
354 src += numRows[currentMipLevel] * rowSizeInBytes[currentMipLevel];
355 }
356}
bool GrDxgiFormatIsCompressed(DXGI_FORMAT format)
Definition GrD3DUtil.cpp:15
#define SkASSERT(cond)
Definition SkAssert.h:116
static void SkRectMemcpy(void *dst, size_t dstRB, const void *src, size_t srcRB, size_t trimRowBytes, int rowCount)
dst
Definition cp.py:12

◆ get_surface_sample_cnt()

static int get_surface_sample_cnt ( GrSurface surf)
static

Definition at line 435 of file GrD3DGpu.cpp.

435 {
436 if (const GrRenderTarget* rt = surf->asRenderTarget()) {
437 return rt->numSamples();
438 }
439 return 0;
440}
virtual GrRenderTarget * asRenderTarget()
Definition GrSurface.h:65

◆ is_bgra()

static bool is_bgra ( DXGI_FORMAT  format)
static

Definition at line 1099 of file GrD3DGpu.cpp.

1099 {
1100 // the only one we support at the moment
1101 return (format == DXGI_FORMAT_B8G8R8A8_UNORM);
1102}
uint32_t uint32_t * format

◆ is_odd()

static bool is_odd ( int  x)
static

Definition at line 1089 of file GrD3DGpu.cpp.

1089 {
1090 return x > 1 && SkToBool(x & 0x1);
1091}
static constexpr bool SkToBool(const T &x)
Definition SkTo.h:35
double x

Variable Documentation

◆ kConstantAlignment

constexpr int kConstantAlignment = 256
constexpr

Definition at line 77 of file GrD3DGpu.cpp.

◆ kDefaultOutstandingAllocCnt

const int kDefaultOutstandingAllocCnt = 8
static

Definition at line 74 of file GrD3DGpu.cpp.