Add arc support to gpu Obj c++ code
This is mainly for getting ready to start adding lots of metal backend code. I've also update the "gpu tools" target to require ARC with involved updating one IOS file in there. Bug: skia: Change-Id: Ied22e8fe7532445cc274efb529e3450654a6614b Reviewed-on: https://skia-review.googlesource.com/22484 Commit-Queue: Greg Daniel <egdaniel@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Mike Klein <mtklein@google.com>
This commit is contained in:
parent
7cbf5e3e03
commit
6b7e0e2c74
4
BUILD.gn
4
BUILD.gn
@ -531,10 +531,12 @@ optional("gpu") {
|
||||
public_defines += [ "SK_ENABLE_SPIRV_VALIDATION" ]
|
||||
}
|
||||
|
||||
cflags_objcc = []
|
||||
if (skia_use_metal) {
|
||||
public_defines += [ "SK_METAL" ]
|
||||
sources += skia_metal_sources
|
||||
libs += [ "Metal.framework" ]
|
||||
cflags_objcc += [ "-fobjc-arc" ]
|
||||
}
|
||||
}
|
||||
|
||||
@ -973,6 +975,8 @@ if (skia_enable_tools) {
|
||||
]
|
||||
}
|
||||
|
||||
cflags_objcc = [ "-fobjc-arc" ]
|
||||
|
||||
if (skia_use_angle) {
|
||||
deps += [ "//third_party/angle2" ]
|
||||
sources += [ "tools/gpu/gl/angle/GLTestContext_angle.cpp" ]
|
||||
|
@ -263,6 +263,7 @@ config("warnings") {
|
||||
cflags = []
|
||||
cflags_cc = []
|
||||
cflags_objc = []
|
||||
cflags_objcc = []
|
||||
if (is_win) {
|
||||
cflags += [
|
||||
"/W3", # Turn on lots of warnings.
|
||||
@ -356,6 +357,10 @@ config("warnings") {
|
||||
"-Wno-direct-ivar-access",
|
||||
"-Wno-objc-interface-ivars",
|
||||
]
|
||||
cflags_objcc += [
|
||||
"-Wno-direct-ivar-access",
|
||||
"-Wno-objcc-interface-ivars",
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ template("gcc_like_toolchain") {
|
||||
|
||||
tool("objcxx") {
|
||||
depfile = "{{output}}.d"
|
||||
command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objc}} -c {{source}} -o {{output}}"
|
||||
command = "$cc_wrapper $cxx -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objcc}} -c {{source}} -o {{output}}"
|
||||
depsformat = "gcc"
|
||||
outputs = [
|
||||
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.o",
|
||||
|
@ -7,6 +7,10 @@
|
||||
|
||||
#include "GrMtlGpu.h"
|
||||
|
||||
#if !__has_feature(objc_arc)
|
||||
#error This file must be compiled with Arc. Use -fobjc-arc flag
|
||||
#endif
|
||||
|
||||
GrGpu* GrMtlGpu::Create(GrBackendContext backendContext, const GrContextOptions& options,
|
||||
GrContext* context) {
|
||||
return nullptr;
|
||||
|
@ -26,7 +26,7 @@ private:
|
||||
void onPlatformSwapBuffers() const override;
|
||||
GrGLFuncPtr onPlatformGetProcAddress(const char*) const override;
|
||||
|
||||
void* fEAGLContext;
|
||||
EAGLContext* fEAGLContext;
|
||||
void* fGLLibrary;
|
||||
};
|
||||
|
||||
@ -35,13 +35,13 @@ IOSGLTestContext::IOSGLTestContext(IOSGLTestContext* shareContext)
|
||||
, fGLLibrary(RTLD_DEFAULT) {
|
||||
|
||||
if (shareContext) {
|
||||
EAGLContext* iosShareContext = (EAGLContext*)(shareContext->fEAGLContext);
|
||||
EAGLContext* iosShareContext = shareContext->fEAGLContext;
|
||||
fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2
|
||||
sharegroup: [iosShareContext sharegroup]];
|
||||
} else {
|
||||
fEAGLContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
|
||||
}
|
||||
[EAGLContext setCurrentContext:EAGLCTX];
|
||||
[EAGLContext setCurrentContext:fEAGLContext];
|
||||
|
||||
sk_sp<const GrGLInterface> gl(GrGLCreateNativeInterface());
|
||||
if (NULL == gl.get()) {
|
||||
@ -69,11 +69,10 @@ IOSGLTestContext::~IOSGLTestContext() {
|
||||
|
||||
void IOSGLTestContext::destroyGLContext() {
|
||||
if (fEAGLContext) {
|
||||
if ([EAGLContext currentContext] == EAGLCTX) {
|
||||
if ([EAGLContext currentContext] == fEAGLContext) {
|
||||
[EAGLContext setCurrentContext:nil];
|
||||
}
|
||||
[EAGLCTX release];
|
||||
fEAGLContext = NULL;
|
||||
fEAGLContext = nil;
|
||||
}
|
||||
if (RTLD_DEFAULT != fGLLibrary) {
|
||||
dlclose(fGLLibrary);
|
||||
@ -82,7 +81,7 @@ void IOSGLTestContext::destroyGLContext() {
|
||||
|
||||
|
||||
void IOSGLTestContext::onPlatformMakeCurrent() const {
|
||||
if (![EAGLContext setCurrentContext:EAGLCTX]) {
|
||||
if (![EAGLContext setCurrentContext:fEAGLContext]) {
|
||||
SkDebugf("Could not set the context.\n");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user