Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Unified Diff: src/gpu/gl/GrGLAssembleInterface.cpp

Issue 1434813002: Add support for EGLImage to GrGLInterface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/gl/GrGLTypes.h ('k') | src/gpu/gl/GrGLCreateNullInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLAssembleInterface.cpp
diff --git a/src/gpu/gl/GrGLAssembleInterface.cpp b/src/gpu/gl/GrGLAssembleInterface.cpp
index ce439ec63f50bd2a3a125951e00e814f5d9c585b..35c8756c302e87ee10ec0b6cd801b8255bc64f41 100644
--- a/src/gpu/gl/GrGLAssembleInterface.cpp
+++ b/src/gpu/gl/GrGLAssembleInterface.cpp
@@ -14,6 +14,8 @@
#define GET_PROC_SUFFIX(F, S) functions->f ## F = (GrGL ## F ## Proc) get(ctx, "gl" #F #S)
#define GET_PROC_LOCAL(F) GrGL ## F ## Proc F = (GrGL ## F ## Proc) get(ctx, "gl" #F)
+#define GET_EGL_PROC_SUFFIX(F, S) functions->f ## F = (GrEGL ## F ## Proc) get(ctx, "egl" #F #S)
+
const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
if (nullptr == GetString) {
@@ -35,6 +37,21 @@ const GrGLInterface* GrGLAssembleInterface(void* ctx, GrGLGetProc get) {
return nullptr;
}
+static void get_egl_query_and_display(GrEGLQueryStringProc* queryString, GrEGLDisplay* display,
+ void* ctx, GrGLGetProc get) {
+ *queryString = (GrEGLQueryStringProc) get(ctx, "eglQueryString");
+ *display = GR_EGL_NO_DISPLAY;
+ if (*queryString) {
+ GrEGLGetCurrentDisplayProc getCurrentDisplay =
+ (GrEGLGetCurrentDisplayProc) get(ctx, "eglGetCurrentDisplay");
+ if (getCurrentDisplay) {
+ *display = getCurrentDisplay();
+ } else {
+ *queryString = nullptr;
+ }
+ }
+}
+
const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetString);
GET_PROC_LOCAL(GetStringi);
@@ -53,8 +70,12 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
return nullptr;
}
+ GrEGLQueryStringProc queryString;
+ GrEGLDisplay display;
+ get_egl_query_and_display(&queryString, &display, ctx, get);
GrGLExtensions extensions;
- if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
+ if (!extensions.init(kGL_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
+ display)) {
return nullptr;
}
@@ -470,6 +491,11 @@ const GrGLInterface* GrGLAssembleGLInterface(void* ctx, GrGLGetProc get) {
GET_PROC(ObjectLabel);
}
+ if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
+ GET_EGL_PROC_SUFFIX(CreateImage, KHR);
+ GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
+ }
+
interface->fStandard = kGL_GrGLStandard;
interface->fExtensions.swap(&extensions);
@@ -491,8 +517,12 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC_LOCAL(GetIntegerv);
GET_PROC_LOCAL(GetStringi);
+ GrEGLQueryStringProc queryString;
+ GrEGLDisplay display;
+ get_egl_query_and_display(&queryString, &display, ctx, get);
GrGLExtensions extensions;
- if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv)) {
+ if (!extensions.init(kGLES_GrGLStandard, GetString, GetStringi, GetIntegerv, queryString,
+ display)) {
return nullptr;
}
@@ -779,6 +809,11 @@ const GrGLInterface* GrGLAssembleGLESInterface(void* ctx, GrGLGetProc get) {
GET_PROC_SUFFIX(BindUniformLocation, CHROMIUM);
}
+ if (extensions.has("EGL_KHR_image") || extensions.has("EGL_KHR_image_base")) {
+ GET_EGL_PROC_SUFFIX(CreateImage, KHR);
+ GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
+ }
+
interface->fStandard = kGLES_GrGLStandard;
interface->fExtensions.swap(&extensions);
« no previous file with comments | « include/gpu/gl/GrGLTypes.h ('k') | src/gpu/gl/GrGLCreateNullInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698