[gtk+/wip/ebassi/gsk-renderer: 85/135] gsk: Pass the appropriate value for the n_quads argument
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/ebassi/gsk-renderer: 85/135] gsk: Pass the appropriate value for the n_quads argument
- Date: Mon, 17 Oct 2016 16:29:01 +0000 (UTC)
commit c0cd978311f7247e34be9f757295c10f55db8a27
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Aug 4 19:14:51 2016 +0100
gsk: Pass the appropriate value for the n_quads argument
Instead of passing the size of the buffer, we should pass the number of
quads; we know what the size of a single quad structure is, so we can do
the multiplication internally when creating the VAO.
This allows us to print the quads for debugging purposes.
gsk/gskgldriver.c | 17 ++++++++++++++++-
gsk/gskglrenderer.c | 2 +-
2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gsk/gskgldriver.c b/gsk/gskgldriver.c
index 443a0ad..a634525 100644
--- a/gsk/gskgldriver.c
+++ b/gsk/gskgldriver.c
@@ -365,7 +365,7 @@ gsk_gl_driver_create_vao_for_quad (GskGLDriver *driver,
glGenBuffers (1, &buffer_id);
glBindBuffer (GL_ARRAY_BUFFER, buffer_id);
- glBufferData (GL_ARRAY_BUFFER, n_quads, quads, GL_STATIC_DRAW);
+ glBufferData (GL_ARRAY_BUFFER, sizeof (GskQuadVertex) * n_quads, quads, GL_STATIC_DRAW);
glEnableVertexAttribArray (position_id);
glVertexAttribPointer (position_id, 2, GL_FLOAT, GL_FALSE,
@@ -387,6 +387,21 @@ gsk_gl_driver_create_vao_for_quad (GskGLDriver *driver,
v->uv_id = uv_id;
g_hash_table_insert (driver->vaos, GINT_TO_POINTER (vao_id), v);
+#ifdef G_ENABLE_DEBUG
+ if (GSK_DEBUG_CHECK (OPENGL))
+ {
+ int i;
+ g_print ("New VAO(%d) for quad[%d] : {\n", v->vao_id, n_quads);
+ for (i = 0; i < n_quads; i++)
+ {
+ g_print (" { x:%.2f, y:%.2f } { u:%.2f, v:%.2f }\n",
+ quads[i].position[0], quads[i].position[1],
+ quads[i].uv[0], quads[i].uv[1]);
+ }
+ g_print ("}\n");
+ }
+#endif
+
return vao_id;
}
diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c
index 1e3dcd2..7d16ee1 100644
--- a/gsk/gskglrenderer.c
+++ b/gsk/gskglrenderer.c
@@ -716,7 +716,7 @@ gsk_gl_renderer_add_render_item (GskGLRenderer *self,
gsk_gl_driver_create_vao_for_quad (self->gl_driver,
item.render_data.position_location,
item.render_data.uv_location,
- sizeof (GskQuadVertex) * N_VERTICES,
+ N_VERTICES,
vertex_data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]