mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
cogl/framebuffer: Move attribute drawing to driver class
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1514>
This commit is contained in:
parent
392ffaeeb4
commit
1e5f105836
@ -85,27 +85,6 @@ struct _CoglDriverVtable
|
||||
CoglFramebuffer *read_buffer,
|
||||
CoglFramebufferState state);
|
||||
|
||||
void
|
||||
(* framebuffer_draw_attributes) (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
void
|
||||
(* framebuffer_draw_indexed_attributes) (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
gboolean
|
||||
(* framebuffer_read_pixels_into_bitmap) (CoglFramebuffer *framebuffer,
|
||||
int x,
|
||||
|
@ -100,6 +100,51 @@ cogl_framebuffer_driver_discard_buffers (CoglFramebufferDriver *driver,
|
||||
COGL_FRAMEBUFFER_DRIVER_GET_CLASS (driver)->discard_buffers (driver, buffers);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_framebuffer_driver_draw_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
COGL_FRAMEBUFFER_DRIVER_GET_CLASS (driver)->draw_attributes (driver,
|
||||
pipeline,
|
||||
mode,
|
||||
first_vertex,
|
||||
n_vertices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
flags);
|
||||
}
|
||||
|
||||
void
|
||||
cogl_framebuffer_driver_draw_indexed_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
CoglFramebufferDriverClass *klass =
|
||||
COGL_FRAMEBUFFER_DRIVER_GET_CLASS (driver);
|
||||
|
||||
klass->draw_indexed_attributes (driver,
|
||||
pipeline,
|
||||
mode,
|
||||
first_vertex,
|
||||
n_vertices,
|
||||
indices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
flags);
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_framebuffer_driver_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
@ -28,6 +28,7 @@
|
||||
#ifndef COGL_FRAMEBUFFER_DRIVER_H
|
||||
#define COGL_FRAMEBUFFER_DRIVER_H
|
||||
|
||||
#include "cogl-attribute-private.h"
|
||||
#include "cogl-framebuffer.h"
|
||||
|
||||
typedef struct _CoglFramebufferBits CoglFramebufferBits;
|
||||
@ -58,6 +59,25 @@ struct _CoglFramebufferDriverClass
|
||||
|
||||
void (* discard_buffers) (CoglFramebufferDriver *driver,
|
||||
unsigned long buffers);
|
||||
|
||||
void (* draw_attributes) (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
void (* draw_indexed_attributes) (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
};
|
||||
|
||||
CoglFramebuffer *
|
||||
@ -85,4 +105,25 @@ void
|
||||
cogl_framebuffer_driver_discard_buffers (CoglFramebufferDriver *driver,
|
||||
unsigned long buffers);
|
||||
|
||||
void
|
||||
cogl_framebuffer_driver_draw_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
void
|
||||
cogl_framebuffer_driver_draw_indexed_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
#endif /* COGL_FRAMEBUFFER_DRIVER_H */
|
||||
|
@ -2478,16 +2478,14 @@ _cogl_framebuffer_draw_attributes (CoglFramebuffer *framebuffer,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
CoglContext *ctx = priv->context;
|
||||
|
||||
ctx->driver_vtable->framebuffer_draw_attributes (framebuffer,
|
||||
pipeline,
|
||||
mode,
|
||||
first_vertex,
|
||||
n_vertices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
flags);
|
||||
cogl_framebuffer_driver_draw_attributes (priv->driver,
|
||||
pipeline,
|
||||
mode,
|
||||
first_vertex,
|
||||
n_vertices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2519,17 +2517,15 @@ _cogl_framebuffer_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||
else
|
||||
#endif
|
||||
{
|
||||
CoglContext *ctx = priv->context;
|
||||
|
||||
ctx->driver_vtable->framebuffer_draw_indexed_attributes (framebuffer,
|
||||
pipeline,
|
||||
mode,
|
||||
first_vertex,
|
||||
n_vertices,
|
||||
indices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
flags);
|
||||
cogl_framebuffer_driver_draw_indexed_attributes (priv->driver,
|
||||
pipeline,
|
||||
mode,
|
||||
first_vertex,
|
||||
n_vertices,
|
||||
indices,
|
||||
attributes,
|
||||
n_attributes,
|
||||
flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,27 +55,6 @@ void
|
||||
cogl_gl_framebuffer_bind (CoglGlFramebuffer *gl_framebuffer,
|
||||
GLenum target);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_gl_draw_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_gl_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
gboolean
|
||||
_cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
||||
int x,
|
||||
|
@ -328,16 +328,19 @@ cogl_gl_framebuffer_flush (CoglFramebufferDriver *driver)
|
||||
GE (ctx, glFlush ());
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_gl_draw_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
static void
|
||||
cogl_gl_framebuffer_draw_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
CoglFramebuffer *framebuffer =
|
||||
cogl_framebuffer_driver_get_framebuffer (driver);
|
||||
|
||||
_cogl_flush_attributes_state (framebuffer, pipeline, flags,
|
||||
attributes, n_attributes);
|
||||
|
||||
@ -360,17 +363,19 @@ sizeof_index_type (CoglIndicesType type)
|
||||
g_return_val_if_reached (0);
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_gl_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
static void
|
||||
cogl_gl_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
CoglFramebuffer *framebuffer =
|
||||
cogl_framebuffer_driver_get_framebuffer (driver);
|
||||
CoglBuffer *buffer;
|
||||
uint8_t *base;
|
||||
size_t buffer_offset;
|
||||
@ -685,4 +690,7 @@ cogl_gl_framebuffer_class_init (CoglGlFramebufferClass *klass)
|
||||
driver_class->clear = cogl_gl_framebuffer_clear;
|
||||
driver_class->finish = cogl_gl_framebuffer_finish;
|
||||
driver_class->flush = cogl_gl_framebuffer_flush;
|
||||
driver_class->draw_attributes = cogl_gl_framebuffer_draw_attributes;
|
||||
driver_class->draw_indexed_attributes =
|
||||
cogl_gl_framebuffer_draw_indexed_attributes;
|
||||
}
|
||||
|
@ -571,8 +571,6 @@ _cogl_driver_gl =
|
||||
_cogl_driver_update_features,
|
||||
_cogl_driver_gl_create_framebuffer_driver,
|
||||
_cogl_driver_gl_flush_framebuffer_state,
|
||||
_cogl_framebuffer_gl_draw_attributes,
|
||||
_cogl_framebuffer_gl_draw_indexed_attributes,
|
||||
_cogl_framebuffer_gl_read_pixels_into_bitmap,
|
||||
_cogl_texture_2d_gl_free,
|
||||
_cogl_texture_2d_gl_can_create,
|
||||
|
@ -459,8 +459,6 @@ _cogl_driver_gles =
|
||||
_cogl_driver_update_features,
|
||||
_cogl_driver_gl_create_framebuffer_driver,
|
||||
_cogl_driver_gl_flush_framebuffer_state,
|
||||
_cogl_framebuffer_gl_draw_attributes,
|
||||
_cogl_framebuffer_gl_draw_indexed_attributes,
|
||||
_cogl_framebuffer_gl_read_pixels_into_bitmap,
|
||||
_cogl_texture_2d_gl_free,
|
||||
_cogl_texture_2d_gl_can_create,
|
||||
|
@ -99,8 +99,6 @@ _cogl_driver_nop =
|
||||
_cogl_driver_update_features,
|
||||
_cogl_driver_nop_create_framebuffer_driver,
|
||||
_cogl_driver_nop_flush_framebuffer_state,
|
||||
_cogl_framebuffer_nop_draw_attributes,
|
||||
_cogl_framebuffer_nop_draw_indexed_attributes,
|
||||
_cogl_framebuffer_nop_read_pixels_into_bitmap,
|
||||
_cogl_texture_2d_nop_free,
|
||||
_cogl_texture_2d_nop_can_create,
|
||||
|
@ -37,27 +37,6 @@
|
||||
#include "cogl-types.h"
|
||||
#include "cogl-context-private.h"
|
||||
|
||||
void
|
||||
_cogl_framebuffer_nop_draw_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
void
|
||||
_cogl_framebuffer_nop_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags);
|
||||
|
||||
gboolean
|
||||
_cogl_framebuffer_nop_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
||||
int x,
|
||||
|
@ -35,31 +35,6 @@
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
|
||||
void
|
||||
_cogl_framebuffer_nop_draw_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
_cogl_framebuffer_nop_draw_indexed_attributes (CoglFramebuffer *framebuffer,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
}
|
||||
|
||||
gboolean
|
||||
_cogl_framebuffer_nop_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
|
||||
int x,
|
||||
|
@ -70,6 +70,31 @@ cogl_nop_framebuffer_discard_buffers (CoglFramebufferDriver *driver,
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_nop_framebuffer_draw_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_nop_framebuffer_draw_indexed_attributes (CoglFramebufferDriver *driver,
|
||||
CoglPipeline *pipeline,
|
||||
CoglVerticesMode mode,
|
||||
int first_vertex,
|
||||
int n_vertices,
|
||||
CoglIndices *indices,
|
||||
CoglAttribute **attributes,
|
||||
int n_attributes,
|
||||
CoglDrawFlags flags)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
cogl_nop_framebuffer_init (CoglNopFramebuffer *nop_framebuffer)
|
||||
{
|
||||
@ -86,4 +111,7 @@ cogl_nop_framebuffer_class_init (CoglNopFramebufferClass *klass)
|
||||
driver_class->finish = cogl_nop_framebuffer_finish;
|
||||
driver_class->flush = cogl_nop_framebuffer_flush;
|
||||
driver_class->discard_buffers = cogl_nop_framebuffer_discard_buffers;
|
||||
driver_class->draw_attributes = cogl_nop_framebuffer_draw_attributes;
|
||||
driver_class->draw_indexed_attributes =
|
||||
cogl_nop_framebuffer_draw_indexed_attributes;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user