[Mesa-dev] [PATCH 13/23] main: Support getting GL_PROGRAM_BINARY_LENGTH

Timothy Arceri tarceri at itsqueeze.com
Wed Nov 29 01:24:49 UTC 2017


From: Jordan Justen <jordan.l.justen at intel.com>

V2: call generic _mesa_get_program_binary_length() 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>i (v1)
---
 src/mesa/main/shaderapi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 72824355838..82a7fde697b 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -38,20 +38,21 @@
 
 
 #include <stdbool.h>
 #include "main/glheader.h"
 #include "main/context.h"
 #include "main/dispatch.h"
 #include "main/enums.h"
 #include "main/hash.h"
 #include "main/mtypes.h"
 #include "main/pipelineobj.h"
+#include "main/program_binary.h"
 #include "main/shaderapi.h"
 #include "main/shaderobj.h"
 #include "main/transformfeedback.h"
 #include "main/uniforms.h"
 #include "compiler/glsl/glsl_parser_extras.h"
 #include "compiler/glsl/ir.h"
 #include "compiler/glsl/ir_uniform.h"
 #include "compiler/glsl/program.h"
 #include "program/program.h"
 #include "program/prog_print.h"
@@ -827,21 +828,25 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname,
        * GL_ARB_get_program_binary extension or OpenGL ES 3.0.
        *
        * On desktop, we ignore the 3.0+ requirement because it is silly.
        */
       if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
          break;
 
       *params = shProg->BinaryRetreivableHint;
       return;
    case GL_PROGRAM_BINARY_LENGTH:
-      *params = 0;
+      if (ctx->Const.NumProgramBinaryFormats == 0) {
+         *params = 0;
+      } else {
+         _mesa_get_program_binary_length(ctx, shProg, params);
+      }
       return;
    case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS:
       if (!ctx->Extensions.ARB_shader_atomic_counters)
          break;
 
       *params = shProg->data->NumAtomicBuffers;
       return;
    case GL_COMPUTE_WORK_GROUP_SIZE: {
       int i;
       if (!_mesa_has_compute_shaders(ctx))
-- 
2.14.3



More information about the mesa-dev mailing list