cogl: Add default impls for FramebufferDriver
Allowing to simplify the NopFramebufferDriver. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4165>
This commit is contained in:
parent
195a9b5f87
commit
b0219f0697
@ -28,6 +28,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "cogl/cogl-framebuffer-driver.h"
|
#include "cogl/cogl-framebuffer-driver.h"
|
||||||
|
#include "cogl/cogl-framebuffer-private.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@ -199,6 +200,75 @@ cogl_framebuffer_driver_set_property (GObject *object,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_framebuffer_real_query_bits (CoglFramebufferDriver *driver,
|
||||||
|
CoglFramebufferBits *bits)
|
||||||
|
{
|
||||||
|
memset (bits, 0, sizeof (CoglFramebufferBits));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_framebuffer_real_clear (CoglFramebufferDriver *driver,
|
||||||
|
unsigned long buffers,
|
||||||
|
float red,
|
||||||
|
float green,
|
||||||
|
float blue,
|
||||||
|
float alpha)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_framebuffer_real_finish (CoglFramebufferDriver *driver)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_framebuffer_real_flush (CoglFramebufferDriver *driver)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_framebuffer_real_discard_buffers (CoglFramebufferDriver *driver,
|
||||||
|
unsigned long buffers)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_framebuffer_real_draw_attributes (CoglFramebufferDriver *driver,
|
||||||
|
CoglPipeline *pipeline,
|
||||||
|
CoglVerticesMode mode,
|
||||||
|
int first_vertex,
|
||||||
|
int n_vertices,
|
||||||
|
CoglAttribute **attributes,
|
||||||
|
int n_attributes,
|
||||||
|
CoglDrawFlags flags)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_framebuffer_real_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 gboolean
|
||||||
|
cogl_framebuffer_real_read_pixels_into_bitmap (CoglFramebufferDriver *framebuffer,
|
||||||
|
int x,
|
||||||
|
int y,
|
||||||
|
CoglReadPixelsFlags source,
|
||||||
|
CoglBitmap *bitmap,
|
||||||
|
GError **error)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cogl_framebuffer_driver_init (CoglFramebufferDriver *driver)
|
cogl_framebuffer_driver_init (CoglFramebufferDriver *driver)
|
||||||
{
|
{
|
||||||
@ -219,4 +289,15 @@ cogl_framebuffer_driver_class_init (CoglFramebufferDriverClass *klass)
|
|||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS);
|
G_PARAM_STATIC_STRINGS);
|
||||||
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||||
|
|
||||||
|
klass->query_bits = cogl_framebuffer_real_query_bits;
|
||||||
|
klass->clear = cogl_framebuffer_real_clear;
|
||||||
|
klass->finish = cogl_framebuffer_real_finish;
|
||||||
|
klass->flush = cogl_framebuffer_real_flush;
|
||||||
|
klass->discard_buffers = cogl_framebuffer_real_discard_buffers;
|
||||||
|
klass->draw_attributes = cogl_framebuffer_real_draw_attributes;
|
||||||
|
klass->draw_indexed_attributes =
|
||||||
|
cogl_framebuffer_real_draw_indexed_attributes;
|
||||||
|
klass->read_pixels_into_bitmap =
|
||||||
|
cogl_framebuffer_real_read_pixels_into_bitmap;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,31 @@
|
|||||||
#include "cogl/cogl-feature-private.h"
|
#include "cogl/cogl-feature-private.h"
|
||||||
#include "cogl/cogl-renderer-private.h"
|
#include "cogl/cogl-renderer-private.h"
|
||||||
#include "cogl/driver/nop/cogl-texture-2d-nop-private.h"
|
#include "cogl/driver/nop/cogl-texture-2d-nop-private.h"
|
||||||
#include "cogl/driver/nop/cogl-nop-framebuffer.h"
|
|
||||||
|
#define COGL_TYPE_NOP_FRAMEBUFFER (cogl_nop_framebuffer_get_type ())
|
||||||
|
G_DECLARE_FINAL_TYPE (CoglNopFramebuffer, cogl_nop_framebuffer,
|
||||||
|
COGL, NOP_FRAMEBUFFER_DRIVER,
|
||||||
|
CoglFramebufferDriver)
|
||||||
|
|
||||||
|
|
||||||
|
struct _CoglNopFramebuffer
|
||||||
|
{
|
||||||
|
CoglFramebufferDriver parent;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_FINAL_TYPE (CoglNopFramebuffer, cogl_nop_framebuffer,
|
||||||
|
COGL_TYPE_FRAMEBUFFER_DRIVER)
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_nop_framebuffer_init (CoglNopFramebuffer *nop_framebuffer)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cogl_nop_framebuffer_class_init (CoglNopFramebufferClass *klass)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
_cogl_driver_update_features (CoglContext *ctx,
|
_cogl_driver_update_features (CoglContext *ctx,
|
||||||
|
@ -1,130 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2020 Red Hat
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person
|
|
||||||
* obtaining a copy of this software and associated documentation
|
|
||||||
* files (the "Software"), to deal in the Software without
|
|
||||||
* restriction, including without limitation the rights to use, copy,
|
|
||||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
* of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "cogl/driver/nop/cogl-nop-framebuffer.h"
|
|
||||||
|
|
||||||
#include "cogl/cogl-framebuffer-private.h"
|
|
||||||
|
|
||||||
struct _CoglNopFramebuffer
|
|
||||||
{
|
|
||||||
CoglFramebufferDriver parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
G_DEFINE_FINAL_TYPE (CoglNopFramebuffer, cogl_nop_framebuffer,
|
|
||||||
COGL_TYPE_FRAMEBUFFER_DRIVER)
|
|
||||||
|
|
||||||
static void
|
|
||||||
cogl_nop_framebuffer_query_bits (CoglFramebufferDriver *driver,
|
|
||||||
CoglFramebufferBits *bits)
|
|
||||||
{
|
|
||||||
memset (bits, 0, sizeof (CoglFramebufferBits));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cogl_nop_framebuffer_clear (CoglFramebufferDriver *driver,
|
|
||||||
unsigned long buffers,
|
|
||||||
float red,
|
|
||||||
float green,
|
|
||||||
float blue,
|
|
||||||
float alpha)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cogl_nop_framebuffer_finish (CoglFramebufferDriver *driver)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cogl_nop_framebuffer_flush (CoglFramebufferDriver *driver)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cogl_nop_framebuffer_discard_buffers (CoglFramebufferDriver *driver,
|
|
||||||
unsigned long buffers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
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 gboolean
|
|
||||||
cogl_nop_framebuffer_read_pixels_into_bitmap (CoglFramebufferDriver *framebuffer,
|
|
||||||
int x,
|
|
||||||
int y,
|
|
||||||
CoglReadPixelsFlags source,
|
|
||||||
CoglBitmap *bitmap,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cogl_nop_framebuffer_init (CoglNopFramebuffer *nop_framebuffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cogl_nop_framebuffer_class_init (CoglNopFramebufferClass *klass)
|
|
||||||
{
|
|
||||||
CoglFramebufferDriverClass *driver_class =
|
|
||||||
COGL_FRAMEBUFFER_DRIVER_CLASS (klass);
|
|
||||||
|
|
||||||
driver_class->query_bits = cogl_nop_framebuffer_query_bits;
|
|
||||||
driver_class->clear = cogl_nop_framebuffer_clear;
|
|
||||||
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;
|
|
||||||
driver_class->read_pixels_into_bitmap =
|
|
||||||
cogl_nop_framebuffer_read_pixels_into_bitmap;
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2020 Red Hat
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person
|
|
||||||
* obtaining a copy of this software and associated documentation
|
|
||||||
* files (the "Software"), to deal in the Software without
|
|
||||||
* restriction, including without limitation the rights to use, copy,
|
|
||||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
* of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "cogl/cogl-framebuffer-driver.h"
|
|
||||||
|
|
||||||
#define COGL_TYPE_NOP_FRAMEBUFFER (cogl_nop_framebuffer_get_type ())
|
|
||||||
G_DECLARE_FINAL_TYPE (CoglNopFramebuffer, cogl_nop_framebuffer,
|
|
||||||
COGL, NOP_FRAMEBUFFER_DRIVER,
|
|
||||||
CoglFramebufferDriver)
|
|
@ -64,8 +64,6 @@ cogl_nodist_headers = [
|
|||||||
|
|
||||||
cogl_noop_driver_sources = [
|
cogl_noop_driver_sources = [
|
||||||
'driver/nop/cogl-driver-nop.c',
|
'driver/nop/cogl-driver-nop.c',
|
||||||
'driver/nop/cogl-nop-framebuffer.c',
|
|
||||||
'driver/nop/cogl-nop-framebuffer.h',
|
|
||||||
'driver/nop/cogl-texture-2d-nop-private.h',
|
'driver/nop/cogl-texture-2d-nop-private.h',
|
||||||
'driver/nop/cogl-texture-2d-nop.c',
|
'driver/nop/cogl-texture-2d-nop.c',
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user