Get EGLimage functions out of GrGLInterface.
Only used in test code which can just directly call these. Also removed related code in interface assemble/validate generator. Change-Id: I7e821ebb9328bdd2a54d8ab3af929399ca0517d5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213480 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
945d1e538c
commit
bc233135e4
@ -325,10 +325,6 @@ public:
|
||||
|
||||
/* EXT_window_rectangles */
|
||||
GrGLFunction<GrGLWindowRectanglesFn> fWindowRectangles;
|
||||
|
||||
/* EGL functions */
|
||||
GrGLFunction<GrEGLCreateImageFn> fEGLCreateImage;
|
||||
GrGLFunction<GrEGLDestroyImageFn> fEGLDestroyImage;
|
||||
} fFunctions;
|
||||
|
||||
#if GR_TEST_UTILS
|
||||
|
@ -416,14 +416,6 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc
|
||||
GET_PROC_SUFFIX(WindowRectangles, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("EGL_KHR_image")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
} else if (extensions.has("EGL_KHR_image_base")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,0)) {
|
||||
GET_PROC(ClientWaitSync);
|
||||
GET_PROC(DeleteSync);
|
||||
|
@ -394,14 +394,6 @@ sk_sp<const GrGLInterface> GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc g
|
||||
GET_PROC_SUFFIX(WindowRectangles, EXT);
|
||||
}
|
||||
|
||||
if (extensions.has("EGL_KHR_image")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
} else if (extensions.has("EGL_KHR_image_base")) {
|
||||
GET_EGL_PROC_SUFFIX(CreateImage, KHR);
|
||||
GET_EGL_PROC_SUFFIX(DestroyImage, KHR);
|
||||
}
|
||||
|
||||
if (glVer >= GR_GL_VER(3,2)) {
|
||||
GET_PROC(ClientWaitSync);
|
||||
GET_PROC(DeleteSync);
|
||||
|
@ -580,18 +580,6 @@ bool GrGLInterface::validate() const {
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
fExtensions.has("EGL_KHR_image") ||
|
||||
fExtensions.has("EGL_KHR_image_base"))) ||
|
||||
(GR_IS_GR_GL_ES(fStandard) && (
|
||||
fExtensions.has("EGL_KHR_image") ||
|
||||
fExtensions.has("EGL_KHR_image_base")))) {
|
||||
if (!fFunctions.fEGLCreateImage ||
|
||||
!fFunctions.fEGLDestroyImage) {
|
||||
RETURN_FALSE_INTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
if ((GR_IS_GR_GL(fStandard) && (
|
||||
(glVer >= GR_GL_VER(3,2)) ||
|
||||
fExtensions.has("GL_ARB_sync"))) ||
|
||||
|
@ -296,21 +296,15 @@ GrEGLImage ANGLEGLContext::texture2DToEGLImage(GrGLuint texID) const {
|
||||
if (!this->gl()->hasExtension("EGL_KHR_gl_texture_2D_image")) {
|
||||
return GR_EGL_NO_IMAGE;
|
||||
}
|
||||
GrEGLImage img;
|
||||
GrEGLint attribs[] = { GR_EGL_GL_TEXTURE_LEVEL, 0,
|
||||
GR_EGL_IMAGE_PRESERVED, GR_EGL_TRUE,
|
||||
GR_EGL_NONE };
|
||||
EGLAttrib attribs[] = { GR_EGL_GL_TEXTURE_LEVEL, 0,
|
||||
GR_EGL_IMAGE_PRESERVED, GR_EGL_TRUE,
|
||||
GR_EGL_NONE };
|
||||
// 64 bit cast is to shut Visual C++ up about casting 32 bit value to a pointer.
|
||||
GrEGLClientBuffer clientBuffer = reinterpret_cast<GrEGLClientBuffer>((uint64_t)texID);
|
||||
GR_GL_CALL_RET(this->gl(), img,
|
||||
EGLCreateImage(fDisplay, fContext, GR_EGL_GL_TEXTURE_2D, clientBuffer,
|
||||
attribs));
|
||||
return img;
|
||||
return eglCreateImage(fDisplay, fContext, GR_EGL_GL_TEXTURE_2D, clientBuffer, attribs);
|
||||
}
|
||||
|
||||
void ANGLEGLContext::destroyEGLImage(GrEGLImage image) const {
|
||||
GR_GL_CALL(this->gl(), EGLDestroyImage(fDisplay, image));
|
||||
}
|
||||
void ANGLEGLContext::destroyEGLImage(GrEGLImage image) const { eglDestroyImage(fDisplay, image); }
|
||||
|
||||
GrGLuint ANGLEGLContext::eglImageToExternalTexture(GrEGLImage image) const {
|
||||
GrGLClearErr(this->gl());
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "tools/gpu/gl/GLTestContext.h"
|
||||
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#define EGL_EGLEXT_PROTOTYPES
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include <EGL/egl.h>
|
||||
@ -243,16 +245,13 @@ GrEGLImage EGLGLTestContext::texture2DToEGLImage(GrGLuint texID) const {
|
||||
if (!this->gl()->hasExtension("EGL_KHR_gl_texture_2D_image")) {
|
||||
return GR_EGL_NO_IMAGE;
|
||||
}
|
||||
GrEGLImage img;
|
||||
GrEGLint attribs[] = { GR_EGL_GL_TEXTURE_LEVEL, 0, GR_EGL_NONE };
|
||||
EGLint attribs[] = { GR_EGL_GL_TEXTURE_LEVEL, 0, GR_EGL_NONE };
|
||||
GrEGLClientBuffer clientBuffer = reinterpret_cast<GrEGLClientBuffer>(texID);
|
||||
GR_GL_CALL_RET(this->gl(), img,
|
||||
EGLCreateImage(fDisplay, fContext, GR_EGL_GL_TEXTURE_2D, clientBuffer, attribs));
|
||||
return img;
|
||||
return eglCreateImageKHR(fDisplay, fContext, GR_EGL_GL_TEXTURE_2D, clientBuffer, attribs);
|
||||
}
|
||||
|
||||
void EGLGLTestContext::destroyEGLImage(GrEGLImage image) const {
|
||||
GR_GL_CALL(this->gl(), EGLDestroyImage(fDisplay, image));
|
||||
eglDestroyImageKHR(fDisplay, image);
|
||||
}
|
||||
|
||||
GrGLuint EGLGLTestContext::eglImageToExternalTexture(GrEGLImage image) const {
|
||||
|
@ -54,7 +54,6 @@ type FeatureSet struct {
|
||||
TestOnlyFunctions []string `json:"test_functions"`
|
||||
|
||||
Required bool `json:"required"`
|
||||
EGLProc bool `json:"egl_proc"`
|
||||
}
|
||||
|
||||
// Requirement lists how we know if a function exists. Extension is the
|
||||
@ -126,7 +125,6 @@ func fillAssembleTemplate(template string, features []FeatureSet, getReqs Requir
|
||||
if len(reqs) == 0 {
|
||||
continue
|
||||
}
|
||||
isEGL := feature.EGLProc
|
||||
// blocks holds all the if blocks generated - it will be joined with else
|
||||
// after and appended to content
|
||||
blocks := []string{}
|
||||
@ -150,13 +148,13 @@ func fillAssembleTemplate(template string, features []FeatureSet, getReqs Requir
|
||||
// sort for determinism
|
||||
sort.Strings(feature.Functions)
|
||||
for _, function := range feature.Functions {
|
||||
block = assembleFunction(block, ifExpr, function, isEGL, req)
|
||||
block = assembleFunction(block, ifExpr, function, req)
|
||||
}
|
||||
sort.Strings(feature.TestOnlyFunctions)
|
||||
if len(feature.TestOnlyFunctions) > 0 {
|
||||
block += "#if GR_TEST_UTILS\n"
|
||||
for _, function := range feature.TestOnlyFunctions {
|
||||
block = assembleFunction(block, ifExpr, function, isEGL, req)
|
||||
block = assembleFunction(block, ifExpr, function, req)
|
||||
}
|
||||
block += "#endif\n"
|
||||
}
|
||||
@ -198,7 +196,7 @@ func fillAssembleTemplate(template string, features []FeatureSet, getReqs Requir
|
||||
// assembleFunction is a little helper that will add a function to the interface
|
||||
// using an appropriate macro (e.g. if the function is added)
|
||||
// with an extension.
|
||||
func assembleFunction(block, ifExpr, function string, isEGL bool, req Requirement) string {
|
||||
func assembleFunction(block, ifExpr, function string, req Requirement) string {
|
||||
if ifExpr != "" {
|
||||
// extra tab for being in an if statement
|
||||
block += SPACER
|
||||
@ -213,9 +211,7 @@ func assembleFunction(block, ifExpr, function string, isEGL bool, req Requiremen
|
||||
if req.SuffixOverride != nil {
|
||||
suffix = *req.SuffixOverride
|
||||
}
|
||||
if isEGL {
|
||||
block = addLine(block, fmt.Sprintf("GET_EGL_PROC_SUFFIX(%s, %s);", function, suffix))
|
||||
} else if req.Extension == CORE_FEATURE || suffix == "" {
|
||||
if req.Extension == CORE_FEATURE || suffix == "" {
|
||||
block = addLine(block, fmt.Sprintf("GET_PROC(%s);", function))
|
||||
} else if req.Extension != "" {
|
||||
block = addLine(block, fmt.Sprintf("GET_PROC_SUFFIX(%s, %s);", function, suffix))
|
||||
@ -255,10 +251,9 @@ func requirementIfExpression(req Requirement, isLocal bool) string {
|
||||
// driveSuffix returns the suffix of the function associated with the given
|
||||
// extension.
|
||||
func deriveSuffix(ext string) string {
|
||||
// Some extensions begin with GL_ or EGL_ and then have the actual
|
||||
// Some extensions begin with GL_ and then have the actual
|
||||
// extension like KHR, EXT etc.
|
||||
ext = strings.TrimPrefix(ext, "GL_")
|
||||
ext = strings.TrimPrefix(ext, "EGL_")
|
||||
return strings.Split(ext, "_")[0]
|
||||
}
|
||||
|
||||
@ -359,22 +354,14 @@ func functionCheck(feature FeatureSet, indentLevel int) string {
|
||||
if in(function, feature.OptionalFunctions) {
|
||||
continue
|
||||
}
|
||||
if feature.EGLProc {
|
||||
checks = append(checks, "!fFunctions.fEGL"+function)
|
||||
} else {
|
||||
checks = append(checks, "!fFunctions.f"+function)
|
||||
}
|
||||
checks = append(checks, "!fFunctions.f"+function)
|
||||
}
|
||||
testOnly := []string{}
|
||||
for _, function := range feature.TestOnlyFunctions {
|
||||
if in(function, feature.OptionalFunctions) {
|
||||
continue
|
||||
}
|
||||
if feature.EGLProc {
|
||||
testOnly = append(testOnly, "!fFunctions.fEGL"+function)
|
||||
} else {
|
||||
testOnly = append(testOnly, "!fFunctions.f"+function)
|
||||
}
|
||||
testOnly = append(testOnly, "!fFunctions.f"+function)
|
||||
}
|
||||
for _, hcf := range feature.HardCodeFunctions {
|
||||
checks = append(checks, "!fFunctions."+hcf.PtrName)
|
||||
|
@ -539,19 +539,6 @@
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"ext": "EGL_KHR_image"},
|
||||
{"ext": "EGL_KHR_image_base"}],
|
||||
"GLES": [{"ext": "EGL_KHR_image"},
|
||||
{"ext": "EGL_KHR_image_base"}],
|
||||
"WebGL": null,
|
||||
|
||||
"functions": [
|
||||
"CreateImage", "DestroyImage",
|
||||
],
|
||||
"egl_proc": true
|
||||
},
|
||||
|
||||
{
|
||||
"GL": [{"min_version": [3, 2], "ext": "<core>"},
|
||||
{/* else if */ "ext": "GL_ARB_sync"}],
|
||||
|
Loading…
Reference in New Issue
Block a user