31 : fBackend(that.fBackend)
33 , fTextureType(that.fTextureType) {
43 that.fFormatData->
copyTo(fFormatData);
47 fDxgiFormat = that.fDxgiFormat;
70 , fDxgiFormat(dxgiFormat)
74bool GrBackendFormat::asDxgiFormat(DXGI_FORMAT* dxgiFormat)
const {
76 *dxgiFormat = fDxgiFormat;
89 fMock.fCompressionType = compression;
90 fMock.fIsStencilFormat = isStencilFormat;
123 return fFormatData->
desc();
137bool GrBackendFormat::validateMock()
const {
145 if (
fMock.fIsStencilFormat) {
148 return trueStates == 1;
155 return fMock.fColorType;
164 return fMock.fCompressionType;
173 return fMock.fIsStencilFormat;
183 copy.fFormatData->makeTexture2D();
191 bool isStencilFormat) {
197 if (!fValid || !that.fValid) {
201 if (fBackend != that.fBackend) {
209 return fFormatData->
equal(that.fFormatData.
get());
215 return fDxgiFormat == that.fDxgiFormat;
223#if defined(SK_DEBUG) || defined(GR_TEST_UTILS)
226SkString GrBackendFormat::toStr()
const {
234 str.
appendf(
"%s-", GrBackendApiToStr(fBackend));
244 str.
append(GrDxgiFormatToStr(fDxgiFormat));
267 std::string_view label)
272 static_cast<D3D12_RESOURCE_STATES>(d3dInfo.fResourceState))),
279 std::string_view label)
287 , fD3DInfo(d3dInfo,
state.release()) {}
294 std::string_view label)
299 , fMipmapped(mipmapped)
302 , fMockInfo(mockInfo) {}
308void GrBackendTexture::cleanup() {
309 fTextureData.
reset();
330 }
else if (fIsValid && this->fBackend != that.fBackend) {
334 fWidth = that.fWidth;
335 fHeight = that.fHeight;
336 fMipmapped = that.fMipmapped;
337 fBackend = that.fBackend;
338 fTextureType = that.fTextureType;
340 switch (that.fBackend) {
344 fTextureData.
reset();
345 that.fTextureData->
copyTo(fTextureData);
349 fD3DInfo.assign(that.fD3DInfo, this->
isValid());
369 *outInfo = fD3DInfo.snapTextureResourceInfo();
377 fD3DInfo.setResourceState(
state);
383 return fD3DInfo.getGrD3DResourceState();
419 if (fBackend != that.fBackend) {
429 return fD3DInfo.snapTextureResourceInfo().fResource ==
430 that.fD3DInfo.snapTextureResourceInfo().fResource;
450 auto d3dInfo = fD3DInfo.snapTextureResourceInfo();
451 return GrBackendFormat::MakeDxgi(d3dInfo.fFormat);
461#if defined(GR_TEST_UTILS)
467 if (t0.fWidth != t1.fWidth ||
468 t0.fHeight != t1.fHeight ||
469 t0.fMipmapped != t1.fMipmapped ||
470 t0.fBackend != t1.fBackend) {
474 switch (t0.fBackend) {
478 return t0.fTextureData->
equal(t1.fTextureData.
get());
483 return t0.fD3DInfo == t1.fD3DInfo;
501 static_cast<D3D12_RESOURCE_STATES>(d3dInfo.fResourceState)))) {}
510 , fSampleCnt(
std::
max(1U, d3dInfo.fSampleCount))
513 , fD3DInfo(d3dInfo,
state.release()) {}
524 , fSampleCnt(
std::
max(1, sampleCnt))
525 , fStencilBits(stencilBits)
527 , fMockInfo(mockInfo) {}
533void GrBackendRenderTarget::cleanup() {
555 }
else if (fIsValid && this->fBackend != that.fBackend) {
559 fWidth = that.fWidth;
560 fHeight = that.fHeight;
561 fSampleCnt = that.fSampleCnt;
562 fStencilBits = that.fStencilBits;
563 fBackend = that.fBackend;
565 switch (that.fBackend) {
570 that.fRTData->
copyTo(fRTData);
574 fD3DInfo.assign(that.fD3DInfo, this->
isValid());
583 fIsValid = that.fIsValid;
594 *outInfo = fD3DInfo.snapTextureResourceInfo();
602 fD3DInfo.setResourceState(
state);
608 return fD3DInfo.getGrD3DResourceState();
625 auto info = fD3DInfo.snapTextureResourceInfo();
626 return GrBackendFormat::MakeDxgi(
info.fFormat);
662#if defined(GR_TEST_UTILS)
669 if (r0.fWidth != r1.fWidth ||
670 r0.fHeight != r1.fHeight ||
671 r0.fSampleCnt != r1.fSampleCnt ||
672 r0.fStencilBits != r1.fStencilBits ||
673 r0.fBackend != r1.fBackend) {
677 switch (r0.fBackend) {
681 return r0.fRTData->
equal(r1.fRTData.
get());
686 return r0.fD3DInfo == r1.fD3DInfo;
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
int GrD3DResourceStateEnum
static constexpr uint32_t GrDxgiFormatChannels(DXGI_FORMAT format)
static constexpr GrColorFormatDesc GrDxgiFormatDesc(DXGI_FORMAT format)
static constexpr uint32_t GrColorTypeChannelFlags(GrColorType ct)
static constexpr GrColorFormatDesc GrGetColorTypeDesc(GrColorType ct)
#define SK_ABORT(message,...)
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
virtual void setMutableState(const skgpu::MutableTextureState &)
virtual void copyTo(AnyRenderTargetData &) const =0
virtual bool isProtected() const =0
virtual sk_sp< skgpu::MutableTextureState > getMutableState() const
virtual ~GrBackendRenderTargetData()
virtual GrBackendFormat getBackendFormat() const =0
virtual bool equal(const GrBackendRenderTargetData *that) const =0
void setMutableState(const skgpu::MutableTextureState &)
bool getMockRenderTargetInfo(GrMockRenderTargetInfo *) const
GrBackendRenderTarget & operator=(const GrBackendRenderTarget &)
GrMockRenderTargetInfo fMockInfo
GrBackendFormat getBackendFormat() const
GrBackendApi backend() const
virtual bool equal(const GrBackendTextureData *that) const =0
virtual ~GrBackendTextureData()
virtual bool isSameTexture(const GrBackendTextureData *) const =0
virtual bool isProtected() const =0
virtual sk_sp< skgpu::MutableTextureState > getMutableState() const
virtual void copyTo(AnyTextureData &) const =0
virtual GrBackendFormat getBackendFormat() const =0
virtual void setMutableState(const skgpu::MutableTextureState &)
GrBackendFormat getBackendFormat() const
bool isSameTexture(const GrBackendTexture &)
GrBackendTexture & operator=(const GrBackendTexture &that)
bool getMockTextureInfo(GrMockTextureInfo *) const
GrMockTextureInfo fMockInfo
void setMutableState(const skgpu::MutableTextureState &)
GrBackendApi backend() const
void append(const char text[])
void void void appendf(const char format[],...) SK_PRINTF_LIKE(2
static float max(float r, float g, float b)
static constexpr const char * CompressionTypeToStr(SkTextureCompressionType compression)
GrBackendFormat getBackendFormat() const
GrBackendFormat getBackendFormat() const