diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gpu/GrTest.cpp | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index 301ba6709b..6d55fd1379 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -289,167 +289,6 @@ GrRenderTargetFlags GrRenderTargetProxy::testingOnly_getFlags() const { return fRenderTargetFlags; } -/////////////////////////////////////////////////////////////////////////////// -// Code for the mock context. It's built on a mock GrGpu class that does nothing. -//// - -#include "GrGpu.h" - -class GrPipeline; - -class MockCaps : public GrCaps { -public: - explicit MockCaps(const GrContextOptions& options) : INHERITED(options) {} - bool isConfigTexturable(GrPixelConfig) const override { return false; } - bool isConfigRenderable(GrPixelConfig config, bool withMSAA) const override { return false; } - bool canConfigBeImageStorage(GrPixelConfig) const override { return false; } - bool initDescForDstCopy(const GrRenderTargetProxy* src, GrSurfaceDesc* desc, - bool* rectsMustMatch, bool* disallowSubrect) const override { - return false; - } - -private: - typedef GrCaps INHERITED; -}; - -class MockGpu : public GrGpu { -public: - MockGpu(GrContext* context, const GrContextOptions& options) : INHERITED(context) { - fCaps.reset(new MockCaps(options)); - } - ~MockGpu() override {} - - bool onGetReadPixelsInfo(GrSurface* srcSurface, int readWidth, int readHeight, size_t rowBytes, - GrPixelConfig readConfig, DrawPreference*, - ReadPixelTempDrawInfo*) override { return false; } - - bool onGetWritePixelsInfo(GrSurface* dstSurface, int width, int height, - GrPixelConfig srcConfig, DrawPreference*, - WritePixelTempDrawInfo*) override { return false; } - - bool onCopySurface(GrSurface* dst, - GrSurface* src, - const SkIRect& srcRect, - const SkIPoint& dstPoint) override { return false; } - - void onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings&, - int* effectiveSampleCnt, SamplePattern*) override { - *effectiveSampleCnt = rt->numStencilSamples(); - } - - GrGpuCommandBuffer* createCommandBuffer(const GrGpuCommandBuffer::LoadAndStoreInfo&, - const GrGpuCommandBuffer::LoadAndStoreInfo&) override { - return nullptr; - } - - GrFence SK_WARN_UNUSED_RESULT insertFence() override { return 0; } - bool waitFence(GrFence, uint64_t) override { return true; } - void deleteFence(GrFence) const override {} - - sk_sp<GrSemaphore> SK_WARN_UNUSED_RESULT makeSemaphore(bool isOwned) override { return nullptr; } - sk_sp<GrSemaphore> wrapBackendSemaphore(const GrBackendSemaphore& semaphore, - GrWrapOwnership ownership) override { return nullptr; } - void insertSemaphore(sk_sp<GrSemaphore> semaphore, bool flush) override {} - void waitSemaphore(sk_sp<GrSemaphore> semaphore) override {} - sk_sp<GrSemaphore> prepareTextureForCrossContextUsage(GrTexture*) override { return nullptr; } - -private: - void onResetContext(uint32_t resetBits) override {} - - void xferBarrier(GrRenderTarget*, GrXferBarrierType) override {} - - sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, - const SkTArray<GrMipLevel>& texels) override { - return nullptr; - } - - sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTexture&, - GrSurfaceOrigin, - GrBackendTextureFlags, - int sampleCnt, - GrWrapOwnership) override { - return nullptr; - } - - sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTarget&, - GrSurfaceOrigin) override { - return nullptr; - } - - sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTexture&, - GrSurfaceOrigin, - int sampleCnt) override { - return nullptr; - } - - GrBuffer* onCreateBuffer(size_t, GrBufferType, GrAccessPattern, const void*) override { - return nullptr; - } - - gr_instanced::InstancedRendering* onCreateInstancedRendering() override { return nullptr; } - - bool onReadPixels(GrSurface* surface, - int left, int top, int width, int height, - GrPixelConfig, - void* buffer, - size_t rowBytes) override { - return false; - } - - bool onWritePixels(GrSurface* surface, - int left, int top, int width, int height, - GrPixelConfig config, const SkTArray<GrMipLevel>& texels) override { - return false; - } - - bool onTransferPixels(GrTexture* texture, - int left, int top, int width, int height, - GrPixelConfig config, GrBuffer* transferBuffer, - size_t offset, size_t rowBytes) override { - return false; - } - - void onResolveRenderTarget(GrRenderTarget* target) override { return; } - - GrStencilAttachment* createStencilAttachmentForRenderTarget(const GrRenderTarget*, - int width, - int height) override { - return nullptr; - } - - void clearStencil(GrRenderTarget* target) override {} - - GrBackendObject createTestingOnlyBackendTexture(void* pixels, int w, int h, - GrPixelConfig config, bool isRT) override { - return 0; - } - bool isTestingOnlyBackendTexture(GrBackendObject ) const override { return false; } - void deleteTestingOnlyBackendTexture(GrBackendObject, bool abandonTexture) override {} - - typedef GrGpu INHERITED; -}; - -GrContext* GrContext::CreateMockContext() { - GrContext* context = new GrContext; - - context->initMockContext(); - return context; -} - -void GrContext::initMockContext() { - GrContextOptions options; - options.fBufferMapThreshold = 0; - SkASSERT(nullptr == fGpu); - fGpu = new MockGpu(this, options); - SkASSERT(fGpu); - this->initCommon(options); - - // We delete these because we want to test the cache starting with zero resources. Also, none of - // these objects are required for any of tests that use this context. TODO: make stop allocating - // resources in the buffer pools. - fDrawingManager->abandon(); -} - ////////////////////////////////////////////////////////////////////////////// void GrContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCallbackObject* cb) { |