mesa: only expose glImportMemoryFdEXT if the ext is supported
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 21 Aug 2017 20:22:28 +0000 (22:22 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 22 Aug 2017 09:54:29 +0000 (11:54 +0200)
From the EXT_external_objects_fd spec:

   "If the GL_EXT_memory_object_fd string is reported, the following
    commands are added:

    void ImportMemoryFdEXT(uint memory,
                           uint64 size,
                           enum handleType,
                           int fd);"

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/mesa/main/externalobjects.c

index 098a0999208179b047be7d20bddcbd38e6e846af..127b2039c64aa998405c762def6584d4428f3dec 100644 (file)
@@ -560,6 +560,12 @@ _mesa_ImportMemoryFdEXT(GLuint memory,
 {
    GET_CURRENT_CONTEXT(ctx);
 
+   if (!ctx->Extensions.EXT_memory_object_fd) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glImportMemoryFdEXT(unsupported)");
+      return;
+   }
+
    if (handleType != GL_HANDLE_TYPE_OPAQUE_FD_EXT) {
       _mesa_error(ctx, GL_INVALID_VALUE, "glImportMemoryFdEXT(handleType=%u)",
                   handleType);