#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)
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.
#include "bufferobj.h"
#include "context.h"
#include "hash.h"
+#include "macros.h"
#include "mfeatures.h"
#include "mtypes.h"
#include "transformfeedback.h"
}
+/**
+ * Compute the maximum number of vertices that can be written to the currently
+ * enabled transform feedback buffers without overflowing any of them.
+ */
+unsigned
+_mesa_compute_max_transform_feedback_vertices(
+ const struct gl_transform_feedback_object *obj,
+ const struct gl_transform_feedback_info *info)
+{
+ unsigned max_index = 0xffffffff;
+ unsigned i;
+
+ for (i = 0; i < info->NumBuffers; ++i) {
+ unsigned stride = info->BufferStride[i];
+ unsigned max_for_this_buffer;
+
+ /* Skip any inactive buffers, which have a stride of 0. */
+ if (stride == 0)
+ continue;
+
+ max_for_this_buffer = obj->Size[i] / (4 * stride);
+ max_index = MIN2(max_index, max_for_this_buffer);
+ }
+
+ return max_index;
+}
+
+
/**
** Begin API functions
**/
extern void
_mesa_init_transform_feedback_functions(struct dd_function_table *driver);
+extern unsigned
+_mesa_compute_max_transform_feedback_vertices(
+ const struct gl_transform_feedback_object *obj,
+ const struct gl_transform_feedback_info *info);
+
/*** GL_EXT_transform_feedback ***/