diff --git a/cogl/cogl/cogl-driver.h b/cogl/cogl/cogl-driver.h index aa30f3d34..f2ae3e7b9 100644 --- a/cogl/cogl/cogl-driver.h +++ b/cogl/cogl/cogl-driver.h @@ -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, diff --git a/cogl/cogl/cogl-framebuffer-driver.c b/cogl/cogl/cogl-framebuffer-driver.c index 1e71f0c03..d49f90d29 100644 --- a/cogl/cogl/cogl-framebuffer-driver.c +++ b/cogl/cogl/cogl-framebuffer-driver.c @@ -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, diff --git a/cogl/cogl/cogl-framebuffer-driver.h b/cogl/cogl/cogl-framebuffer-driver.h index 3c88c489d..7608701e0 100644 --- a/cogl/cogl/cogl-framebuffer-driver.h +++ b/cogl/cogl/cogl-framebuffer-driver.h @@ -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 */ diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index 6c5ffa516..c02eabd9c 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -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); } } diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h b/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h index d6e2fd417..c7e2995c6 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h @@ -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, diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index b0d48fc16..fee3f2233 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -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; } diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index ef44dceda..76f213b74 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -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, diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index c573884fb..5b50b7691 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -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, diff --git a/cogl/cogl/driver/nop/cogl-driver-nop.c b/cogl/cogl/driver/nop/cogl-driver-nop.c index 55961e3a9..0d47bf28b 100644 --- a/cogl/cogl/driver/nop/cogl-driver-nop.c +++ b/cogl/cogl/driver/nop/cogl-driver-nop.c @@ -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, diff --git a/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h b/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h index 404985dd1..1fd031e5c 100644 --- a/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h +++ b/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h @@ -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, diff --git a/cogl/cogl/driver/nop/cogl-framebuffer-nop.c b/cogl/cogl/driver/nop/cogl-framebuffer-nop.c index 54811afbc..e0e290586 100644 --- a/cogl/cogl/driver/nop/cogl-framebuffer-nop.c +++ b/cogl/cogl/driver/nop/cogl-framebuffer-nop.c @@ -35,31 +35,6 @@ #include #include -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, diff --git a/cogl/cogl/driver/nop/cogl-nop-framebuffer.c b/cogl/cogl/driver/nop/cogl-nop-framebuffer.c index cea5ab906..20ec514a5 100644 --- a/cogl/cogl/driver/nop/cogl-nop-framebuffer.c +++ b/cogl/cogl/driver/nop/cogl-nop-framebuffer.c @@ -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; }