Mesa (master): mesa: only expose glImportMemoryFdEXT if the ext is supported

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Tue Aug 22 09:55:06 UTC 2017


Module: Mesa
Branch: master
Commit: 44cd9aeeec58ef2c271cc7d5b89ea5eda906e78e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=44cd9aeeec58ef2c271cc7d5b89ea5eda906e78e

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon Aug 21 22:22:28 2017 +0200

mesa: only expose glImportMemoryFdEXT if the ext is supported

>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 at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/mesa/main/externalobjects.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/main/externalobjects.c b/src/mesa/main/externalobjects.c
index 098a099920..127b2039c6 100644
--- a/src/mesa/main/externalobjects.c
+++ b/src/mesa/main/externalobjects.c
@@ -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);




More information about the mesa-commit mailing list