From e0da9cefcd5adebee2de8857c577bb86a882922a Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Tue, 16 Apr 2019 14:34:51 -0400 Subject: [PATCH] Pack handle type enum for glImportMemoryFd & glImportSemaphoreFd Bug: angleproject:3289 Change-Id: Ic20b1d55641494b46622e1e28d93e2ca30655ea6 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1566143 Commit-Queue: Michael Spang Reviewed-by: Geoff Lang --- scripts/entry_point_packed_gl_enums.json | 6 +++++ scripts/run_code_generation_hashes.json | 12 +++++----- src/common/PackedGLEnums_autogen.cpp | 24 +++++++++++++++++++ src/common/PackedGLEnums_autogen.h | 12 ++++++++++ src/common/packed_gl_enums.json | 4 ++++ src/libANGLE/Context.cpp | 4 ++-- src/libANGLE/Context.h | 4 ++-- src/libANGLE/validationES2.cpp | 7 ++++-- src/libANGLE/validationESEXT_autogen.h | 7 ++++-- .../entry_points_gles_ext_autogen.cpp | 20 +++++++++------- 10 files changed, 78 insertions(+), 22 deletions(-) diff --git a/scripts/entry_point_packed_gl_enums.json b/scripts/entry_point_packed_gl_enums.json index 4bd8d3cf7..be25af9ef 100644 --- a/scripts/entry_point_packed_gl_enums.json +++ b/scripts/entry_point_packed_gl_enums.json @@ -265,6 +265,12 @@ "glGetTexParameterxv": { "target": "TextureType" }, + "glImportMemoryFdEXT": { + "handleType": "HandleType" + }, + "glImportSemaphoreFdEXT": { + "handleType": "HandleType" + }, "glLightf" : { "pname" : "LightParameter" }, diff --git a/scripts/run_code_generation_hashes.json b/scripts/run_code_generation_hashes.json index af76866d1..550354d56 100644 --- a/scripts/run_code_generation_hashes.json +++ b/scripts/run_code_generation_hashes.json @@ -92,7 +92,7 @@ "GL/EGL entry points:scripts/egl_angle_ext.xml": "745534010f31fbe8e1a1fcddce15ed2d", "GL/EGL entry points:scripts/entry_point_packed_gl_enums.json": - "263af9517ddb1c9f3ba83894fe837095", + "384494b3910e97cc05db34fa3cff54b8", "GL/EGL entry points:scripts/generate_entry_points.py": "70f826962543838df966ed8c7155d0dd", "GL/EGL entry points:scripts/gl.xml": @@ -112,7 +112,7 @@ "GL/EGL entry points:src/libANGLE/validationES3_autogen.h": "4617942e5bf67fa5e35675daf66afc5c", "GL/EGL entry points:src/libANGLE/validationESEXT_autogen.h": - "8e501839a051c0f1b646343b665369df", + "9401b0db013a8b95431ce2a4eb8a0405", "GL/EGL entry points:src/libGLESv2/entry_points_enum_autogen.h": "1c50aa0844ece3d673d563a8b23a7166", "GL/EGL entry points:src/libGLESv2/entry_points_gles_1_0_autogen.cpp": @@ -132,7 +132,7 @@ "GL/EGL entry points:src/libGLESv2/entry_points_gles_3_1_autogen.h": "043d09a964c740067bf4279e0b544aed", "GL/EGL entry points:src/libGLESv2/entry_points_gles_ext_autogen.cpp": - "9131b9e072a25e09f10cedaccfdd68f8", + "d4ef39b11966fa6a7aff057b8d67b679", "GL/EGL entry points:src/libGLESv2/entry_points_gles_ext_autogen.h": "2c746d064fe2d8ed4769dc9acbb9ad67", "GL/EGL entry points:src/libGLESv2/libGLESv2_autogen.cpp": @@ -368,15 +368,15 @@ "packed enum:src/common/PackedEGLEnums_autogen.h": "4073274726e0c926765c5ab8b21dc3de", "packed enum:src/common/PackedGLEnums_autogen.cpp": - "b64a7cadc5c8c054f788d1e0b58a11a1", + "e9ac6361c857133a2f1cea1c3eaabd7e", "packed enum:src/common/PackedGLEnums_autogen.h": - "80724ac8fc2cbdebee81fb43b4345c1a", + "0b43ae9a66b731dfbf30e7edf913973e", "packed enum:src/common/gen_packed_gl_enums.py": "0cd1a1cb6d5fde8cbac2994db24eb901", "packed enum:src/common/packed_egl_enums.json": "5f591d220ee53b6e54a27d1523a3ab79", "packed enum:src/common/packed_gl_enums.json": - "6e2e2845f96754509b8add1f77e203b3", + "b148c43156d73b60cbd936118beeeb41", "proc table:src/libGLESv2/gen_proc_table.py": "20ebe54894d613de42b0b15ca34078d9", "proc table:src/libGLESv2/proc_table_autogen.cpp": diff --git a/src/common/PackedGLEnums_autogen.cpp b/src/common/PackedGLEnums_autogen.cpp index 66fb92697..916d84da8 100644 --- a/src/common/PackedGLEnums_autogen.cpp +++ b/src/common/PackedGLEnums_autogen.cpp @@ -335,6 +335,30 @@ GLenum ToGLenum(FogMode from) } } +template <> +HandleType FromGLenum(GLenum from) +{ + switch (from) + { + case GL_HANDLE_TYPE_OPAQUE_FD_EXT: + return HandleType::OpaqueFd; + default: + return HandleType::InvalidEnum; + } +} + +GLenum ToGLenum(HandleType from) +{ + switch (from) + { + case HandleType::OpaqueFd: + return GL_HANDLE_TYPE_OPAQUE_FD_EXT; + default: + UNREACHABLE(); + return 0; + } +} + template <> HintSetting FromGLenum(GLenum from) { diff --git a/src/common/PackedGLEnums_autogen.h b/src/common/PackedGLEnums_autogen.h index 7d8b4fbbb..295bb9e9e 100644 --- a/src/common/PackedGLEnums_autogen.h +++ b/src/common/PackedGLEnums_autogen.h @@ -146,6 +146,18 @@ template <> FogMode FromGLenum(GLenum from); GLenum ToGLenum(FogMode from); +enum class HandleType : uint8_t +{ + OpaqueFd = 0, + + InvalidEnum = 1, + EnumCount = 1, +}; + +template <> +HandleType FromGLenum(GLenum from); +GLenum ToGLenum(HandleType from); + enum class HintSetting : uint8_t { DontCare = 0, diff --git a/src/common/packed_gl_enums.json b/src/common/packed_gl_enums.json index 054e3c906..dc6eeafc7 100644 --- a/src/common/packed_gl_enums.json +++ b/src/common/packed_gl_enums.json @@ -255,5 +255,9 @@ { "FirstVertexConvention": "GL_FIRST_VERTEX_CONVENTION", "LastVertexConvention": "GL_LAST_VERTEX_CONVENTION" + }, + "HandleType": + { + "OpaqueFd": "GL_HANDLE_TYPE_OPAQUE_FD_EXT" } } diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp index bf06988b9..455e1de97 100644 --- a/src/libANGLE/Context.cpp +++ b/src/libANGLE/Context.cpp @@ -7184,7 +7184,7 @@ void Context::bufferStorageMem(TextureType target, GLsizeiptr size, GLuint memor UNIMPLEMENTED(); } -void Context::importMemoryFd(GLuint memory, GLuint64 size, GLenum handleType, GLint fd) +void Context::importMemoryFd(GLuint memory, GLuint64 size, HandleType handleType, GLint fd) { UNIMPLEMENTED(); } @@ -7235,7 +7235,7 @@ void Context::signalSemaphore(GLuint semaphore, UNIMPLEMENTED(); } -void Context::importSemaphoreFd(GLuint semaphore, GLenum handleType, GLint fd) +void Context::importSemaphoreFd(GLuint semaphore, HandleType handleType, GLint fd) { UNIMPLEMENTED(); } diff --git a/src/libANGLE/Context.h b/src/libANGLE/Context.h index 5a49a1289..ddea5be20 100644 --- a/src/libANGLE/Context.h +++ b/src/libANGLE/Context.h @@ -393,7 +393,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl void bufferStorageMem(TextureType target, GLsizeiptr size, GLuint memory, GLuint64 offset); // GL_EXT_memory_object_fd - void importMemoryFd(GLuint memory, GLuint64 size, GLenum handleType, GLint fd); + void importMemoryFd(GLuint memory, GLuint64 size, HandleType handleType, GLint fd); // GL_EXT_semaphore void genSemaphores(GLsizei n, GLuint *semaphores); @@ -415,7 +415,7 @@ class Context final : public egl::LabeledObject, angle::NonCopyable, public angl const GLenum *dstLayouts); // GL_EXT_semaphore_fd - void importSemaphoreFd(GLuint semaphore, GLenum handleType, GLint fd); + void importSemaphoreFd(GLuint semaphore, HandleType handleType, GLint fd); // GLES1 emulation: Interface to entry points ANGLE_GLES1_CONTEXT_API diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp index b65a1ba59..b7143eb2b 100644 --- a/src/libANGLE/validationES2.cpp +++ b/src/libANGLE/validationES2.cpp @@ -3184,7 +3184,7 @@ bool ValidateTexStorageMem3DEXT(Context *context, bool ValidateImportMemoryFdEXT(Context *context, GLuint memory, GLuint64 size, - GLenum handleType, + HandleType handleType, GLint fd) { if (!context->getExtensions().memoryObjectFd) @@ -3299,7 +3299,10 @@ bool ValidateWaitSemaphoreEXT(Context *context, return false; } -bool ValidateImportSemaphoreFdEXT(Context *context, GLuint semaphore, GLenum handleType, GLint fd) +bool ValidateImportSemaphoreFdEXT(Context *context, + GLuint semaphore, + HandleType handleType, + GLint fd) { if (!context->getExtensions().semaphoreFd) { diff --git a/src/libANGLE/validationESEXT_autogen.h b/src/libANGLE/validationESEXT_autogen.h index 5d0d884b3..d604985bd 100644 --- a/src/libANGLE/validationESEXT_autogen.h +++ b/src/libANGLE/validationESEXT_autogen.h @@ -853,7 +853,7 @@ bool ValidateTexStorageMem3DMultisampleEXT(Context *context, bool ValidateImportMemoryFdEXT(Context *context, GLuint memory, GLuint64 size, - GLenum handleType, + HandleType handleTypePacked, GLint fd); // GL_EXT_occlusion_query_boolean @@ -908,7 +908,10 @@ bool ValidateWaitSemaphoreEXT(Context *context, const GLenum *srcLayouts); // GL_EXT_semaphore_fd -bool ValidateImportSemaphoreFdEXT(Context *context, GLuint semaphore, GLenum handleType, GLint fd); +bool ValidateImportSemaphoreFdEXT(Context *context, + GLuint semaphore, + HandleType handleTypePacked, + GLint fd); // GL_EXT_texture_storage bool ValidateTexStorage1DEXT(Context *context, diff --git a/src/libGLESv2/entry_points_gles_ext_autogen.cpp b/src/libGLESv2/entry_points_gles_ext_autogen.cpp index 157ae98ee..1b42682a7 100644 --- a/src/libGLESv2/entry_points_gles_ext_autogen.cpp +++ b/src/libGLESv2/entry_points_gles_ext_autogen.cpp @@ -3460,10 +3460,11 @@ void GL_APIENTRY ImportMemoryFdEXT(GLuint memory, GLuint64 size, GLenum handleTy Context *context = GetValidGlobalContext(); if (context) { + HandleType handleTypePacked = FromGLenum(handleType); if (context->skipValidation() || - ValidateImportMemoryFdEXT(context, memory, size, handleType, fd)) + ValidateImportMemoryFdEXT(context, memory, size, handleTypePacked, fd)) { - context->importMemoryFd(memory, size, handleType, fd); + context->importMemoryFd(memory, size, handleTypePacked, fd); } } } @@ -3719,10 +3720,11 @@ void GL_APIENTRY ImportSemaphoreFdEXT(GLuint semaphore, GLenum handleType, GLint Context *context = GetValidGlobalContext(); if (context) { + HandleType handleTypePacked = FromGLenum(handleType); if (context->skipValidation() || - ValidateImportSemaphoreFdEXT(context, semaphore, handleType, fd)) + ValidateImportSemaphoreFdEXT(context, semaphore, handleTypePacked, fd)) { - context->importSemaphoreFd(semaphore, handleType, fd); + context->importSemaphoreFd(semaphore, handleTypePacked, fd); } } } @@ -10876,10 +10878,11 @@ void GL_APIENTRY ImportMemoryFdEXTContextANGLE(GLeglContext ctx, if (context) { ASSERT(context == GetValidGlobalContext()); + HandleType handleTypePacked = FromGLenum(handleType); if (context->skipValidation() || - ValidateImportMemoryFdEXT(context, memory, size, handleType, fd)) + ValidateImportMemoryFdEXT(context, memory, size, handleTypePacked, fd)) { - context->importMemoryFd(memory, size, handleType, fd); + context->importMemoryFd(memory, size, handleTypePacked, fd); } } } @@ -10897,10 +10900,11 @@ void GL_APIENTRY ImportSemaphoreFdEXTContextANGLE(GLeglContext ctx, if (context) { ASSERT(context == GetValidGlobalContext()); + HandleType handleTypePacked = FromGLenum(handleType); if (context->skipValidation() || - ValidateImportSemaphoreFdEXT(context, semaphore, handleType, fd)) + ValidateImportSemaphoreFdEXT(context, semaphore, handleTypePacked, fd)) { - context->importSemaphoreFd(semaphore, handleType, fd); + context->importSemaphoreFd(semaphore, handleTypePacked, fd); } } }