[Mesa-dev] [PATCH 12/17] main: Support calling driver for GL_PROGRAM_BINARY_LENGTH

Jordan Justen jordan.l.justen at intel.com
Thu Nov 9 06:42:24 UTC 2017


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/main/dd.h        | 12 ++++++++++++
 src/mesa/main/shaderapi.c |  8 +++++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index da03b2e8b94..91eff55f84d 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -1126,6 +1126,18 @@ struct dd_function_table {
                                 GLuint64 size,
                                 int fd);
    /*@}*/
+
+   /**
+    * \name GL_ARB_get_program_binary
+    */
+   /*@{*/
+   /**
+    * Called to retrieve a binary serialized copy of the current program.
+    */
+   void (*GetProgramBinaryLength)(struct gl_context *ctx,
+                                  struct gl_shader_program *shProg,
+                                  GLint *length);
+   /*@}*/
 };
 
 
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 72824355838..f12825d2536 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -834,7 +834,13 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
       *params = shProg->BinaryRetreivableHint;
       return;
    case GL_PROGRAM_BINARY_LENGTH:
-      *params = 0;
+      assert(ctx->Const.NumProgramBinaryFormats == 0 ||
+             ctx->Driver.GetProgramBinaryLength);
+      if (ctx->Const.NumProgramBinaryFormats == 0) {
+         *params = 0;
+      } else {
+         ctx->Driver.GetProgramBinaryLength(ctx, shProg, params);
+      }
       return;
    case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS:
       if (!ctx->Extensions.ARB_shader_atomic_counters)
-- 
2.14.1



More information about the mesa-dev mailing list