[Mesa-dev] [PATCH v2 3/8] i965: Create a new brw_transform_feedback_object subclass.
Kenneth Graunke
kenneth at whitecape.org
Sat Oct 26 07:35:44 CEST 2013
This adds the basic driver hooks to allocate/free the brw variant.
It doesn't contain any additional information yet, but it will soon.
v2: Use the new _mesa_init_transform_feedback_object helper function
(requested by Eric and Ian).
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_context.c | 2 ++
src/mesa/drivers/dri/i965/brw_context.h | 9 +++++++++
src/mesa/drivers/dri/i965/gen6_sol.c | 29 +++++++++++++++++++++++++++++
3 files changed, 40 insertions(+)
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 8420c65..2df12ed 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -250,6 +250,8 @@ brw_init_driver_functions(struct brw_context *brw,
functions->QuerySamplesForFormat = brw_query_samples_for_format;
+ functions->NewTransformFeedback = brw_new_transform_feedback;
+ functions->DeleteTransformFeedback = brw_delete_transform_feedback;
if (brw->gen >= 7) {
functions->BeginTransformFeedback = gen7_begin_transform_feedback;
functions->EndTransformFeedback = gen7_end_transform_feedback;
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 4bff63e..54ad929 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -880,6 +880,10 @@ struct intel_batchbuffer {
} saved;
};
+struct brw_transform_feedback_object {
+ struct gl_transform_feedback_object base;
+};
+
/**
* Data shared between each programmable stage in the pipeline (vs, gs, and
* wm).
@@ -1556,6 +1560,11 @@ extern int intel_translate_logic_op(GLenum opcode);
void intel_init_syncobj_functions(struct dd_function_table *functions);
/* gen6_sol.c */
+struct gl_transform_feedback_object *
+brw_new_transform_feedback(struct gl_context *ctx, GLuint name);
+void
+brw_delete_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj);
void
brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj);
diff --git a/src/mesa/drivers/dri/i965/gen6_sol.c b/src/mesa/drivers/dri/i965/gen6_sol.c
index 21da444..0d84cee 100644
--- a/src/mesa/drivers/dri/i965/gen6_sol.c
+++ b/src/mesa/drivers/dri/i965/gen6_sol.c
@@ -26,6 +26,7 @@
* Code to initialize the binding table entries used by transform feedback.
*/
+#include "main/bufferobj.h"
#include "main/macros.h"
#include "brw_context.h"
#include "intel_batchbuffer.h"
@@ -132,6 +133,34 @@ const struct brw_tracked_state gen6_gs_binding_table = {
.emit = brw_gs_upload_binding_table,
};
+struct gl_transform_feedback_object *
+brw_new_transform_feedback(struct gl_context *ctx, GLuint name)
+{
+ struct brw_context *brw = brw_context(ctx);
+ struct brw_transform_feedback_object *brw_obj =
+ CALLOC_STRUCT(brw_transform_feedback_object);
+ if (!brw_obj)
+ return NULL;
+
+ _mesa_init_transform_feedback_object(&brw_obj->base, name);
+
+ return &brw_obj->base;
+}
+
+void
+brw_delete_transform_feedback(struct gl_context *ctx,
+ struct gl_transform_feedback_object *obj)
+{
+ struct brw_transform_feedback_object *brw_obj =
+ (struct brw_transform_feedback_object *) obj;
+
+ for (unsigned i = 0; i < Elements(obj->Buffers); i++) {
+ _mesa_reference_buffer_object(ctx, &obj->Buffers[i], NULL);
+ }
+
+ free(brw_obj);
+}
+
void
brw_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
struct gl_transform_feedback_object *obj)
--
1.8.3.2
More information about the mesa-dev
mailing list