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 <spang@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/common/PackedGLEnums_autogen.cpp b/src/common/PackedGLEnums_autogen.cpp
index 66fb926..916d84d 100644
--- a/src/common/PackedGLEnums_autogen.cpp
+++ b/src/common/PackedGLEnums_autogen.cpp
@@ -336,6 +336,30 @@
}
template <>
+HandleType FromGLenum<HandleType>(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<HintSetting>(GLenum from)
{
switch (from)
diff --git a/src/common/PackedGLEnums_autogen.h b/src/common/PackedGLEnums_autogen.h
index 7d8b4fb..295bb9e 100644
--- a/src/common/PackedGLEnums_autogen.h
+++ b/src/common/PackedGLEnums_autogen.h
@@ -146,6 +146,18 @@
FogMode FromGLenum<FogMode>(GLenum from);
GLenum ToGLenum(FogMode from);
+enum class HandleType : uint8_t
+{
+ OpaqueFd = 0,
+
+ InvalidEnum = 1,
+ EnumCount = 1,
+};
+
+template <>
+HandleType FromGLenum<HandleType>(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 054e3c9..dc6eeaf 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 bf06988..455e1de 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -7184,7 +7184,7 @@
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 @@
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 5a49a12..ddea5be 100644
--- a/src/libANGLE/Context.h
+++ b/src/libANGLE/Context.h
@@ -393,7 +393,7 @@
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 @@
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 b65a1ba..b7143eb 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -3184,7 +3184,7 @@
bool ValidateImportMemoryFdEXT(Context *context,
GLuint memory,
GLuint64 size,
- GLenum handleType,
+ HandleType handleType,
GLint fd)
{
if (!context->getExtensions().memoryObjectFd)
@@ -3299,7 +3299,10 @@
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 5d0d884..d604985 100644
--- a/src/libANGLE/validationESEXT_autogen.h
+++ b/src/libANGLE/validationESEXT_autogen.h
@@ -853,7 +853,7 @@
bool ValidateImportMemoryFdEXT(Context *context,
GLuint memory,
GLuint64 size,
- GLenum handleType,
+ HandleType handleTypePacked,
GLint fd);
// GL_EXT_occlusion_query_boolean
@@ -908,7 +908,10 @@
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 157ae98..1b42682 100644
--- a/src/libGLESv2/entry_points_gles_ext_autogen.cpp
+++ b/src/libGLESv2/entry_points_gles_ext_autogen.cpp
@@ -3460,10 +3460,11 @@
Context *context = GetValidGlobalContext();
if (context)
{
+ HandleType handleTypePacked = FromGLenum<HandleType>(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 @@
Context *context = GetValidGlobalContext();
if (context)
{
+ HandleType handleTypePacked = FromGLenum<HandleType>(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 @@
if (context)
{
ASSERT(context == GetValidGlobalContext());
+ HandleType handleTypePacked = FromGLenum<HandleType>(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 @@
if (context)
{
ASSERT(context == GetValidGlobalContext());
+ HandleType handleTypePacked = FromGLenum<HandleType>(handleType);
if (context->skipValidation() ||
- ValidateImportSemaphoreFdEXT(context, semaphore, handleType, fd))
+ ValidateImportSemaphoreFdEXT(context, semaphore, handleTypePacked, fd))
{
- context->importSemaphoreFd(semaphore, handleType, fd);
+ context->importSemaphoreFd(semaphore, handleTypePacked, fd);
}
}
}