diff options
author | Paul Berry <[email protected]> | 2012-12-12 14:14:12 -0800 |
---|---|---|
committer | Paul Berry <[email protected]> | 2012-12-18 08:31:26 -0800 |
commit | 3870f2903f030969491fa287b7f8d7eaf1d2f4f9 (patch) | |
tree | b8e7ef37f0079d80a497cfd17f8699db6ffb10d8 /src/mesa/drivers | |
parent | 61c1b065fbdd224fa547f035991210859c7af310 (diff) |
mesa: refactor _mesa_compute_max_transform_feedback_vertices from i965.
Previously, the i965 driver contained code to compute the maximum
number of vertices that could be written without overflowing any
transform feedback buffers. This code wasn't driver-specific, and for
GLES3 support we're going to need to use it in core mesa. So this
patch moves the code into a core mesa function,
_mesa_compute_max_transform_feedback_vertices().
Reviewed-by: Ian Romanick <[email protected]>
v2: Eliminate C++-style variable declarations, since these won't work
with MSVC.
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_sol.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c index 07316c869a9..7aa6140bd97 100644 --- a/src/mesa/drivers/dri/i965/gen6_sol.c +++ b/src/mesa/drivers/dri/i965/gen6_sol.c @@ -31,6 +31,7 @@ #include "intel_batchbuffer.h" #include "brw_defines.h" #include "brw_state.h" +#include "main/transformfeedback.h" static void gen6_update_sol_surfaces(struct brw_context *brw) @@ -165,21 +166,12 @@ brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *xfb_obj = ctx->TransformFeedback.CurrentObject; - unsigned max_index = 0xffffffff; - /* Compute the maximum number of vertices that we can write without * overflowing any of the buffers currently being used for feedback. */ - for (int i = 0; i < BRW_MAX_SOL_BUFFERS; ++i) { - unsigned stride = linked_xfb_info->BufferStride[i]; - - /* Skip any inactive buffers, which have a stride of 0. */ - if (stride == 0) - continue; - - unsigned max_for_this_buffer = xfb_obj->Size[i] / (4 * stride); - max_index = MIN2(max_index, max_for_this_buffer); - } + unsigned max_index + = _mesa_compute_max_transform_feedback_vertices(xfb_obj, + linked_xfb_info); /* Initialize the SVBI 0 register to zero and set the maximum index. * These values will be sent to the hardware on the next draw. |