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:

committed by
Neil Roberts

parent
e9f721216e
commit
e4f24dba75
@ -1120,218 +1120,6 @@ cogl_framebuffer_draw_primitive (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
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:
|
||||
* @framebuffer: A destination #CoglFramebuffer
|
||||
@ -1391,9 +1179,8 @@ cogl_framebuffer_draw_rectangle (CoglFramebuffer *framebuffer,
|
||||
* #CoglMetaTexture texture such as #CoglTexture2DSliced textures
|
||||
* which may internally be comprised of multiple low-level textures.
|
||||
* This is unlike low-level drawing apis such as cogl_primitive_draw()
|
||||
* or cogl_framebuffer_draw_attributes() which only support low level
|
||||
* texture types that are directly supported by GPUs such as
|
||||
* #CoglTexture2D.
|
||||
* which only support low level texture types that are directly
|
||||
* supported by GPUs such as #CoglTexture2D.
|
||||
*
|
||||
* <note>The given texture coordinates will only be used for the first
|
||||
* 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
|
||||
* #CoglTexture2DSliced textures which may internally be comprised of
|
||||
* multiple low-level textures. This is unlike low-level drawing apis
|
||||
* such as cogl_primitive_draw() or cogl_framebuffer_draw_attributes()
|
||||
* which only support low level texture types that are directly
|
||||
* supported by GPUs such as #CoglTexture2D.
|
||||
* such as cogl_primitive_draw() which only support low level texture
|
||||
* types that are directly supported by GPUs such as #CoglTexture2D.
|
||||
*
|
||||
* <note>This api can not currently handle multiple high-level meta
|
||||
* 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
|
||||
* which may internally be comprised of multiple low-level textures.
|
||||
* This is unlike low-level drawing apis such as cogl_primitive_draw()
|
||||
* or cogl_framebuffer_draw_attributes() which only support low level
|
||||
* texture types that are directly supported by GPUs such as
|
||||
* #CoglTexture2D.
|
||||
* which only support low level texture types that are directly
|
||||
* supported by GPUs such as #CoglTexture2D.
|
||||
*
|
||||
* The top left corner of the first rectangle is positioned at
|
||||
* (coordinates[0], coordinates[1]) and the bottom right corner is
|
||||
|
Reference in New Issue
Block a user