if (brw->gen >= 7) {
functions->BeginTransformFeedback = gen7_begin_transform_feedback;
functions->EndTransformFeedback = gen7_end_transform_feedback;
+ functions->PauseTransformFeedback = gen7_pause_transform_feedback;
+ functions->ResumeTransformFeedback = gen7_resume_transform_feedback;
} else {
functions->BeginTransformFeedback = brw_begin_transform_feedback;
functions->EndTransformFeedback = brw_end_transform_feedback;
struct brw_transform_feedback_object {
struct gl_transform_feedback_object base;
+
+ /** A buffer to hold SO_WRITE_OFFSET(n) values while paused. */
+ drm_intel_bo *offset_bo;
};
/**
void
gen7_end_transform_feedback(struct gl_context *ctx,
struct gl_transform_feedback_object *obj);
+void
+gen7_pause_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj);
+void
+gen7_resume_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj);
/* brw_blorp_blit.cpp */
GLbitfield
_mesa_init_transform_feedback_object(&brw_obj->base, name);
+ brw_obj->offset_bo =
+ drm_intel_bo_alloc(brw->bufmgr, "transform feedback offsets", 16, 64);
+
return &brw_obj->base;
}
_mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL);
}
+ drm_intel_bo_unreference(brw_obj->offset_bo);
+
free(brw_obj);
}
intel_batchbuffer_emit_mi_flush(brw);
}
+
+void
+gen7_pause_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj)
+{
+ struct brw_context *brw = brw_context(ctx);
+ struct brw_transform_feedback_object *brw_obj =
+ (struct brw_transform_feedback_object *) obj;
+
+ /* Save the SOL buffer offset register values. */
+ for (int i = 0; i < 4; i++) {
+ BEGIN_BATCH(3);
+ OUT_BATCH(MI_STORE_REGISTER_MEM | (3 - 2));
+ OUT_BATCH(GEN7_SO_WRITE_OFFSET(i));
+ OUT_RELOC(brw_obj->offset_bo,
+ I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
+ i * sizeof(uint32_t));
+ ADVANCE_BATCH();
+ }
+}
+
+void
+gen7_resume_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj)
+{
+ struct brw_context *brw = brw_context(ctx);
+ struct brw_transform_feedback_object *brw_obj =
+ (struct brw_transform_feedback_object *) obj;
+
+ /* Reload the SOL buffer offset registers. */
+ for (int i = 0; i < 4; i++) {
+ BEGIN_BATCH(3);
+ OUT_BATCH(GEN7_MI_LOAD_REGISTER_MEM | (3 - 2));
+ OUT_BATCH(GEN7_SO_WRITE_OFFSET(i));
+ OUT_RELOC(brw_obj->offset_bo,
+ I915_GEM_DOMAIN_INSTRUCTION, I915_GEM_DOMAIN_INSTRUCTION,
+ i * sizeof(uint32_t));
+ ADVANCE_BATCH();
+ }
+}