Revert "Make createTestingOnlyBackendTexture and deleteTestingOnlyBackendTexture no longer be behind GR_TEST_UTILS"
This reverts commit 50a4e6e3b1
.
Reason for revert: Chrome fails to compile:
../../third_party/skia/src/gpu/vk/GrVkGpu.cpp:143:29: error: allocating an object of abstract class type 'GrVkGpu'
return sk_sp<GrGpu>(new GrVkGpu(context, options, backendContext, interface, instanceVersion,
^
../../third_party/skia/src/gpu/GrGpu.h:405:30: note: unimplemented pure virtual method 'createTestingOnlyBackendTexture' in 'GrVkGpu'
virtual GrBackendTexture createTestingOnlyBackendTexture(int w, int h, const GrBackendFormat&,
^
../../third_party/skia/src/gpu/GrGpu.h:414:18: note: unimplemented pure virtual method 'deleteTestingOnlyBackendTexture' in 'GrVkGpu'
virtual void deleteTestingOnlyBackendTexture(const GrBackendTexture&) = 0;
^
../../third_party/skia/src/gpu/vk/GrVkGpu.cpp:1525:15: error: out-of-line definition of 'createTestingOnlyVkImage' does not match any declaration in 'GrVkGpu'
bool GrVkGpu::createTestingOnlyVkImage(GrPixelConfig config, int w, int h, bool texturable,
^~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/skia/src/gpu/vk/GrVkGpu.cpp:1893:27: error: out-of-line definition of 'createTestingOnlyBackendTexture' does not match any declaration in 'GrVkGpu'
GrBackendTexture GrVkGpu::createTestingOnlyBackendTexture(int w, int h,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/skia/src/gpu/vk/GrVkGpu.cpp:1933:15: error: out-of-line definition of 'deleteTestingOnlyBackendTexture' does not match any declaration in 'GrVkGpu'
void GrVkGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Original change's description:
> Make createTestingOnlyBackendTexture and deleteTestingOnlyBackendTexture no longer be behind GR_TEST_UTILS
>
> Change-Id: Iec44bc46aa2ab2899af3f6df130a93adf3f26e2a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213821
> Commit-Queue: Robert Phillips <robertphillips@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: I6b234ae436842eb292c7a8a725c1a55f3f5fd440
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214061
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
parent
017126fe1d
commit
8ad0cbd34a
@ -457,6 +457,7 @@ void GrGpu::dumpJSON(SkJSONWriter* writer) const {
|
||||
void GrGpu::dumpJSON(SkJSONWriter* writer) const { }
|
||||
#endif
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
GrBackendTexture GrGpu::createTestingOnlyBackendTexture(int w, int h, SkColorType colorType,
|
||||
GrMipMapped mipMapped,
|
||||
GrRenderable renderable,
|
||||
@ -470,8 +471,6 @@ GrBackendTexture GrGpu::createTestingOnlyBackendTexture(int w, int h, SkColorTyp
|
||||
pixels, rowBytes);
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
#if GR_GPU_STATS
|
||||
void GrGpu::Stats::dump(SkString* out) {
|
||||
out->appendf("Render Target Binds: %d\n", fRenderTargetBinds);
|
||||
|
@ -394,6 +394,7 @@ public:
|
||||
Stats* stats() { return &fStats; }
|
||||
void dumpJSON(SkJSONWriter*) const;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
GrBackendTexture createTestingOnlyBackendTexture(int w, int h, SkColorType,
|
||||
GrMipMapped, GrRenderable,
|
||||
const void* pixels = nullptr,
|
||||
@ -407,16 +408,14 @@ public:
|
||||
const void* pixels = nullptr,
|
||||
size_t rowBytes = 0) = 0;
|
||||
|
||||
/** Check a handle represents an actual texture in the backend API that has not been freed. */
|
||||
virtual bool isTestingOnlyBackendTexture(const GrBackendTexture&) const = 0;
|
||||
/**
|
||||
* Frees a texture created by createTestingOnlyBackendTexture(). If ownership of the backend
|
||||
* texture has been transferred to a GrContext using adopt semantics this should not be called.
|
||||
*/
|
||||
virtual void deleteTestingOnlyBackendTexture(const GrBackendTexture&) = 0;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
/** Check a handle represents an actual texture in the backend API that has not been freed. */
|
||||
virtual bool isTestingOnlyBackendTexture(const GrBackendTexture&) const = 0;
|
||||
|
||||
virtual GrBackendRenderTarget createTestingOnlyBackendRenderTarget(int w, int h,
|
||||
GrColorType) = 0;
|
||||
|
||||
|
@ -4008,6 +4008,7 @@ void GrGLGpu::xferBarrier(GrRenderTarget* rt, GrXferBarrierType type) {
|
||||
}
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
static bool gl_format_to_pixel_config(GrGLenum format, GrPixelConfig* config) {
|
||||
GrPixelConfig dontCare;
|
||||
if (!config) {
|
||||
@ -4191,25 +4192,12 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(int w, int h,
|
||||
GL_CALL(BindTexture(info.fTarget, 0));
|
||||
|
||||
GrBackendTexture beTex = GrBackendTexture(w, h, mipMapped, info);
|
||||
#if GR_TEST_UTILS
|
||||
// Lots of tests don't go through Skia's public interface which will set the config so for
|
||||
// testing we make sure we set a config here.
|
||||
beTex.setPixelConfig(config);
|
||||
#endif
|
||||
return beTex;
|
||||
}
|
||||
|
||||
void GrGLGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kOpenGL == tex.backend());
|
||||
|
||||
GrGLTextureInfo info;
|
||||
if (tex.getGLTextureInfo(&info)) {
|
||||
GL_CALL(DeleteTextures(1, &info.fID));
|
||||
}
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
||||
bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
SkASSERT(GrBackendApi::kOpenGL == tex.backend());
|
||||
|
||||
@ -4224,6 +4212,15 @@ bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
return (GR_GL_TRUE == result);
|
||||
}
|
||||
|
||||
void GrGLGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kOpenGL == tex.backend());
|
||||
|
||||
GrGLTextureInfo info;
|
||||
if (tex.getGLTextureInfo(&info)) {
|
||||
GL_CALL(DeleteTextures(1, &info.fID));
|
||||
}
|
||||
}
|
||||
|
||||
GrBackendRenderTarget GrGLGpu::createTestingOnlyBackendRenderTarget(int w, int h,
|
||||
GrColorType colorType) {
|
||||
if (w > this->caps()->maxRenderTargetSize() || h > this->caps()->maxRenderTargetSize()) {
|
||||
|
@ -136,16 +136,16 @@ public:
|
||||
GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget* rt,
|
||||
int width,
|
||||
int height) override;
|
||||
#if GR_TEST_UTILS
|
||||
GrBackendTexture createTestingOnlyBackendTexture(int w, int h, const GrBackendFormat&,
|
||||
GrMipMapped, GrRenderable,
|
||||
const void* pixels = nullptr,
|
||||
size_t rowBytes = 0) override;
|
||||
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
|
||||
void deleteTestingOnlyBackendTexture(const GrBackendTexture&) override;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
|
||||
|
||||
GrBackendRenderTarget createTestingOnlyBackendRenderTarget(int w, int h, GrColorType) override;
|
||||
|
||||
void deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) override;
|
||||
|
||||
const GrGLContext* glContextForTesting() const override { return &this->glContext(); }
|
||||
|
@ -196,6 +196,7 @@ GrStencilAttachment* GrMockGpu::createStencilAttachmentForRenderTarget(const GrR
|
||||
return new GrMockStencilAttachment(this, width, height, kBits, rt->numColorSamples());
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
GrBackendTexture GrMockGpu::createTestingOnlyBackendTexture(int w, int h,
|
||||
const GrBackendFormat& format,
|
||||
GrMipMapped mipMapped,
|
||||
@ -219,16 +220,6 @@ GrBackendTexture GrMockGpu::createTestingOnlyBackendTexture(int w, int h,
|
||||
return GrBackendTexture(w, h, mipMapped, info);
|
||||
}
|
||||
|
||||
void GrMockGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kMock == tex.backend());
|
||||
|
||||
GrMockTextureInfo info;
|
||||
if (tex.getMockTextureInfo(&info)) {
|
||||
fOutstandingTestingOnlyTextureIDs.remove(info.fID);
|
||||
}
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool GrMockGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
SkASSERT(GrBackendApi::kMock == tex.backend());
|
||||
|
||||
@ -240,6 +231,15 @@ bool GrMockGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
return fOutstandingTestingOnlyTextureIDs.contains(info.fID);
|
||||
}
|
||||
|
||||
void GrMockGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kMock == tex.backend());
|
||||
|
||||
GrMockTextureInfo info;
|
||||
if (tex.getMockTextureInfo(&info)) {
|
||||
fOutstandingTestingOnlyTextureIDs.remove(info.fID);
|
||||
}
|
||||
}
|
||||
|
||||
GrBackendRenderTarget GrMockGpu::createTestingOnlyBackendRenderTarget(int w, int h,
|
||||
GrColorType colorType) {
|
||||
auto config = GrColorTypeToPixelConfig(colorType, GrSRGBEncoded::kNo);
|
||||
|
@ -121,14 +121,13 @@ private:
|
||||
GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*,
|
||||
int width,
|
||||
int height) override;
|
||||
#if GR_TEST_UTILS
|
||||
GrBackendTexture createTestingOnlyBackendTexture(int w, int h, const GrBackendFormat&,
|
||||
GrMipMapped, GrRenderable,
|
||||
const void* pixels = nullptr,
|
||||
size_t rowBytes = 0) override;
|
||||
void deleteTestingOnlyBackendTexture(const GrBackendTexture&) override;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
|
||||
void deleteTestingOnlyBackendTexture(const GrBackendTexture&) override;
|
||||
|
||||
GrBackendRenderTarget createTestingOnlyBackendRenderTarget(int w, int h, GrColorType) override;
|
||||
void deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) override;
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
// command buffer to finish before creating a new buffer and returning.
|
||||
void submitCommandBuffer(SyncQueue sync);
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
GrBackendTexture createTestingOnlyBackendTexture(int w, int h,
|
||||
const GrBackendFormat& format,
|
||||
GrMipMapped mipMapped,
|
||||
@ -67,12 +68,12 @@ public:
|
||||
const void* pixels = nullptr,
|
||||
size_t rowBytes = 0) override;
|
||||
|
||||
void deleteTestingOnlyBackendTexture(const GrBackendTexture&) override;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool isTestingOnlyBackendTexture(const GrBackendTexture&) const override;
|
||||
|
||||
void deleteTestingOnlyBackendTexture(const GrBackendTexture&) override;
|
||||
|
||||
GrBackendRenderTarget createTestingOnlyBackendRenderTarget(int w, int h, GrColorType) override;
|
||||
|
||||
void deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget&) override;
|
||||
|
||||
void testingOnly_flushGpuAndSync() override;
|
||||
@ -213,11 +214,13 @@ private:
|
||||
int width,
|
||||
int height) override;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool createTestingOnlyMtlTextureInfo(GrPixelConfig, MTLPixelFormat,
|
||||
int w, int h, bool texturable,
|
||||
bool renderable, GrMipMapped mipMapped,
|
||||
const void* srcData, size_t rowBytes,
|
||||
GrMtlTextureInfo* info);
|
||||
#endif
|
||||
|
||||
sk_sp<GrMtlCaps> fMtlCaps;
|
||||
|
||||
|
@ -608,6 +608,7 @@ bool GrMtlGpu::onRegenerateMipMapLevels(GrTexture* texture) {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool GrMtlGpu::createTestingOnlyMtlTextureInfo(GrPixelConfig config, MTLPixelFormat format,
|
||||
int w, int h, bool texturable,
|
||||
bool renderable, GrMipMapped mipMapped,
|
||||
@ -799,17 +800,6 @@ GrBackendTexture GrMtlGpu::createTestingOnlyBackendTexture(int w, int h,
|
||||
return backendTex;
|
||||
}
|
||||
|
||||
void GrMtlGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kMetal == tex.fBackend);
|
||||
|
||||
GrMtlTextureInfo info;
|
||||
if (tex.getMtlTextureInfo(&info)) {
|
||||
// Adopts the metal texture so that ARC will clean it up.
|
||||
GrGetMTLTexture(info.fTexture, GrWrapOwnership::kAdopt_GrWrapOwnership);
|
||||
}
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool GrMtlGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
SkASSERT(GrBackendApi::kMetal == tex.backend());
|
||||
|
||||
@ -825,6 +815,16 @@ bool GrMtlGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
return mtlTexture.usage & MTLTextureUsageShaderRead;
|
||||
}
|
||||
|
||||
void GrMtlGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kMetal == tex.fBackend);
|
||||
|
||||
GrMtlTextureInfo info;
|
||||
if (tex.getMtlTextureInfo(&info)) {
|
||||
// Adopts the metal texture so that ARC will clean it up.
|
||||
GrGetMTLTexture(info.fTexture, GrWrapOwnership::kAdopt_GrWrapOwnership);
|
||||
}
|
||||
}
|
||||
|
||||
GrBackendRenderTarget GrMtlGpu::createTestingOnlyBackendRenderTarget(int w, int h, GrColorType ct) {
|
||||
if (w > this->caps()->maxRenderTargetSize() || h > this->caps()->maxRenderTargetSize()) {
|
||||
return GrBackendRenderTarget();
|
||||
|
@ -1482,6 +1482,7 @@ bool copy_testing_data(GrVkGpu* gpu, const void* srcData, const GrVkAlloc& alloc
|
||||
return true;
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
static size_t compute_combined_buffer_size(VkFormat format, size_t bpp, int w, int h,
|
||||
SkTArray<size_t>* individualMipOffsets,
|
||||
uint32_t mipLevels) {
|
||||
@ -1922,24 +1923,12 @@ GrBackendTexture GrVkGpu::createTestingOnlyBackendTexture(int w, int h,
|
||||
return {};
|
||||
}
|
||||
GrBackendTexture beTex = GrBackendTexture(w, h, info);
|
||||
#if GR_TEST_UTILS
|
||||
// Lots of tests don't go through Skia's public interface which will set the config so for
|
||||
// testing we make sure we set a config here.
|
||||
beTex.setPixelConfig(config);
|
||||
#endif
|
||||
return beTex;
|
||||
}
|
||||
|
||||
void GrVkGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kVulkan == tex.fBackend);
|
||||
|
||||
GrVkImageInfo info;
|
||||
if (tex.getVkImageInfo(&info)) {
|
||||
GrVkImage::DestroyImageInfo(this, const_cast<GrVkImageInfo*>(&info));
|
||||
}
|
||||
}
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
SkASSERT(GrBackendApi::kVulkan == tex.fBackend);
|
||||
|
||||
@ -1962,6 +1951,15 @@ bool GrVkGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void GrVkGpu::deleteTestingOnlyBackendTexture(const GrBackendTexture& tex) {
|
||||
SkASSERT(GrBackendApi::kVulkan == tex.fBackend);
|
||||
|
||||
GrVkImageInfo info;
|
||||
if (tex.getVkImageInfo(&info)) {
|
||||
GrVkImage::DestroyImageInfo(this, const_cast<GrVkImageInfo*>(&info));
|
||||
}
|
||||
}
|
||||
|
||||
GrBackendRenderTarget GrVkGpu::createTestingOnlyBackendRenderTarget(int w, int h, GrColorType ct) {
|
||||
if (w > this->caps()->maxRenderTargetSize() || h > this->caps()->maxRenderTargetSize()) {
|
||||
return GrBackendRenderTarget();
|
||||
|
Loading…
Reference in New Issue
Block a user