summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/softpipe
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2011-12-15 18:42:21 +0100
committerChristoph Bumiller <[email protected]>2011-12-15 18:51:48 +0100
commit861a029ddb31e91bb4d8e18ab708d0d172f63aad (patch)
treea938450d80ee5dbda670f7fe37bb51b10c1982c4 /src/gallium/drivers/softpipe
parent4f4a1be2009863ea34a69b22f58aa1ca08cd710f (diff)
gallium: interface changes necessary to implement transform feedback (v5)
Namely: - EXT_transform_feedback - ARB_transform_feedback2 - ARB_transform_feedback_instanced The old interface was not useful for OpenGL and had to be reworked. This interface was originally designed for OpenGL, but additional changes have been made in order to make st/d3d1x support easier. The most notable change is the stream-out info must be linked with a vertex or geometry shader and cannot be set independently. This is due to limitations of existing hardware (special shader instructions must be used to write into stream-out buffers), and it's also how OpenGL works (stream outputs must be specified prior to linking shaders). Other than that, each stream output buffer has a "view" into it that internally maintains the number of bytes which have been written into it. (one buffer can be bound in several different transform feedback objects in OpenGL, so we must be able to have several views around) The set_stream_output_targets function contains a parameter saying whether new data should be appended or not. Also, the view can optionally be used to provide the vertex count for draw_vbo. Note that the count is supposed to be stored in device memory and the CPU never gets to know its value. OpenGL way | Gallium way ------------------------------------ BeginTF = set_so_targets(append_bitmask = 0) PauseTF = set_so_targets(num_targets = 0) ResumeTF = set_so_targets(append_bitmask = ~0) EndTF = set_so_targets(num_targets = 0) DrawTF = use pipe_draw_info::count_from_stream_output v2: * removed the reset_stream_output_targets function * added a parameter append_bitmask to set_stream_output_targets, each bit specifies whether new data should be appended to each buffer or not. v3: * added PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME for ARB_tfb2, note that the draw-auto subset is always required (for d3d10), only the pause/resume functionality is limited if the CAP is not advertised v4: * update gallium/docs v5: * compactified struct pipe_stream_output_info, updated dump/trace
Diffstat (limited to 'src/gallium/drivers/softpipe')
-rw-r--r--src/gallium/drivers/softpipe/sp_screen.c2
-rw-r--r--src/gallium/drivers/softpipe/sp_state.h2
-rw-r--r--src/gallium/drivers/softpipe/sp_state_so.c13
3 files changed, 5 insertions, 12 deletions
diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
index ef98f25c477..49e8626b0d4 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -105,7 +105,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 1;
- case PIPE_CAP_STREAM_OUTPUT:
+ case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
return 0;
case PIPE_CAP_PRIMITIVE_RESTART:
return 1;
diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h
index ec4c8cf5e4d..bdda29495b2 100644
--- a/src/gallium/drivers/softpipe/sp_state.h
+++ b/src/gallium/drivers/softpipe/sp_state.h
@@ -122,7 +122,7 @@ struct sp_velems_state {
};
struct sp_so_state {
- struct pipe_stream_output_state base;
+ struct pipe_stream_output_info base;
};
diff --git a/src/gallium/drivers/softpipe/sp_state_so.c b/src/gallium/drivers/softpipe/sp_state_so.c
index 40e563457d9..31ef3841294 100644
--- a/src/gallium/drivers/softpipe/sp_state_so.c
+++ b/src/gallium/drivers/softpipe/sp_state_so.c
@@ -36,7 +36,7 @@
static void *
softpipe_create_stream_output_state(struct pipe_context *pipe,
- const struct pipe_stream_output_state *templ)
+ const struct pipe_stream_output_info *templ)
{
struct sp_so_state *so;
so = (struct sp_so_state *) CALLOC_STRUCT(sp_so_state);
@@ -44,15 +44,8 @@ softpipe_create_stream_output_state(struct pipe_context *pipe,
if (so) {
so->base.num_outputs = templ->num_outputs;
so->base.stride = templ->stride;
- memcpy(so->base.output_buffer,
- templ->output_buffer,
- sizeof(int) * templ->num_outputs);
- memcpy(so->base.register_index,
- templ->register_index,
- sizeof(int) * templ->num_outputs);
- memcpy(so->base.register_mask,
- templ->register_mask,
- sizeof(ubyte) * templ->num_outputs);
+ memcpy(so->base.output, templ->output,
+ templ->num_outputs * sizeof(templ->output[0]));
}
return so;
}