Mesa (master): st/glsl_to_tgsi: add ARB_get_program_binary support using TGSI

Timothy Arceri tarceri at kemper.freedesktop.org
Wed Jan 17 12:48:10 UTC 2018


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

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Mon Nov 27 17:01:01 2017 +1100

st/glsl_to_tgsi: add ARB_get_program_binary support using TGSI

This resolves a game bug in Dead Island. The game doesn't properly
handle ARB_get_program_binary with 0 supported formats, and ends up
crashing.

This will enable ARB_get_program_binary binary support for any
driver that currently enables the on-disk shader cache.

Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85564

---

 src/mesa/state_tracker/st_context.c    | 6 ++++++
 src/mesa/state_tracker/st_extensions.c | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 7564a53035..a7b2cfc12b 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -74,6 +74,7 @@
 #include "st_pbo.h"
 #include "st_program.h"
 #include "st_sampler_view.h"
+#include "st_shader_cache.h"
 #include "st_vdpau.h"
 #include "st_texture.h"
 #include "pipe/p_context.h"
@@ -760,4 +761,9 @@ st_init_driver_functions(struct pipe_screen *screen,
    functions->SetBackgroundContext = st_set_background_context;
    functions->GetDriverUuid = st_get_device_uuid;
    functions->GetDeviceUuid = st_get_driver_uuid;
+
+   /* GL_ARB_get_program_binary */
+   functions->GetProgramBinaryDriverSHA1 = st_get_program_binary_driver_sha1;
+   functions->ProgramBinarySerializeDriverBlob = st_serialise_tgsi_program;
+   functions->ProgramBinaryDeserializeDriverBlob = st_deserialise_tgsi_program;
 }
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index c8411a6995..370d1a7e06 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -417,6 +417,10 @@ void st_init_limits(struct pipe_screen *screen,
    c->GLSLFrontFacingIsSysVal =
       screen->get_param(screen, PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL);
 
+   /* GL_ARB_get_program_binary */
+   if (screen->get_disk_shader_cache && screen->get_disk_shader_cache(screen))
+      c->NumProgramBinaryFormats = 1;
+
    c->MaxAtomicBufferBindings =
           c->Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers;
 




More information about the mesa-commit mailing list