summaryrefslogtreecommitdiff
path: root/lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2017-08-26 16:59:42 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2017-08-26 16:59:42 +0000
commit81ece42815e80818f160cdd85fab57d65b56ad15 (patch)
tree1059ff094da1aa50334115952fcb1cfcbda3acc6 /lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c
parentb0244145d5bb49623d58f6b5cab8143ada692b60 (diff)
Revert to Mesa 13.0.6 to hopefully address rendering issues a handful of
people have reported with xpdf/fvwm on ivy bridge with modesetting driver.
Diffstat (limited to 'lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c')
-rw-r--r--lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c62
1 files changed, 58 insertions, 4 deletions
diff --git a/lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c b/lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c
index 8ab2903dc..a7456628d 100644
--- a/lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c
+++ b/lib/mesa/src/gallium/drivers/softpipe/sp_state_shader.c
@@ -64,7 +64,8 @@ create_fs_variant(struct softpipe_context *softpipe,
/* get new shader that implements polygon stippling */
var->tokens =
util_pstipple_create_fragment_shader(curfs->tokens,
- &var->stipple_sampler_unit, 0);
+ &var->stipple_sampler_unit, 0,
+ TGSI_FILE_INPUT);
}
else
#endif
@@ -207,7 +208,7 @@ softpipe_create_vs_state(struct pipe_context *pipe,
struct sp_vertex_shader *state;
state = CALLOC_STRUCT(sp_vertex_shader);
- if (state == NULL )
+ if (!state)
goto fail;
/* copy shader tokens, the ones passed in will go away.
@@ -269,7 +270,7 @@ softpipe_create_gs_state(struct pipe_context *pipe,
struct sp_geometry_shader *state;
state = CALLOC_STRUCT(sp_geometry_shader);
- if (state == NULL )
+ if (!state)
goto fail;
state->shader = *templ;
@@ -337,7 +338,7 @@ softpipe_delete_gs_state(struct pipe_context *pipe, void *gs)
static void
softpipe_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
- struct pipe_constant_buffer *cb)
+ const struct pipe_constant_buffer *cb)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
struct pipe_resource *constants = cb ? cb->buffer : NULL;
@@ -377,6 +378,55 @@ softpipe_set_constant_buffer(struct pipe_context *pipe,
}
}
+static void *
+softpipe_create_compute_state(struct pipe_context *pipe,
+ const struct pipe_compute_state *templ)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ const struct tgsi_token *tokens;
+ struct sp_compute_shader *state;
+ if (templ->ir_type != PIPE_SHADER_IR_TGSI)
+ return NULL;
+
+ tokens = templ->prog;
+ /* debug */
+ if (softpipe->dump_cs)
+ tgsi_dump(tokens, 0);
+
+ state = CALLOC_STRUCT(sp_compute_shader);
+
+ state->shader = *templ;
+ state->tokens = tgsi_dup_tokens(tokens);
+ tgsi_scan_shader(state->tokens, &state->info);
+
+ state->max_sampler = state->info.file_max[TGSI_FILE_SAMPLER];
+
+ return state;
+}
+
+static void
+softpipe_bind_compute_state(struct pipe_context *pipe,
+ void *cs)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ struct sp_compute_shader *state = (struct sp_compute_shader *)cs;
+ if (softpipe->cs == state)
+ return;
+
+ softpipe->cs = state;
+}
+
+static void
+softpipe_delete_compute_state(struct pipe_context *pipe,
+ void *cs)
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ struct sp_compute_shader *state = (struct sp_compute_shader *)cs;
+
+ assert(softpipe->cs != state);
+ tgsi_free_tokens(state->tokens);
+ FREE(state);
+}
void
softpipe_init_shader_funcs(struct pipe_context *pipe)
@@ -394,4 +444,8 @@ softpipe_init_shader_funcs(struct pipe_context *pipe)
pipe->delete_gs_state = softpipe_delete_gs_state;
pipe->set_constant_buffer = softpipe_set_constant_buffer;
+
+ pipe->create_compute_state = softpipe_create_compute_state;
+ pipe->bind_compute_state = softpipe_bind_compute_state;
+ pipe->delete_compute_state = softpipe_delete_compute_state;
}