Mesa (master): main: add binary support to GetProgramBinary

Timothy Arceri tarceri at kemper.freedesktop.org
Fri Dec 8 06:03:47 UTC 2017


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

Author: Jordan Justen <jordan.l.justen at intel.com>
Date:   Sat Nov  4 16:47:25 2017 -0700

main: add binary support to GetProgramBinary

V2: call generic _mesa_get_program_binary() helper rather than driver
    function directly to allow greater code sharing.

Signed-off-by: Timothy Arceri <tarceri at itsqueeze.com>
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com> (v1)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com> (v1)
Reviewed-by: Tapani Pälli <tapani.palli at intel.com>

---

 src/mesa/main/shaderapi.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 82a7fde697..b728b320ac 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -2199,12 +2199,15 @@ _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
       return;
    }
 
-   *length = 0;
-   _mesa_error(ctx, GL_INVALID_OPERATION,
-               "glGetProgramBinary(driver supports zero binary formats)");
-
-   (void) binaryFormat;
-   (void) binary;
+   if (ctx->Const.NumProgramBinaryFormats == 0) {
+      *length = 0;
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glGetProgramBinary(driver supports zero binary formats)");
+   } else {
+      _mesa_get_program_binary(ctx, shProg, bufSize, length, binaryFormat,
+                               binary);
+      assert(*length == 0 || *binaryFormat == GL_PROGRAM_BINARY_FORMAT_MESA);
+   }
 }
 
 void GLAPIENTRY




More information about the mesa-commit mailing list