mesa: use gl_program for CurrentProgram rather than gl_shader_program
This makes much more sense and should be more performant in some critical paths such as SSO validation which is called at draw time. Previously the CurrentProgram array could have contained multiple pointers to the same struct which was confusing and we would often need to fish out the information we were really after from the gl_program anyway. Also it was error prone to depend on the _LinkedShader array for programs in current use because a failed linking attempt will lose the infomation about the current program in use which is still valid. V2: fix validate_io() to compare linked_stages rather than the consumer and producer to decide if we are looking at inward facing shader interfaces which don't need validation. Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net> To avoid build regressions the following 2 patches were squashed in to this commit: mesa/meta: rewrite _mesa_shader_program_use() and _mesa_program_use() These are rewritten to do what the function name suggests, that is _mesa_shader_program_use() sets the use of all stage and _mesa_program_use() sets the use of a single stage. Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net> mesa: update active relinked program This likely fixes a subroutine bug were _mesa_shader_program_init_subroutine_defaults() would never have been called for the relinked program as we previously just set _NEW_PROGRAM as dirty and never called the _mesa_use* functions when linking. Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
This commit is contained in:
@@ -41,8 +41,7 @@
|
||||
#include "st_program.h"
|
||||
|
||||
static void
|
||||
st_bind_atomics(struct st_context *st,
|
||||
struct gl_shader_program *prog,
|
||||
st_bind_atomics(struct st_context *st, struct gl_program *prog,
|
||||
enum pipe_shader_type shader_type)
|
||||
{
|
||||
unsigned i;
|
||||
@@ -50,8 +49,9 @@ st_bind_atomics(struct st_context *st,
|
||||
if (!prog || !st->pipe->set_shader_buffers)
|
||||
return;
|
||||
|
||||
for (i = 0; i < prog->data->NumAtomicBuffers; i++) {
|
||||
struct gl_active_atomic_buffer *atomic = &prog->data->AtomicBuffers[i];
|
||||
for (i = 0; i < prog->sh.data->NumAtomicBuffers; i++) {
|
||||
struct gl_active_atomic_buffer *atomic =
|
||||
&prog->sh.data->AtomicBuffers[i];
|
||||
struct gl_atomic_buffer_binding *binding =
|
||||
&st->ctx->AtomicBufferBindings[atomic->Binding];
|
||||
struct st_buffer_object *st_obj =
|
||||
@@ -72,7 +72,7 @@ st_bind_atomics(struct st_context *st,
|
||||
static void
|
||||
bind_vs_atomics(struct st_context *st)
|
||||
{
|
||||
struct gl_shader_program *prog =
|
||||
struct gl_program *prog =
|
||||
st->ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX];
|
||||
|
||||
st_bind_atomics(st, prog, PIPE_SHADER_VERTEX);
|
||||
@@ -85,7 +85,7 @@ const struct st_tracked_state st_bind_vs_atomics = {
|
||||
static void
|
||||
bind_fs_atomics(struct st_context *st)
|
||||
{
|
||||
struct gl_shader_program *prog =
|
||||
struct gl_program *prog =
|
||||
st->ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
|
||||
|
||||
st_bind_atomics(st, prog, PIPE_SHADER_FRAGMENT);
|
||||
@@ -98,7 +98,7 @@ const struct st_tracked_state st_bind_fs_atomics = {
|
||||
static void
|
||||
bind_gs_atomics(struct st_context *st)
|
||||
{
|
||||
struct gl_shader_program *prog =
|
||||
struct gl_program *prog =
|
||||
st->ctx->_Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
|
||||
|
||||
st_bind_atomics(st, prog, PIPE_SHADER_GEOMETRY);
|
||||
@@ -111,7 +111,7 @@ const struct st_tracked_state st_bind_gs_atomics = {
|
||||
static void
|
||||
bind_tcs_atomics(struct st_context *st)
|
||||
{
|
||||
struct gl_shader_program *prog =
|
||||
struct gl_program *prog =
|
||||
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
|
||||
|
||||
st_bind_atomics(st, prog, PIPE_SHADER_TESS_CTRL);
|
||||
@@ -124,7 +124,7 @@ const struct st_tracked_state st_bind_tcs_atomics = {
|
||||
static void
|
||||
bind_tes_atomics(struct st_context *st)
|
||||
{
|
||||
struct gl_shader_program *prog =
|
||||
struct gl_program *prog =
|
||||
st->ctx->_Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
|
||||
|
||||
st_bind_atomics(st, prog, PIPE_SHADER_TESS_EVAL);
|
||||
@@ -137,7 +137,7 @@ const struct st_tracked_state st_bind_tes_atomics = {
|
||||
static void
|
||||
bind_cs_atomics(struct st_context *st)
|
||||
{
|
||||
struct gl_shader_program *prog =
|
||||
struct gl_program *prog =
|
||||
st->ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
|
||||
|
||||
st_bind_atomics(st, prog, PIPE_SHADER_COMPUTE);
|
||||
|
Reference in New Issue
Block a user