mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
framebuffer: remove attribute drawing apis
Almost nothing draws attributes directly and for those things that do it's trivial to adapt them to instead draw via the cogl_primitive api. This simplifies the Cogl api a bit. Reviewed-by: Neil Roberts <neil@linux.intel.com> (cherry picked from commit 7395925bcc01aad6c695fd0d9af78b784b3c64d4) Conflicts: cogl/cogl-framebuffer.c cogl/cogl-framebuffer.h
This commit is contained in:
parent
e9f721216e
commit
e4f24dba75
@ -2408,57 +2408,6 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
CoglAttribute **attributes,
|
|
||||||
int n_attributes)
|
|
||||||
{
|
|
||||||
_cogl_framebuffer_draw_attributes (framebuffer,
|
|
||||||
pipeline,
|
|
||||||
mode,
|
|
||||||
first_vertex,
|
|
||||||
n_vertices,
|
|
||||||
attributes, n_attributes,
|
|
||||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
int n_attributes;
|
|
||||||
CoglAttribute *attribute;
|
|
||||||
CoglAttribute **attributes;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
va_start (ap, n_vertices);
|
|
||||||
for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++)
|
|
||||||
;
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
|
||||||
|
|
||||||
va_start (ap, n_vertices);
|
|
||||||
for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++)
|
|
||||||
attributes[i] = attribute;
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
_cogl_framebuffer_draw_attributes (framebuffer,
|
|
||||||
pipeline,
|
|
||||||
mode, first_vertex, n_vertices,
|
|
||||||
attributes, n_attributes,
|
|
||||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
_cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||||
CoglPipeline *pipeline,
|
CoglPipeline *pipeline,
|
||||||
@ -2498,62 +2447,6 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
CoglIndices *indices,
|
|
||||||
CoglAttribute **attributes,
|
|
||||||
int n_attributes)
|
|
||||||
{
|
|
||||||
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
|
|
||||||
pipeline,
|
|
||||||
mode, first_vertex,
|
|
||||||
n_vertices, indices,
|
|
||||||
attributes, n_attributes,
|
|
||||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
CoglIndices *indices,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
int n_attributes;
|
|
||||||
CoglAttribute **attributes;
|
|
||||||
int i;
|
|
||||||
CoglAttribute *attribute;
|
|
||||||
|
|
||||||
va_start (ap, indices);
|
|
||||||
for (n_attributes = 0; va_arg (ap, CoglAttribute *); n_attributes++)
|
|
||||||
;
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
|
||||||
|
|
||||||
va_start (ap, indices);
|
|
||||||
for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++)
|
|
||||||
attributes[i] = attribute;
|
|
||||||
va_end (ap);
|
|
||||||
|
|
||||||
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
|
|
||||||
pipeline,
|
|
||||||
mode,
|
|
||||||
first_vertex,
|
|
||||||
n_vertices,
|
|
||||||
indices,
|
|
||||||
attributes,
|
|
||||||
n_attributes,
|
|
||||||
COGL_DRAW_SKIP_LEGACY_STATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
|
cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
|
||||||
CoglPipeline *pipeline,
|
CoglPipeline *pipeline,
|
||||||
|
@ -1120,218 +1120,6 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
|
|||||||
CoglPipeline *pipeline,
|
CoglPipeline *pipeline,
|
||||||
CoglPrimitive *primitive);
|
CoglPrimitive *primitive);
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_framebuffer_vdraw_attributes:
|
|
||||||
* @framebuffer: A destination #CoglFramebuffer
|
|
||||||
* @pipeline: A #CoglPipeline state object
|
|
||||||
* @mode: The #CoglVerticesMode defining the topology of vertices
|
|
||||||
* @first_vertex: The vertex offset within the given attributes to draw from
|
|
||||||
* @n_vertices: The number of vertices to draw from the given attributes
|
|
||||||
* @...: A set of vertex #CoglAttribute<!-- -->s defining vertex geometry
|
|
||||||
*
|
|
||||||
* First defines a geometry primitive by grouping a set of vertex attributes;
|
|
||||||
* specifying a @first_vertex; a number of vertices (@n_vertices) and
|
|
||||||
* specifying what kind of topology the vertices have via @mode.
|
|
||||||
*
|
|
||||||
* Then the function draws the given @primitive geometry to the specified
|
|
||||||
* destination @framebuffer using the graphics processing pipeline described by
|
|
||||||
* @pipeline.
|
|
||||||
*
|
|
||||||
* The list of #CoglAttribute<!-- -->s define the attributes of the vertices to
|
|
||||||
* be drawn, such as positions, colors and normals and should be %NULL
|
|
||||||
* terminated.
|
|
||||||
*
|
|
||||||
* This drawing api doesn't support high-level meta texture types such
|
|
||||||
* as #CoglTexture2DSliced so it is the user's responsibility to
|
|
||||||
* ensure that only low-level textures that can be directly sampled by
|
|
||||||
* a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
|
|
||||||
* are associated with layers of the given @pipeline.
|
|
||||||
*
|
|
||||||
* Stability: unstable
|
|
||||||
* Since: 1.10
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
cogl_framebuffer_vdraw_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
...) COGL_GNUC_NULL_TERMINATED;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_framebuffer_draw_attributes:
|
|
||||||
* @framebuffer: A destination #CoglFramebuffer
|
|
||||||
* @pipeline: A #CoglPipeline state object
|
|
||||||
* @mode: The #CoglVerticesMode defining the topology of vertices
|
|
||||||
* @first_vertex: The vertex offset within the given attributes to draw from
|
|
||||||
* @n_vertices: The number of vertices to draw from the given attributes
|
|
||||||
* @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex
|
|
||||||
* geometry
|
|
||||||
* @n_attributes: The number of attributes in the @attributes array.
|
|
||||||
*
|
|
||||||
* First defines a geometry primitive by grouping a set of vertex @attributes;
|
|
||||||
* specifying a @first_vertex; a number of vertices (@n_vertices) and
|
|
||||||
* specifying what kind of topology the vertices have via @mode.
|
|
||||||
*
|
|
||||||
* Then the function draws the given @primitive geometry to the specified
|
|
||||||
* destination @framebuffer using the graphics processing pipeline described by
|
|
||||||
* @pipeline.
|
|
||||||
*
|
|
||||||
* The list of #CoglAttribute<!-- -->s define the attributes of the vertices to
|
|
||||||
* be drawn, such as positions, colors and normals and the number of attributes
|
|
||||||
* is given as @n_attributes.
|
|
||||||
*
|
|
||||||
* This drawing api doesn't support high-level meta texture types such
|
|
||||||
* as #CoglTexture2DSliced so it is the user's responsibility to
|
|
||||||
* ensure that only low-level textures that can be directly sampled by
|
|
||||||
* a GPU such as #CoglTexture2D, #CoglTextureRectangle or #CoglTexture3D
|
|
||||||
* are associated with layers of the given @pipeline.
|
|
||||||
*
|
|
||||||
* <note>This api doesn't support any of the legacy global state options such
|
|
||||||
* as cogl_set_depth_test_enabled(), cogl_set_backface_culling_enabled() or
|
|
||||||
* cogl_program_use()</note>
|
|
||||||
*
|
|
||||||
* Stability: unstable
|
|
||||||
* Since: 1.10
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
CoglAttribute **attributes,
|
|
||||||
int n_attributes);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_framebuffer_vdraw_indexed_attributes:
|
|
||||||
* @framebuffer: A destination #CoglFramebuffer
|
|
||||||
* @pipeline: A #CoglPipeline state object
|
|
||||||
* @mode: The #CoglVerticesMode defining the topology of vertices
|
|
||||||
* @first_vertex: The vertex offset within the given attributes to draw from
|
|
||||||
* @n_vertices: The number of vertices to draw from the given attributes
|
|
||||||
* @indices: The array of indices used by the GPU to lookup attribute
|
|
||||||
* data for each vertex.
|
|
||||||
* @...: A set of vertex #CoglAttribute<!-- -->s defining vertex geometry
|
|
||||||
*
|
|
||||||
* Behaves the same as cogl_framebuffer_vdraw_attributes() except that
|
|
||||||
* instead of reading vertex data sequentially from the specified
|
|
||||||
* attributes the @indices provide an indirection for how the data
|
|
||||||
* should be indexed allowing a random access order to be
|
|
||||||
* specified.
|
|
||||||
*
|
|
||||||
* For example an indices array of [0, 1, 2, 0, 2, 3] could be used
|
|
||||||
* used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES +
|
|
||||||
* @n_vertices = 6) but only provide attribute data for the 4 corners
|
|
||||||
* of a rectangle. When the GPU needs to read in each of the 6
|
|
||||||
* vertices it will read the @indices array for each vertex in
|
|
||||||
* sequence and use the index to look up the vertex attribute data. So
|
|
||||||
* here you can see that first and fourth vertex will point to the
|
|
||||||
* same data and third and fifth vertex will also point to shared
|
|
||||||
* data.
|
|
||||||
*
|
|
||||||
* Drawing with indices can be a good way of minimizing the size of a
|
|
||||||
* mesh by allowing you to avoid data for duplicate vertices because
|
|
||||||
* multiple entries in the index array can refer back to a single
|
|
||||||
* shared vertex.
|
|
||||||
*
|
|
||||||
* <note>The @indices array must be at least as long as @first_vertex
|
|
||||||
* + @n_vertices otherwise the GPU will overrun the indices array when
|
|
||||||
* looking up vertex data.</note>
|
|
||||||
*
|
|
||||||
* Since it's very common to want to draw a run of rectangles using
|
|
||||||
* indices to avoid duplicating vertex data you can use
|
|
||||||
* cogl_get_rectangle_indices() to get a set of indices that can be
|
|
||||||
* shared.
|
|
||||||
*
|
|
||||||
* This drawing api doesn't support high-level meta texture types such
|
|
||||||
* as #CoglTexture2DSliced so it is the user's responsibility to
|
|
||||||
* ensure that only low-level textures that can be directly sampled by
|
|
||||||
* a GPU such as #CoglTexture2D, #CoglTextureRectangle or
|
|
||||||
* #CoglTexture3D are associated with layers of the given @pipeline.
|
|
||||||
*
|
|
||||||
* <note>This api doesn't support any of the legacy global state
|
|
||||||
* options such as cogl_set_depth_test_enabled(),
|
|
||||||
* cogl_set_backface_culling_enabled() or cogl_program_use()</note>
|
|
||||||
*
|
|
||||||
* Stability: unstable
|
|
||||||
* Since: 1.10
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
cogl_framebuffer_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
CoglIndices *indices,
|
|
||||||
...) COGL_GNUC_NULL_TERMINATED;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cogl_framebuffer_draw_indexed_attributes:
|
|
||||||
* @framebuffer: A destination #CoglFramebuffer
|
|
||||||
* @pipeline: A #CoglPipeline state object
|
|
||||||
* @mode: The #CoglVerticesMode defining the topology of vertices
|
|
||||||
* @first_vertex: The vertex offset within the given attributes to draw from
|
|
||||||
* @n_vertices: The number of vertices to draw from the given attributes
|
|
||||||
* @indices: The array of indices used by the GPU to lookup attribute
|
|
||||||
* data for each vertex.
|
|
||||||
* @attributes: An array of pointers to #CoglAttribute<-- -->s defining vertex
|
|
||||||
* geometry
|
|
||||||
* @n_attributes: The number of attributes in the @attributes array.
|
|
||||||
*
|
|
||||||
* Behaves the same as cogl_framebuffer_draw_attributes() except that
|
|
||||||
* instead of reading vertex data sequentially from the specified
|
|
||||||
* @attributes the @indices provide an indirection for how the data
|
|
||||||
* should be indexed allowing a random access order to be
|
|
||||||
* specified.
|
|
||||||
*
|
|
||||||
* For example an indices array of [0, 1, 2, 0, 2, 3] could be used
|
|
||||||
* used to draw two triangles (@mode = %COGL_VERTICES_MODE_TRIANGLES +
|
|
||||||
* @n_vertices = 6) but only provide attribute data for the 4 corners
|
|
||||||
* of a rectangle. When the GPU needs to read in each of the 6
|
|
||||||
* vertices it will read the @indices array for each vertex in
|
|
||||||
* sequence and use the index to look up the vertex attribute data. So
|
|
||||||
* here you can see that first and fourth vertex will point to the
|
|
||||||
* same data and third and fifth vertex will also point to shared
|
|
||||||
* data.
|
|
||||||
*
|
|
||||||
* Drawing with indices can be a good way of minimizing the size of a
|
|
||||||
* mesh by allowing you to avoid data for duplicate vertices because
|
|
||||||
* multiple entries in the index array can refer back to a single
|
|
||||||
* shared vertex.
|
|
||||||
*
|
|
||||||
* <note>The @indices array must be at least as long as @first_vertex
|
|
||||||
* + @n_vertices otherwise the GPU will overrun the indices array when
|
|
||||||
* looking up vertex data.</note>
|
|
||||||
*
|
|
||||||
* Since it's very common to want to draw a run of rectangles using
|
|
||||||
* indices to avoid duplicating vertex data you can use
|
|
||||||
* cogl_get_rectangle_indices() to get a set of indices that can be
|
|
||||||
* shared.
|
|
||||||
*
|
|
||||||
* This drawing api doesn't support high-level meta texture types such
|
|
||||||
* as #CoglTexture2DSliced so it is the user's responsibility to
|
|
||||||
* ensure that only low-level textures that can be directly sampled by
|
|
||||||
* a GPU such as #CoglTexture2D, #CoglTextureRectangle or
|
|
||||||
* #CoglTexture3D are associated with layers of the given @pipeline.
|
|
||||||
*
|
|
||||||
* <note>This api doesn't support any of the legacy global state
|
|
||||||
* options such as cogl_set_depth_test_enabled(),
|
|
||||||
* cogl_set_backface_culling_enabled() or cogl_program_use()</note>
|
|
||||||
*
|
|
||||||
* Stability: unstable
|
|
||||||
* Since: 1.10
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
|
||||||
CoglPipeline *pipeline,
|
|
||||||
CoglVerticesMode mode,
|
|
||||||
int first_vertex,
|
|
||||||
int n_vertices,
|
|
||||||
CoglIndices *indices,
|
|
||||||
CoglAttribute **attributes,
|
|
||||||
int n_attributes);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_framebuffer_draw_rectangle:
|
* cogl_framebuffer_draw_rectangle:
|
||||||
* @framebuffer: A destination #CoglFramebuffer
|
* @framebuffer: A destination #CoglFramebuffer
|
||||||
@ -1391,9 +1179,8 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
|
|||||||
* #CoglMetaTexture texture such as #CoglTexture2DSliced textures
|
* #CoglMetaTexture texture such as #CoglTexture2DSliced textures
|
||||||
* which may internally be comprised of multiple low-level textures.
|
* which may internally be comprised of multiple low-level textures.
|
||||||
* This is unlike low-level drawing apis such as cogl_primitive_draw()
|
* This is unlike low-level drawing apis such as cogl_primitive_draw()
|
||||||
* or cogl_framebuffer_draw_attributes() which only support low level
|
* which only support low level texture types that are directly
|
||||||
* texture types that are directly supported by GPUs such as
|
* supported by GPUs such as #CoglTexture2D.
|
||||||
* #CoglTexture2D.
|
|
||||||
*
|
*
|
||||||
* <note>The given texture coordinates will only be used for the first
|
* <note>The given texture coordinates will only be used for the first
|
||||||
* texture layer of the pipeline and if your pipeline has more than
|
* texture layer of the pipeline and if your pipeline has more than
|
||||||
@ -1456,9 +1243,8 @@ cogl_framebuffer_draw_textured_rectangle (CoglFramebuffer *framebuffer,
|
|||||||
* #CoglMetaTexture texture for the first layer such as
|
* #CoglMetaTexture texture for the first layer such as
|
||||||
* #CoglTexture2DSliced textures which may internally be comprised of
|
* #CoglTexture2DSliced textures which may internally be comprised of
|
||||||
* multiple low-level textures. This is unlike low-level drawing apis
|
* multiple low-level textures. This is unlike low-level drawing apis
|
||||||
* such as cogl_primitive_draw() or cogl_framebuffer_draw_attributes()
|
* such as cogl_primitive_draw() which only support low level texture
|
||||||
* which only support low level texture types that are directly
|
* types that are directly supported by GPUs such as #CoglTexture2D.
|
||||||
* supported by GPUs such as #CoglTexture2D.
|
|
||||||
*
|
*
|
||||||
* <note>This api can not currently handle multiple high-level meta
|
* <note>This api can not currently handle multiple high-level meta
|
||||||
* texture layers. The first layer may be a high level meta texture
|
* texture layers. The first layer may be a high level meta texture
|
||||||
@ -1564,9 +1350,8 @@ cogl_framebuffer_draw_rectangles (CoglFramebuffer *framebuffer,
|
|||||||
* #CoglMetaTexture texture such as #CoglTexture2DSliced textures
|
* #CoglMetaTexture texture such as #CoglTexture2DSliced textures
|
||||||
* which may internally be comprised of multiple low-level textures.
|
* which may internally be comprised of multiple low-level textures.
|
||||||
* This is unlike low-level drawing apis such as cogl_primitive_draw()
|
* This is unlike low-level drawing apis such as cogl_primitive_draw()
|
||||||
* or cogl_framebuffer_draw_attributes() which only support low level
|
* which only support low level texture types that are directly
|
||||||
* texture types that are directly supported by GPUs such as
|
* supported by GPUs such as #CoglTexture2D.
|
||||||
* #CoglTexture2D.
|
|
||||||
*
|
*
|
||||||
* The top left corner of the first rectangle is positioned at
|
* The top left corner of the first rectangle is positioned at
|
||||||
* (coordinates[0], coordinates[1]) and the bottom right corner is
|
* (coordinates[0], coordinates[1]) and the bottom right corner is
|
||||||
|
@ -66,10 +66,10 @@ COGL_BEGIN_DECLS
|
|||||||
* Cogl doesn't aim to pretend that meta-textures are just like real
|
* Cogl doesn't aim to pretend that meta-textures are just like real
|
||||||
* textures because it would get extremely complex to try and emulate
|
* textures because it would get extremely complex to try and emulate
|
||||||
* low-level GPU semantics transparently for these textures. The low
|
* low-level GPU semantics transparently for these textures. The low
|
||||||
* level drawing APIs of Cogl, such as cogl_framebuffer_draw_attributes()
|
* level drawing APIs of Cogl, such as cogl_primitive_draw() don't
|
||||||
* don't actually know anything about the #CoglMetaTexture interface and its
|
* actually know anything about the #CoglMetaTexture interface and its
|
||||||
* the developer's responsibility to resolve all textures referenced by a
|
* the developer's responsibility to resolve all textures referenced
|
||||||
* #CoglPipeline to low-level textures before drawing.
|
* by a #CoglPipeline to low-level textures before drawing.
|
||||||
*
|
*
|
||||||
* If you want to develop custom primitive APIs like
|
* If you want to develop custom primitive APIs like
|
||||||
* cogl_framebuffer_draw_rectangle() and you want to support drawing
|
* cogl_framebuffer_draw_rectangle() and you want to support drawing
|
||||||
@ -77,7 +77,7 @@ COGL_BEGIN_DECLS
|
|||||||
* example, then you will need to use this #CoglMetaTexture interface
|
* example, then you will need to use this #CoglMetaTexture interface
|
||||||
* to be able to resolve high-level textures into low-level textures
|
* to be able to resolve high-level textures into low-level textures
|
||||||
* before drawing with Cogl's low-level drawing APIs such as
|
* before drawing with Cogl's low-level drawing APIs such as
|
||||||
* cogl_framebuffer_draw_attributes().
|
* cogl_primitive_draw().
|
||||||
*
|
*
|
||||||
* <note>Most developers won't need to use this interface directly
|
* <note>Most developers won't need to use this interface directly
|
||||||
* but still it is worth understanding the distinction between
|
* but still it is worth understanding the distinction between
|
||||||
@ -153,10 +153,10 @@ typedef void (*CoglMetaTextureCallback) (CoglTexture *sub_texture,
|
|||||||
* internally use this API to resolve the low level textures of any
|
* internally use this API to resolve the low level textures of any
|
||||||
* meta textures you have associated with CoglPipeline layers.
|
* meta textures you have associated with CoglPipeline layers.
|
||||||
*
|
*
|
||||||
* <note>The low level drawing APIs such as cogl_framebuffer_draw_attributes()
|
* <note>The low level drawing APIs such as cogl_primitive_draw()
|
||||||
* don't understand the #CoglMetaTexture interface and so it is your
|
* don't understand the #CoglMetaTexture interface and so it is your
|
||||||
* responsibility to use this API to resolve all CoglPipeline
|
* responsibility to use this API to resolve all CoglPipeline textures
|
||||||
* textures into low-level textures before drawing.</note>
|
* into low-level textures before drawing.</note>
|
||||||
*
|
*
|
||||||
* For each low-level texture that makes up part of the given region
|
* For each low-level texture that makes up part of the given region
|
||||||
* of the @meta_texture, @callback is called specifying how the
|
* of the @meta_texture, @callback is called specifying how the
|
||||||
|
@ -46,9 +46,9 @@ COGL_BEGIN_DECLS
|
|||||||
* as #CoglAtlasTexture and #CoglTexture2DSliced.
|
* as #CoglAtlasTexture and #CoglTexture2DSliced.
|
||||||
*
|
*
|
||||||
* A texture that implements this interface can be directly used with
|
* A texture that implements this interface can be directly used with
|
||||||
* the attributes API such as cogl_framebuffer_draw_attributes().
|
* the low level cogl_primitive_draw() API. Other types of textures
|
||||||
* Other types of textures need to be first resolved to primitive
|
* need to be first resolved to primitive textures using the
|
||||||
* textures using the #CoglMetaTexture interface.
|
* #CoglMetaTexture interface.
|
||||||
*
|
*
|
||||||
* <note>Most developers won't need to use this interface directly but
|
* <note>Most developers won't need to use this interface directly but
|
||||||
* still it is worth understanding the distinction between high-level
|
* still it is worth understanding the distinction between high-level
|
||||||
|
@ -226,8 +226,6 @@ cogl_framebuffer_allocate
|
|||||||
cogl_framebuffer_clear4f
|
cogl_framebuffer_clear4f
|
||||||
cogl_framebuffer_clear
|
cogl_framebuffer_clear
|
||||||
cogl_framebuffer_discard_buffers
|
cogl_framebuffer_discard_buffers
|
||||||
cogl_framebuffer_draw_attributes
|
|
||||||
cogl_framebuffer_draw_indexed_attributes
|
|
||||||
cogl_framebuffer_draw_rectangle
|
cogl_framebuffer_draw_rectangle
|
||||||
cogl_framebuffer_draw_rectangles
|
cogl_framebuffer_draw_rectangles
|
||||||
cogl_framebuffer_draw_textured_rectangle
|
cogl_framebuffer_draw_textured_rectangle
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "cogl2-compatibility.h"
|
#include "cogl2-compatibility.h"
|
||||||
#include "cogl-framebuffer.h"
|
#include "cogl-framebuffer.h"
|
||||||
|
#include "cogl-framebuffer-private.h"
|
||||||
#include "cogl-index-buffer.h"
|
#include "cogl-index-buffer.h"
|
||||||
#include "cogl-pipeline.h"
|
#include "cogl-pipeline.h"
|
||||||
|
|
||||||
@ -137,12 +138,13 @@ cogl_vdraw_indexed_attributes (CoglFramebuffer *framebuffer,
|
|||||||
attributes[i] = attribute;
|
attributes[i] = attribute;
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
cogl_framebuffer_draw_indexed_attributes (framebuffer,
|
_cogl_framebuffer_draw_indexed_attributes (framebuffer,
|
||||||
pipeline,
|
pipeline,
|
||||||
mode,
|
mode,
|
||||||
first_vertex,
|
first_vertex,
|
||||||
n_vertices,
|
n_vertices,
|
||||||
indices,
|
indices,
|
||||||
attributes,
|
attributes,
|
||||||
n_attributes);
|
n_attributes,
|
||||||
|
COGL_DRAW_SKIP_LEGACY_STATE);
|
||||||
}
|
}
|
||||||
|
@ -225,14 +225,17 @@ _cogl_path_stroke_nodes (CoglPath *path,
|
|||||||
path_start < data->path_nodes->len;
|
path_start < data->path_nodes->len;
|
||||||
path_start += node->path_size)
|
path_start += node->path_size)
|
||||||
{
|
{
|
||||||
|
CoglPrimitive *primitive;
|
||||||
|
|
||||||
node = &g_array_index (data->path_nodes, CoglPathNode, path_start);
|
node = &g_array_index (data->path_nodes, CoglPathNode, path_start);
|
||||||
|
|
||||||
cogl_framebuffer_vdraw_attributes (framebuffer,
|
primitive =
|
||||||
pipeline,
|
cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_LINE_STRIP,
|
||||||
COGL_VERTICES_MODE_LINE_STRIP,
|
node->path_size,
|
||||||
0, node->path_size,
|
&data->stroke_attributes[path_num],
|
||||||
data->stroke_attributes[path_num],
|
1);
|
||||||
NULL);
|
cogl_primitive_draw (primitive, framebuffer, pipeline);
|
||||||
|
cogl_object_unref (primitive);
|
||||||
|
|
||||||
path_num++;
|
path_num++;
|
||||||
}
|
}
|
||||||
|
@ -542,10 +542,6 @@ cogl_framebuffer_set_dither_enabled
|
|||||||
cogl_framebuffer_get_dither_enabled
|
cogl_framebuffer_get_dither_enabled
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
cogl_framebuffer_draw_attributes
|
|
||||||
cogl_framebuffer_vdraw_attributes
|
|
||||||
cogl_framebuffer_draw_indexed_attributes
|
|
||||||
cogl_framebuffer_vdraw_indexed_attributes
|
|
||||||
cogl_framebuffer_draw_rectangle
|
cogl_framebuffer_draw_rectangle
|
||||||
cogl_framebuffer_draw_textured_rectangle
|
cogl_framebuffer_draw_textured_rectangle
|
||||||
cogl_framebuffer_draw_multitextured_rectangle
|
cogl_framebuffer_draw_multitextured_rectangle
|
||||||
|
@ -31,6 +31,7 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
{
|
{
|
||||||
CoglAttribute *attributes[2];
|
CoglAttribute *attributes[2];
|
||||||
CoglAttributeBuffer *buffer;
|
CoglAttributeBuffer *buffer;
|
||||||
|
CoglPrimitive *primitive;
|
||||||
|
|
||||||
static const FloatVert float_verts[] =
|
static const FloatVert float_verts[] =
|
||||||
{
|
{
|
||||||
@ -61,13 +62,12 @@ test_float_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
cogl_framebuffer_push_matrix (test_fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
|
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (test_fb,
|
primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
|
||||||
state->pipeline,
|
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
|
||||||
0, /* first_vertex */
|
|
||||||
6, /* n_vertices */
|
6, /* n_vertices */
|
||||||
attributes,
|
attributes,
|
||||||
2 /* n_attributes */);
|
2); /* n_attributes */
|
||||||
|
cogl_primitive_draw (primitive, test_fb, state->pipeline);
|
||||||
|
cogl_object_unref (primitive);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (test_fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
{
|
{
|
||||||
CoglAttribute *attributes[2];
|
CoglAttribute *attributes[2];
|
||||||
CoglAttributeBuffer *buffer, *unnorm_buffer;
|
CoglAttributeBuffer *buffer, *unnorm_buffer;
|
||||||
|
CoglPrimitive *primitive;
|
||||||
|
|
||||||
static const ByteVert norm_verts[] =
|
static const ByteVert norm_verts[] =
|
||||||
{
|
{
|
||||||
@ -122,13 +123,12 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
cogl_framebuffer_push_matrix (test_fb);
|
cogl_framebuffer_push_matrix (test_fb);
|
||||||
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
|
cogl_framebuffer_translate (test_fb, offset_x, offset_y, 0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (test_fb,
|
primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
|
||||||
state->pipeline,
|
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
|
||||||
0, /* first_vertex */
|
|
||||||
6, /* n_vertices */
|
6, /* n_vertices */
|
||||||
attributes,
|
attributes,
|
||||||
2 /* n_attributes */);
|
2); /* n_attributes */
|
||||||
|
cogl_primitive_draw (primitive, test_fb, state->pipeline);
|
||||||
|
cogl_object_unref (primitive);
|
||||||
|
|
||||||
cogl_object_unref (attributes[1]);
|
cogl_object_unref (attributes[1]);
|
||||||
|
|
||||||
@ -145,13 +145,12 @@ test_byte_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
|
|
||||||
cogl_framebuffer_translate (test_fb, 20, 0, 0);
|
cogl_framebuffer_translate (test_fb, 20, 0, 0);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (test_fb,
|
primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
|
||||||
state->pipeline,
|
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
|
||||||
0, /* first_vertex */
|
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
attributes,
|
attributes,
|
||||||
2 /* n_attributes */);
|
2); /* n_attributes */
|
||||||
|
cogl_primitive_draw (primitive, test_fb, state->pipeline);
|
||||||
|
cogl_object_unref (primitive);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (test_fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
@ -172,6 +171,7 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
CoglAttributeBuffer *buffer;
|
CoglAttributeBuffer *buffer;
|
||||||
CoglPipeline *pipeline, *pipeline2;
|
CoglPipeline *pipeline, *pipeline2;
|
||||||
CoglSnippet *snippet;
|
CoglSnippet *snippet;
|
||||||
|
CoglPrimitive *primitive;
|
||||||
|
|
||||||
static const ShortVert short_verts[] =
|
static const ShortVert short_verts[] =
|
||||||
{
|
{
|
||||||
@ -208,13 +208,12 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
offset_y + 10.0f,
|
offset_y + 10.0f,
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (test_fb,
|
primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
|
||||||
pipeline,
|
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
|
||||||
0, /* first_vertex */
|
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
attributes,
|
attributes,
|
||||||
1 /* n_attributes */);
|
1); /* n_attributes */
|
||||||
|
cogl_primitive_draw (primitive, test_fb, pipeline);
|
||||||
|
cogl_object_unref (primitive);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (test_fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
@ -237,13 +236,12 @@ test_short_verts (TestState *state, int offset_x, int offset_y)
|
|||||||
offset_y - 65525,
|
offset_y - 65525,
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
cogl_framebuffer_draw_attributes (test_fb,
|
primitive = cogl_primitive_new_with_attributes (COGL_VERTICES_MODE_TRIANGLES,
|
||||||
pipeline2,
|
|
||||||
COGL_VERTICES_MODE_TRIANGLES,
|
|
||||||
0, /* first_vertex */
|
|
||||||
3, /* n_vertices */
|
3, /* n_vertices */
|
||||||
attributes,
|
attributes,
|
||||||
1 /* n_attributes */);
|
1); /* n_attributes */
|
||||||
|
cogl_primitive_draw (primitive, test_fb, pipeline2);
|
||||||
|
cogl_object_unref (primitive);
|
||||||
|
|
||||||
cogl_framebuffer_pop_matrix (test_fb);
|
cogl_framebuffer_pop_matrix (test_fb);
|
||||||
|
|
||||||
|
@ -32,6 +32,7 @@ test_map_buffer_range (void)
|
|||||||
CoglVertexP2T2 *data;
|
CoglVertexP2T2 *data;
|
||||||
CoglAttribute *pos_attribute;
|
CoglAttribute *pos_attribute;
|
||||||
CoglAttribute *tex_coord_attribute;
|
CoglAttribute *tex_coord_attribute;
|
||||||
|
CoglPrimitive *primitive;
|
||||||
|
|
||||||
tex = cogl_texture_2d_new_from_data (test_ctx,
|
tex = cogl_texture_2d_new_from_data (test_ctx,
|
||||||
2, 2, /* width/height */
|
2, 2, /* width/height */
|
||||||
@ -95,14 +96,14 @@ test_map_buffer_range (void)
|
|||||||
COGL_BUFFER_BIT_COLOR,
|
COGL_BUFFER_BIT_COLOR,
|
||||||
0, 0, 0, 1);
|
0, 0, 0, 1);
|
||||||
|
|
||||||
cogl_framebuffer_vdraw_attributes (test_fb,
|
primitive =
|
||||||
pipeline,
|
cogl_primitive_new (COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
||||||
COGL_VERTICES_MODE_TRIANGLE_STRIP,
|
|
||||||
0, /* first_vertex */
|
|
||||||
4, /* n_vertices */
|
4, /* n_vertices */
|
||||||
pos_attribute,
|
pos_attribute,
|
||||||
tex_coord_attribute,
|
tex_coord_attribute,
|
||||||
NULL);
|
NULL);
|
||||||
|
cogl_primitive_draw (primitive, test_fb, pipeline);
|
||||||
|
cogl_object_unref (primitive);
|
||||||
|
|
||||||
/* Top left pixel should be the one that is replaced to be green */
|
/* Top left pixel should be the one that is replaced to be green */
|
||||||
test_utils_check_pixel (test_fb, 1, 1, 0x00ff00ff);
|
test_utils_check_pixel (test_fb, 1, 1, 0x00ff00ff);
|
||||||
|
Loading…
Reference in New Issue
Block a user