[Mesa-dev] [PATCH 5/5] st/glsl_to_tgsi: add ARB_get_program_binary support using TGSI
Timothy Arceri
tarceri at itsqueeze.com
Fri Dec 8 09:57:39 UTC 2017
This resolves a game bug in Deal 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.
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 7564a530352..a7b2cfc12ba 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -67,20 +67,21 @@
#include "st_cb_strings.h"
#include "st_cb_texturebarrier.h"
#include "st_cb_viewport.h"
#include "st_atom.h"
#include "st_draw.h"
#include "st_extensions.h"
#include "st_gen_mipmap.h"
#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"
#include "util/u_inlines.h"
#include "util/u_upload_mgr.h"
#include "util/u_vbuf.h"
#include "cso_cache/cso_context.h"
DEBUG_GET_ONCE_BOOL_OPTION(mesa_mvp_dp4, "MESA_MVP_DP4", FALSE)
@@ -753,11 +754,16 @@ st_init_driver_functions(struct pipe_screen *screen,
if (screen->get_param(screen, PIPE_CAP_STRING_MARKER))
functions->EmitStringMarker = st_emit_string_marker;
functions->Enable = st_Enable;
functions->UpdateState = st_invalidate_state;
functions->QueryMemoryInfo = st_query_memory_info;
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 9ef0df1e926..5c5cfaaabab 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -410,20 +410,24 @@ void st_init_limits(struct pipe_screen *screen,
c->Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks +
c->Program[MESA_SHADER_COMPUTE].MaxUniformBlocks;
assert(c->MaxCombinedUniformBlocks <= MAX_COMBINED_UNIFORM_BUFFERS);
}
c->GLSLFragCoordIsSysVal =
screen->get_param(screen, PIPE_CAP_TGSI_FS_POSITION_IS_SYSVAL);
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;
if (!ssbo_atomic) {
/* for separate atomic buffers - there atomic buffer size will be
limited */
c->MaxAtomicBufferSize = c->Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters * ATOMIC_COUNTER_SIZE;
/* on all HW with separate atomic (evergreen) the following
lines are true. not sure it's worth adding CAPs for this at this
stage. */
--
2.14.3
More information about the mesa-dev
mailing list