Migrate GrGpu to GrDirectContext
Another piece of the Great Recontexting. Change-Id: Ib089dbdba89e25add407cf816d28c96c7e5dbc05 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301303 Commit-Queue: Adlai Holler <adlai@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
53ee0fcac7
commit
3d0359a318
@ -334,7 +334,7 @@ void CCPRGeometryView::updateGpuData() {
|
||||
void CCPRGeometryView::DrawCoverageCountOp::onExecute(GrOpFlushState* state,
|
||||
const SkRect& chainBounds) {
|
||||
GrResourceProvider* rp = state->resourceProvider();
|
||||
auto direct = GrAsDirectContext(state->gpu()->getContext());
|
||||
auto direct = state->gpu()->getContext();
|
||||
#ifdef SK_GL
|
||||
GrGLGpu* glGpu = GrBackendApi::kOpenGL == direct->backend()
|
||||
? static_cast<GrGLGpu*>(state->gpu())
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/private/SkMacros.h"
|
||||
#include "src/core/SkSafeMath.h"
|
||||
|
@ -160,9 +160,10 @@ GrGLFunction<GrGLGetErrorFn> make_get_error_with_random_oom(GrGLFunction<GrGLGet
|
||||
}
|
||||
#endif
|
||||
|
||||
// CONTEXT TODO: Make* functions should return an sk_sp<GrDirectContext>
|
||||
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kOpenGL, options));
|
||||
auto direct = new GrDirectContext(GrBackendApi::kOpenGL, options);
|
||||
#if GR_TEST_UTILS
|
||||
if (options.fRandomGLOOM) {
|
||||
auto copy = sk_make_sp<GrGLInterface>(*glInterface);
|
||||
@ -175,7 +176,8 @@ sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> glInterface,
|
||||
glInterface = std::move(copy);
|
||||
}
|
||||
#endif
|
||||
context->fGpu = GrGLGpu::Make(std::move(glInterface), options, context.get());
|
||||
direct->fGpu = GrGLGpu::Make(std::move(glInterface), options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -190,9 +192,10 @@ sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMock, options));
|
||||
auto direct = new GrDirectContext(GrBackendApi::kMock, options);
|
||||
|
||||
context->fGpu = GrMockGpu::Make(mockOptions, options, context.get());
|
||||
direct->fGpu = GrMockGpu::Make(mockOptions, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -212,9 +215,10 @@ sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext)
|
||||
sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
|
||||
const GrContextOptions& options) {
|
||||
#ifdef SK_VULKAN
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kVulkan, options));
|
||||
auto direct = new GrDirectContext(GrBackendApi::kVulkan, options);
|
||||
|
||||
context->fGpu = GrVkGpu::Make(backendContext, options, context.get());
|
||||
direct->fGpu = GrVkGpu::Make(backendContext, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -232,9 +236,10 @@ sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue) {
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMetal, options));
|
||||
auto direct = new GrDirectContext(GrBackendApi::kMetal, options);
|
||||
|
||||
context->fGpu = GrMtlTrampoline::MakeGpu(context.get(), options, device, queue);
|
||||
direct->fGpu = GrMtlTrampoline::MakeGpu(direct, options, device, queue);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -251,9 +256,10 @@ sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendConte
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeDirect3D(const GrD3DBackendContext& backendContext,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kDirect3D, options));
|
||||
auto direct = new GrDirectContext(GrBackendApi::kDirect3D, options);
|
||||
|
||||
context->fGpu = GrD3DGpu::Make(backendContext, options, context.get());
|
||||
direct->fGpu = GrD3DGpu::Make(backendContext, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -269,9 +275,10 @@ sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device) {
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeDawn(const wgpu::Device& device, const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kDawn, options));
|
||||
auto direct = new GrDirectContext(GrBackendApi::kDawn, options);
|
||||
|
||||
context->fGpu = GrDawnGpu::Make(device, options, context.get());
|
||||
direct->fGpu = GrDawnGpu::Make(device, options, direct);
|
||||
sk_sp<GrContext> context(direct);
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "include/gpu/GrBackendSemaphore.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkCompressedDataUtils.h"
|
||||
#include "src/core/SkMathPriv.h"
|
||||
#include "src/core/SkMipMap.h"
|
||||
@ -40,7 +40,7 @@ static const size_t kMinStagingBufferSize = 32 * 1024;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrGpu::GrGpu(GrContext* context) : fResetBits(kAll_GrBackendState), fContext(context) {}
|
||||
GrGpu::GrGpu(GrDirectContext* direct) : fResetBits(kAll_GrBackendState), fContext(direct) {}
|
||||
|
||||
GrGpu::~GrGpu() {
|
||||
this->callSubmittedProcs(false);
|
||||
|
@ -20,12 +20,11 @@
|
||||
#include "src/gpu/GrSwizzle.h"
|
||||
#include "src/gpu/GrTextureProducer.h"
|
||||
#include "src/gpu/GrXferProcessor.h"
|
||||
#include <map>
|
||||
|
||||
class GrBackendRenderTarget;
|
||||
class GrBackendSemaphore;
|
||||
class GrDirectContext;
|
||||
class GrGpuBuffer;
|
||||
class GrContext;
|
||||
struct GrContextOptions;
|
||||
class GrGLContext;
|
||||
class GrPath;
|
||||
@ -44,11 +43,11 @@ class SkJSONWriter;
|
||||
|
||||
class GrGpu : public SkRefCnt {
|
||||
public:
|
||||
GrGpu(GrContext* context);
|
||||
GrGpu(GrDirectContext* direct);
|
||||
~GrGpu() override;
|
||||
|
||||
GrContext* getContext() { return fContext; }
|
||||
const GrContext* getContext() const { return fContext; }
|
||||
GrDirectContext* getContext() { return fContext; }
|
||||
const GrDirectContext* getContext() const { return fContext; }
|
||||
|
||||
/**
|
||||
* Gets the capabilities of the draw target.
|
||||
@ -66,12 +65,12 @@ public:
|
||||
kCleanup,
|
||||
};
|
||||
|
||||
// Called by GrContext when the underlying backend context is already or will be destroyed
|
||||
// before GrContext.
|
||||
// Called by context when the underlying backend context is already or will be destroyed
|
||||
// before GrDirectContext.
|
||||
virtual void disconnect(DisconnectType);
|
||||
|
||||
// Called by GrContext::isContextLost. Returns true if the backend Gpu object has gotten into an
|
||||
// unrecoverable, lost state.
|
||||
// Called by GrDirectContext::isContextLost. Returns true if the backend Gpu object has gotten
|
||||
// into an unrecoverable, lost state.
|
||||
virtual bool isDeviceLost() const { return false; }
|
||||
|
||||
/**
|
||||
@ -390,7 +389,7 @@ public:
|
||||
bool checkAndResetOOMed();
|
||||
|
||||
/**
|
||||
* Put this texture in a safe and known state for use across multiple GrContexts. Depending on
|
||||
* Put this texture in a safe and known state for use across multiple contexts. Depending on
|
||||
* the backend, this may return a GrSemaphore. If so, other contexts should wait on that
|
||||
* semaphore before using this texture.
|
||||
*/
|
||||
@ -636,7 +635,7 @@ public:
|
||||
|
||||
/**
|
||||
* Frees a texture created by createBackendTexture(). If ownership of the backend
|
||||
* texture has been transferred to a GrContext using adopt semantics this should not be called.
|
||||
* texture has been transferred to a context using adopt semantics this should not be called.
|
||||
*/
|
||||
virtual void deleteBackendTexture(const GrBackendTexture&) = 0;
|
||||
|
||||
@ -868,7 +867,7 @@ private:
|
||||
|
||||
uint32_t fResetBits;
|
||||
// The context owns us, not vice-versa, so this ptr is not ref'ed by Gpu.
|
||||
GrContext* fContext;
|
||||
GrDirectContext* fContext;
|
||||
GrSamplePatternDictionary fSamplePatternDictionary;
|
||||
|
||||
std::vector<std::unique_ptr<GrStagingBuffer>> fStagingBuffers;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "include/core/SkTraceMemoryDump.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpu.h"
|
||||
#include "src/gpu/GrGpuResource.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "src/gpu/GrOpFlushState.h"
|
||||
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkConvertPixels.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrDataUtils.h"
|
||||
|
@ -29,8 +29,8 @@
|
||||
#endif
|
||||
|
||||
sk_sp<GrGpu> GrD3DGpu::Make(const GrD3DBackendContext& backendContext,
|
||||
const GrContextOptions& contextOptions, GrContext* context) {
|
||||
return sk_sp<GrGpu>(new GrD3DGpu(context, contextOptions, backendContext));
|
||||
const GrContextOptions& contextOptions, GrDirectContext* direct) {
|
||||
return sk_sp<GrGpu>(new GrD3DGpu(direct, contextOptions, backendContext));
|
||||
}
|
||||
|
||||
// This constant determines how many OutstandingCommandLists are allocated together as a block in
|
||||
@ -39,9 +39,9 @@ sk_sp<GrGpu> GrD3DGpu::Make(const GrD3DBackendContext& backendContext,
|
||||
// command lists we expect to see.
|
||||
static const int kDefaultOutstandingAllocCnt = 8;
|
||||
|
||||
GrD3DGpu::GrD3DGpu(GrContext* context, const GrContextOptions& contextOptions,
|
||||
GrD3DGpu::GrD3DGpu(GrDirectContext* direct, const GrContextOptions& contextOptions,
|
||||
const GrD3DBackendContext& backendContext)
|
||||
: INHERITED(context)
|
||||
: INHERITED(direct)
|
||||
, fDevice(backendContext.fDevice)
|
||||
|
||||
, fQueue(backendContext.fQueue)
|
||||
|
@ -31,7 +31,7 @@ namespace SkSL {
|
||||
class GrD3DGpu : public GrGpu {
|
||||
public:
|
||||
static sk_sp<GrGpu> Make(const GrD3DBackendContext& backendContext, const GrContextOptions&,
|
||||
GrContext*);
|
||||
GrDirectContext*);
|
||||
|
||||
~GrD3DGpu() override;
|
||||
|
||||
@ -113,7 +113,7 @@ private:
|
||||
kSkip
|
||||
};
|
||||
|
||||
GrD3DGpu(GrContext* context, const GrContextOptions&, const GrD3DBackendContext&);
|
||||
GrD3DGpu(GrDirectContext*, const GrContextOptions&, const GrD3DBackendContext&);
|
||||
|
||||
void destroyResources();
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "src/gpu/d3d/GrD3DPipelineStateBuilder.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/d3d/GrD3DTypes.h"
|
||||
#include "src/core/SkTraceEvent.h"
|
||||
#include "src/gpu/GrAutoLocaleSetter.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/d3d/GrD3DResourceProvider.h"
|
||||
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/d3d/GrD3DBuffer.h"
|
||||
#include "src/gpu/d3d/GrD3DCommandList.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "include/gpu/GrBackendSemaphore.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrDataUtils.h"
|
||||
#include "src/gpu/GrGeometryProcessor.h"
|
||||
#include "src/gpu/GrGpuResourceCacheAccess.h"
|
||||
@ -96,19 +97,19 @@ static wgpu::AddressMode to_dawn_address_mode(GrSamplerState::WrapMode wrapMode)
|
||||
}
|
||||
|
||||
sk_sp<GrGpu> GrDawnGpu::Make(const wgpu::Device& device,
|
||||
const GrContextOptions& options, GrContext* context) {
|
||||
const GrContextOptions& options, GrDirectContext* direct) {
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return sk_sp<GrGpu>(new GrDawnGpu(context, options, device));
|
||||
return sk_sp<GrGpu>(new GrDawnGpu(direct, options, device));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrDawnGpu::GrDawnGpu(GrContext* context, const GrContextOptions& options,
|
||||
GrDawnGpu::GrDawnGpu(GrDirectContext* direct, const GrContextOptions& options,
|
||||
const wgpu::Device& device)
|
||||
: INHERITED(context)
|
||||
: INHERITED(direct)
|
||||
, fDevice(device)
|
||||
, fQueue(device.GetDefaultQueue())
|
||||
, fCompiler(new SkSL::Compiler())
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
class GrDawnOpsRenderPass;
|
||||
class GrDawnStagingBuffer;
|
||||
class GrDirectContext;
|
||||
class GrPipeline;
|
||||
struct GrDawnProgram;
|
||||
|
||||
@ -29,8 +30,7 @@ namespace SkSL {
|
||||
|
||||
class GrDawnGpu : public GrGpu {
|
||||
public:
|
||||
static sk_sp<GrGpu> Make(const wgpu::Device& device, const GrContextOptions&, GrContext*);
|
||||
GrDawnGpu(GrContext* context, const GrContextOptions& options, const wgpu::Device& device);
|
||||
static sk_sp<GrGpu> Make(const wgpu::Device&, const GrContextOptions&, GrDirectContext*);
|
||||
|
||||
~GrDawnGpu() override;
|
||||
|
||||
@ -98,6 +98,8 @@ public:
|
||||
void appendCommandBuffer(wgpu::CommandBuffer commandBuffer);
|
||||
|
||||
private:
|
||||
GrDawnGpu(GrDirectContext*, const GrContextOptions&, const wgpu::Device&);
|
||||
|
||||
void onResetContext(uint32_t resetBits) override {}
|
||||
|
||||
virtual void querySampleLocations(GrRenderTarget*, SkTArray<SkPoint>*) override {}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrBackendSemaphore.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
#include "include/private/SkHalf.h"
|
||||
#include "include/private/SkTemplates.h"
|
||||
@ -301,7 +302,7 @@ private:
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
sk_sp<GrGpu> GrGLGpu::Make(sk_sp<const GrGLInterface> interface, const GrContextOptions& options,
|
||||
GrContext* context) {
|
||||
GrDirectContext* direct) {
|
||||
if (!interface) {
|
||||
interface = GrGLMakeNativeInterface();
|
||||
// For clients that have written their own GrGLCreateNativeInterface and haven't yet updated
|
||||
@ -320,11 +321,11 @@ sk_sp<GrGpu> GrGLGpu::Make(sk_sp<const GrGLInterface> interface, const GrContext
|
||||
if (!glContext) {
|
||||
return nullptr;
|
||||
}
|
||||
return sk_sp<GrGpu>(new GrGLGpu(std::move(glContext), context));
|
||||
return sk_sp<GrGpu>(new GrGLGpu(std::move(glContext), direct));
|
||||
}
|
||||
|
||||
GrGLGpu::GrGLGpu(std::unique_ptr<GrGLContext> ctx, GrContext* context)
|
||||
: GrGpu(context)
|
||||
GrGLGpu::GrGLGpu(std::unique_ptr<GrGLContext> ctx, GrDirectContext* direct)
|
||||
: GrGpu(direct)
|
||||
, fGLContext(std::move(ctx))
|
||||
, fProgramCache(new ProgramCache(this))
|
||||
, fHWProgramID(0)
|
||||
|
@ -32,7 +32,7 @@ class GrSwizzle;
|
||||
|
||||
class GrGLGpu final : public GrGpu {
|
||||
public:
|
||||
static sk_sp<GrGpu> Make(sk_sp<const GrGLInterface>, const GrContextOptions&, GrContext*);
|
||||
static sk_sp<GrGpu> Make(sk_sp<const GrGLInterface>, const GrContextOptions&, GrDirectContext*);
|
||||
~GrGLGpu() override;
|
||||
|
||||
void disconnect(DisconnectType) override;
|
||||
@ -189,7 +189,7 @@ public:
|
||||
void flushProgram(GrGLuint);
|
||||
|
||||
private:
|
||||
GrGLGpu(std::unique_ptr<GrGLContext>, GrContext*);
|
||||
GrGLGpu(std::unique_ptr<GrGLContext>, GrDirectContext*);
|
||||
|
||||
// GrGpu overrides
|
||||
GrBackendTexture onCreateBackendTexture(SkISize dimensions,
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/gl/GrGLGpu.h"
|
||||
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
#include "src/gpu/GrProgramDesc.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "include/core/SkTraceMemoryDump.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrGpuResourcePriv.h"
|
||||
#include "src/gpu/GrRenderTargetPriv.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "include/core/SkTraceMemoryDump.h"
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrTexturePriv.h"
|
||||
#include "src/gpu/gl/GrGLGpu.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "src/gpu/gl/builders/GrGLProgramBuilder.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkATrace.h"
|
||||
#include "src/core/SkAutoMalloc.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
|
@ -44,12 +44,12 @@ int GrMockGpu::NextExternalRenderTargetID() {
|
||||
}
|
||||
|
||||
sk_sp<GrGpu> GrMockGpu::Make(const GrMockOptions* mockOptions,
|
||||
const GrContextOptions& contextOptions, GrContext* context) {
|
||||
const GrContextOptions& contextOptions, GrDirectContext* direct) {
|
||||
static const GrMockOptions kDefaultOptions = GrMockOptions();
|
||||
if (!mockOptions) {
|
||||
mockOptions = &kDefaultOptions;
|
||||
}
|
||||
return sk_sp<GrGpu>(new GrMockGpu(context, *mockOptions, contextOptions));
|
||||
return sk_sp<GrGpu>(new GrMockGpu(direct, *mockOptions, contextOptions));
|
||||
}
|
||||
|
||||
GrOpsRenderPass* GrMockGpu::getOpsRenderPass(
|
||||
@ -68,9 +68,9 @@ void GrMockGpu::submit(GrOpsRenderPass* renderPass) {
|
||||
delete renderPass;
|
||||
}
|
||||
|
||||
GrMockGpu::GrMockGpu(GrContext* context, const GrMockOptions& options,
|
||||
GrMockGpu::GrMockGpu(GrDirectContext* direct, const GrMockOptions& options,
|
||||
const GrContextOptions& contextOptions)
|
||||
: INHERITED(context)
|
||||
: INHERITED(direct)
|
||||
, fMockOptions(options) {
|
||||
fCaps.reset(new GrMockCaps(contextOptions, options));
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ class GrPipeline;
|
||||
|
||||
class GrMockGpu : public GrGpu {
|
||||
public:
|
||||
static sk_sp<GrGpu> Make(const GrMockOptions*, const GrContextOptions&, GrContext*);
|
||||
static sk_sp<GrGpu> Make(const GrMockOptions*, const GrContextOptions&, GrDirectContext*);
|
||||
|
||||
~GrMockGpu() override {}
|
||||
|
||||
@ -57,7 +57,7 @@ public:
|
||||
void checkFinishProcs() override {}
|
||||
|
||||
private:
|
||||
GrMockGpu(GrContext* context, const GrMockOptions&, const GrContextOptions&);
|
||||
GrMockGpu(GrDirectContext*, const GrMockOptions&, const GrContextOptions&);
|
||||
|
||||
void onResetContext(uint32_t resetBits) override {}
|
||||
|
||||
|
@ -33,8 +33,8 @@ namespace SkSL {
|
||||
|
||||
class GrMtlGpu : public GrGpu {
|
||||
public:
|
||||
static sk_sp<GrGpu> Make(GrContext* context, const GrContextOptions& options,
|
||||
id<MTLDevice> device, id<MTLCommandQueue> queue);
|
||||
static sk_sp<GrGpu> Make(GrDirectContext*, const GrContextOptions&,
|
||||
id<MTLDevice>, id<MTLCommandQueue>);
|
||||
~GrMtlGpu() override;
|
||||
|
||||
void disconnect(DisconnectType) override;
|
||||
@ -117,8 +117,8 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
GrMtlGpu(GrContext* context, const GrContextOptions& options,
|
||||
id<MTLDevice> device, id<MTLCommandQueue> queue, MTLFeatureSet featureSet);
|
||||
GrMtlGpu(GrDirectContext*, const GrContextOptions&, id<MTLDevice>,
|
||||
id<MTLCommandQueue>, MTLFeatureSet);
|
||||
|
||||
void destroyResources();
|
||||
|
||||
|
@ -100,7 +100,7 @@ static bool get_feature_set(id<MTLDevice> device, MTLFeatureSet* featureSet) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sk_sp<GrGpu> GrMtlGpu::Make(GrContext* context, const GrContextOptions& options,
|
||||
sk_sp<GrGpu> GrMtlGpu::Make(GrDirectContext* direct, const GrContextOptions& options,
|
||||
id<MTLDevice> device, id<MTLCommandQueue> queue) {
|
||||
if (!device || !queue) {
|
||||
return nullptr;
|
||||
@ -109,12 +109,12 @@ sk_sp<GrGpu> GrMtlGpu::Make(GrContext* context, const GrContextOptions& options,
|
||||
if (!get_feature_set(device, &featureSet)) {
|
||||
return nullptr;
|
||||
}
|
||||
return sk_sp<GrGpu>(new GrMtlGpu(context, options, device, queue, featureSet));
|
||||
return sk_sp<GrGpu>(new GrMtlGpu(direct, options, device, queue, featureSet));
|
||||
}
|
||||
|
||||
GrMtlGpu::GrMtlGpu(GrContext* context, const GrContextOptions& options,
|
||||
GrMtlGpu::GrMtlGpu(GrDirectContext* direct, const GrContextOptions& options,
|
||||
id<MTLDevice> device, id<MTLCommandQueue> queue, MTLFeatureSet featureSet)
|
||||
: INHERITED(context)
|
||||
: INHERITED(direct)
|
||||
, fDevice(device)
|
||||
, fQueue(queue)
|
||||
, fCmdBuffer(nullptr)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "src/gpu/mtl/GrMtlPipelineStateBuilder.h"
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkReadBuffer.h"
|
||||
#include "src/core/SkTraceEvent.h"
|
||||
#include "src/gpu/GrAutoLocaleSetter.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/gpu/mtl/GrMtlResourceProvider.h"
|
||||
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/mtl/GrMtlCommandBuffer.h"
|
||||
#include "src/gpu/mtl/GrMtlGpu.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "include/core/SkRefCnt.h"
|
||||
#include "include/gpu/GrTypes.h"
|
||||
|
||||
class GrContext;
|
||||
class GrDirectContext;
|
||||
class GrGpu;
|
||||
struct GrContextOptions;
|
||||
|
||||
@ -21,7 +21,8 @@ struct GrContextOptions;
|
||||
*/
|
||||
class GrMtlTrampoline {
|
||||
public:
|
||||
static sk_sp<GrGpu> MakeGpu(GrContext*, const GrContextOptions&, void* device, void* queue);
|
||||
static sk_sp<GrGpu> MakeGpu(GrDirectContext*, const GrContextOptions&,
|
||||
void* device, void* queue);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -13,11 +13,11 @@
|
||||
#error This file must be compiled with Arc. Use -fobjc-arc flag
|
||||
#endif
|
||||
|
||||
sk_sp<GrGpu> GrMtlTrampoline::MakeGpu(GrContext* context,
|
||||
sk_sp<GrGpu> GrMtlTrampoline::MakeGpu(GrDirectContext* direct,
|
||||
const GrContextOptions& options,
|
||||
void* device,
|
||||
void* queue) {
|
||||
return GrMtlGpu::Make(context,
|
||||
return GrMtlGpu::Make(direct,
|
||||
options,
|
||||
(__bridge id<MTLDevice>)device,
|
||||
(__bridge id<MTLCommandQueue>)queue);
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "include/gpu/GrBackendSemaphore.h"
|
||||
#include "include/gpu/GrBackendSurface.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "include/private/SkTo.h"
|
||||
#include "src/core/SkCompressedDataUtils.h"
|
||||
#include "src/core/SkConvertPixels.h"
|
||||
@ -63,7 +64,7 @@
|
||||
#define VK_CALL_RET(RET, X) GR_VK_CALL_RESULT(this, RET, X)
|
||||
|
||||
sk_sp<GrGpu> GrVkGpu::Make(const GrVkBackendContext& backendContext,
|
||||
const GrContextOptions& options, GrContext* context) {
|
||||
const GrContextOptions& options, GrDirectContext* direct) {
|
||||
if (backendContext.fInstance == VK_NULL_HANDLE ||
|
||||
backendContext.fPhysicalDevice == VK_NULL_HANDLE ||
|
||||
backendContext.fDevice == VK_NULL_HANDLE ||
|
||||
@ -153,7 +154,7 @@ sk_sp<GrGpu> GrVkGpu::Make(const GrVkBackendContext& backendContext,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
sk_sp<GrVkGpu> vkGpu(new GrVkGpu(context, options, backendContext, interface,
|
||||
sk_sp<GrVkGpu> vkGpu(new GrVkGpu(direct, options, backendContext, interface,
|
||||
instanceVersion, physDevVersion,
|
||||
std::move(memoryAllocator)));
|
||||
if (backendContext.fProtectedContext == GrProtected::kYes &&
|
||||
@ -165,11 +166,11 @@ sk_sp<GrGpu> GrVkGpu::Make(const GrVkBackendContext& backendContext,
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrVkGpu::GrVkGpu(GrContext* context, const GrContextOptions& options,
|
||||
GrVkGpu::GrVkGpu(GrDirectContext* direct, const GrContextOptions& options,
|
||||
const GrVkBackendContext& backendContext, sk_sp<const GrVkInterface> interface,
|
||||
uint32_t instanceVersion, uint32_t physicalDeviceVersion,
|
||||
sk_sp<GrVkMemoryAllocator> memoryAllocator)
|
||||
: INHERITED(context)
|
||||
: INHERITED(direct)
|
||||
, fInterface(std::move(interface))
|
||||
, fMemoryAllocator(std::move(memoryAllocator))
|
||||
, fPhysicalDevice(backendContext.fPhysicalDevice)
|
||||
@ -2031,7 +2032,7 @@ void GrVkGpu::addImageMemoryBarrier(const GrManagedResource* resource,
|
||||
VkPipelineStageFlags dstStageMask,
|
||||
bool byRegion,
|
||||
VkImageMemoryBarrier* barrier) const {
|
||||
// If we are in the middle of destroying or abandoning the GrContext we may hit a release proc
|
||||
// If we are in the middle of destroying or abandoning the context we may hit a release proc
|
||||
// that triggers the destruction of a GrVkImage. This could cause us to try and transfer the
|
||||
// VkImage back to the original queue. In this state we don't submit anymore work and we may not
|
||||
// have a current command buffer. Thus we won't do the queue transfer.
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "src/gpu/vk/GrVkSemaphore.h"
|
||||
#include "src/gpu/vk/GrVkUtil.h"
|
||||
|
||||
class GrDirectContext;
|
||||
class GrPipeline;
|
||||
|
||||
class GrVkBufferImpl;
|
||||
@ -38,7 +39,7 @@ namespace SkSL {
|
||||
|
||||
class GrVkGpu : public GrGpu {
|
||||
public:
|
||||
static sk_sp<GrGpu> Make(const GrVkBackendContext&, const GrContextOptions&, GrContext*);
|
||||
static sk_sp<GrGpu> Make(const GrVkBackendContext&, const GrContextOptions&, GrDirectContext*);
|
||||
|
||||
~GrVkGpu() override;
|
||||
|
||||
@ -178,7 +179,7 @@ private:
|
||||
kSkip_SyncQueue
|
||||
};
|
||||
|
||||
GrVkGpu(GrContext*, const GrContextOptions&, const GrVkBackendContext&,
|
||||
GrVkGpu(GrDirectContext*, const GrContextOptions&, const GrVkBackendContext&,
|
||||
sk_sp<const GrVkInterface>, uint32_t instanceVersion, uint32_t physicalDeviceVersion,
|
||||
sk_sp<GrVkMemoryAllocator>);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "include/gpu/GrContext.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkTraceEvent.h"
|
||||
#include "src/gpu/GrAutoLocaleSetter.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkOpts.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrProcessor.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "src/gpu/vk/GrVkResourceProvider.h"
|
||||
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/core/SkTaskGroup.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrSamplerState.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "src/gpu/vk/GrVkUtil.h"
|
||||
|
||||
#include "include/gpu/GrDirectContext.h"
|
||||
#include "src/gpu/GrContextPriv.h"
|
||||
#include "src/gpu/GrDataUtils.h"
|
||||
#include "src/gpu/vk/GrVkGpu.h"
|
||||
|
Loading…
Reference in New Issue
Block a user