Adds a NOP driver

This adds a new "nop" driver that does nothing. This can be selected at
runtime either with the COGL_DRIVER=nop environment variable or by
passing COGL_DRIVER_NOP to cogl_renderer_set_driver()

Adding the nop driver gives us a way to test workloads without any
driver and hardware overheads which can help us understand how Cogl's
state tracking performs in isolation.

Having a nop driver can also serve as an shell/outline for creating
other drivers later.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
(cherry picked from commit 90587418233b6438290741d80aedf193ae660cad)
This commit is contained in:
Robert Bragg 2012-09-12 22:39:46 +01:00
parent 4efcd4e6a6
commit ae713a32d0
13 changed files with 766 additions and 17 deletions

View File

@ -136,6 +136,20 @@ cogl_experimental_h = \
cogl_nodist_experimental_h = \
$(NULL)
# nop driver
cogl_driver_sources = \
$(srcdir)/driver/nop/cogl-driver-nop-private.h \
$(srcdir)/driver/nop/cogl-driver-nop.c \
$(srcdir)/driver/nop/cogl-framebuffer-nop-private.h \
$(srcdir)/driver/nop/cogl-framebuffer-nop.c \
$(srcdir)/driver/nop/cogl-attribute-nop-private.h \
$(srcdir)/driver/nop/cogl-attribute-nop.c \
$(srcdir)/driver/nop/cogl-clip-stack-nop-private.h \
$(srcdir)/driver/nop/cogl-clip-stack-nop.c \
$(srcdir)/driver/nop/cogl-texture-2d-nop-private.h \
$(srcdir)/driver/nop/cogl-texture-2d-nop.c \
$(NULL)
# gl driver sources
cogl_gl_prototypes_h = \
$(srcdir)/gl-prototypes/cogl-gles2-functions.h \
@ -145,8 +159,7 @@ cogl_gl_prototypes_h = \
$(srcdir)/gl-prototypes/cogl-glsl-functions.h \
$(NULL)
# driver sources
cogl_driver_sources = \
cogl_driver_sources += \
$(srcdir)/driver/gl/cogl-framebuffer-gl.c \
$(srcdir)/driver/gl/cogl-texture-2d-gl-private.h \
$(srcdir)/driver/gl/cogl-texture-2d-gl.c \

View File

@ -261,10 +261,15 @@ cogl_context_new (CoglDisplay *display,
context->texture_units =
g_array_new (FALSE, FALSE, sizeof (CoglTextureUnit));
/* See cogl-pipeline.c for more details about why we leave texture unit 1
* active by default... */
context->active_texture_unit = 1;
GE (context, glActiveTexture (GL_TEXTURE1));
if (context->driver == COGL_DRIVER_GL ||
context->driver == COGL_DRIVER_GLES1 ||
context->driver == COGL_DRIVER_GLES2)
{
/* See cogl-pipeline.c for more details about why we leave texture unit 1
* active by default... */
context->active_texture_unit = 1;
GE (context, glActiveTexture (GL_TEXTURE1));
}
context->legacy_fog_state.enabled = FALSE;
@ -363,7 +368,8 @@ cogl_context_new (CoglDisplay *display,
context->blit_texture_pipeline = NULL;
#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES)
if (context->driver != COGL_DRIVER_GLES2)
if (context->driver == COGL_DRIVER_GL ||
context->driver == COGL_DRIVER_GLES1)
/* The default for GL_ALPHA_TEST is to always pass which is equivalent to
* the test being disabled therefore we assume that for all drivers there
* will be no performance impact if we always leave the test enabled which

View File

@ -88,6 +88,8 @@ extern const CoglTextureDriver _cogl_texture_driver_gles;
extern const CoglDriverVtable _cogl_driver_gles;
#endif
extern const CoglDriverVtable _cogl_driver_nop;
static CoglWinsysVtableGetter _cogl_winsys_vtable_getters[] =
{
#ifdef COGL_HAS_GLX_SUPPORT
@ -308,6 +310,15 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer,
}
#endif
if (renderer->driver_override == COGL_DRIVER_NOP ||
(renderer->driver_override == COGL_DRIVER_ANY &&
(driver_name == NULL || !g_ascii_strcasecmp (driver_name, "nop"))))
{
renderer->driver = COGL_DRIVER_NOP;
libgl_name = NULL;
goto found;
}
_cogl_set_error (error,
COGL_DRIVER_ERROR,
COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND,
@ -328,16 +339,21 @@ found:
#ifndef HAVE_DIRECTLY_LINKED_GL_LIBRARY
renderer->libgl_module = g_module_open (libgl_name,
G_MODULE_BIND_LAZY);
if (renderer->libgl_module == NULL)
if (renderer->driver == COGL_DRIVER_GL ||
renderer->driver == COGL_DRIVER_GLES1 ||
renderer->driver == COGL_DRIVER_GLES2)
{
_cogl_set_error (error, COGL_DRIVER_ERROR,
COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY,
"Failed to dynamically open the GL library \"%s\"",
libgl_name);
return FALSE;
renderer->libgl_module = g_module_open (libgl_name,
G_MODULE_BIND_LAZY);
if (renderer->libgl_module == NULL)
{
_cogl_set_error (error, COGL_DRIVER_ERROR,
COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY,
"Failed to dynamically open the GL library \"%s\"",
libgl_name);
return FALSE;
}
}
#endif /* HAVE_DIRECTLY_LINKED_GL_LIBRARY */
@ -359,8 +375,10 @@ found:
break;
#endif
case COGL_DRIVER_NOP:
default:
g_assert_not_reached ();
renderer->driver_vtable = &_cogl_driver_nop;
renderer->texture_driver = NULL;
}
return TRUE;

View File

@ -328,6 +328,7 @@ cogl_renderer_remove_constraint (CoglRenderer *renderer,
/**
* CoglDriver:
* @COGL_DRIVER_ANY: Implies no preference for which driver is used
* @COGL_DRIVER_NOP: A No-Op driver.
* @COGL_DRIVER_GL: An OpenGL driver.
* @COGL_DRIVER_GLES1: An OpenGL ES 1.1 driver.
* @COGL_DRIVER_GLES2: An OpenGL ES 2.0 driver.
@ -341,6 +342,7 @@ cogl_renderer_remove_constraint (CoglRenderer *renderer,
typedef enum
{
COGL_DRIVER_ANY,
COGL_DRIVER_NOP,
COGL_DRIVER_GL,
COGL_DRIVER_GLES1,
COGL_DRIVER_GLES2

View File

@ -0,0 +1,42 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef _COGL_ATTRIBUTE_NOP_PRIVATE_H_
#define _COGL_ATTRIBUTE_NOP_PRIVATE_H_
#include "cogl-types.h"
#include "cogl-context-private.h"
void
_cogl_nop_flush_attributes_state (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglFlushLayerState *layers_state,
CoglDrawFlags flags,
CoglAttribute **attributes,
int n_attributes);
#endif /* _COGL_ATTRIBUTE_NOP_PRIVATE_H_ */

View File

@ -0,0 +1,43 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-types.h"
#include "cogl-framebuffer.h"
#include "cogl-attribute.h"
#include "cogl-attribute-private.h"
#include "cogl-attribute-nop-private.h"
void
_cogl_nop_flush_attributes_state (CoglFramebuffer *framebuffer,
CoglPipeline *pipeline,
CoglFlushLayerState *layers_state,
CoglDrawFlags flags,
CoglAttribute **attributes,
int n_attributes)
{
}

View File

@ -0,0 +1,38 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef _COGL_CLIP_STACK_NOP_PRIVATE_H_
#define _COGL_CLIP_STACK_NOP_PRIVATE_H_
#include "cogl-types.h"
#include "cogl-context-private.h"
void
_cogl_clip_stack_nop_flush (CoglClipStack *stack,
CoglFramebuffer *framebuffer);
#endif /* _COGL_CLIP_STACK_NOP_PRIVATE_H_ */

View File

@ -0,0 +1,37 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-clip-stack.h"
#include "cogl-clip-stack-nop-private.h"
#include "cogl-framebuffer-private.h"
void
_cogl_clip_stack_nop_flush (CoglClipStack *stack,
CoglFramebuffer *framebuffer)
{
}

View File

@ -0,0 +1,83 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "cogl-private.h"
#include "cogl-internal.h"
#include "cogl-context-private.h"
#include "cogl-feature-private.h"
#include "cogl-renderer-private.h"
#include "cogl-error-private.h"
#include "cogl-framebuffer-nop-private.h"
#include "cogl-texture-2d-nop-private.h"
#include "cogl-attribute-nop-private.h"
#include "cogl-clip-stack-nop-private.h"
static CoglBool
_cogl_driver_update_features (CoglContext *ctx,
CoglError **error)
{
/* _cogl_gpu_info_init (ctx, &ctx->gpu); */
ctx->private_feature_flags = 0;
ctx->feature_flags = 0;
return TRUE;
}
const CoglDriverVtable
_cogl_driver_nop =
{
NULL, /* pixel_format_from_gl_internal */
NULL, /* pixel_format_to_gl */
_cogl_driver_update_features,
_cogl_offscreen_nop_allocate,
_cogl_offscreen_nop_free,
_cogl_framebuffer_nop_flush_state,
_cogl_framebuffer_nop_clear,
_cogl_framebuffer_nop_query_bits,
_cogl_framebuffer_nop_finish,
_cogl_framebuffer_nop_discard_buffers,
_cogl_framebuffer_nop_draw_attributes,
_cogl_framebuffer_nop_draw_indexed_attributes,
_cogl_texture_2d_nop_free,
_cogl_texture_2d_nop_can_create,
_cogl_texture_2d_nop_init,
_cogl_texture_2d_nop_new_with_size,
_cogl_texture_2d_nop_new_from_bitmap,
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
_cogl_egl_texture_2d_nop_new_from_image,
#endif
_cogl_texture_2d_nop_copy_from_framebuffer,
_cogl_texture_2d_nop_get_gl_handle,
_cogl_texture_2d_nop_generate_mipmap,
_cogl_texture_2d_nop_copy_from_bitmap,
NULL, /* texture_2d_get_data */
_cogl_nop_flush_attributes_state,
_cogl_clip_stack_nop_flush,
};

View File

@ -0,0 +1,89 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef _COGL_FRAMEBUFFER_NOP_PRIVATE_H_
#define _COGL_FRAMEBUFFER_NOP_PRIVATE_H_
#include "cogl-types.h"
#include "cogl-context-private.h"
CoglBool
_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen,
CoglError **error);
void
_cogl_offscreen_nop_free (CoglOffscreen *offscreen);
void
_cogl_framebuffer_nop_flush_state (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer,
CoglFramebufferState state);
void
_cogl_framebuffer_nop_clear (CoglFramebuffer *framebuffer,
unsigned long buffers,
float red,
float green,
float blue,
float alpha);
void
_cogl_framebuffer_nop_query_bits (CoglFramebuffer *framebuffer,
int *red,
int *green,
int *blue,
int *alpha);
void
_cogl_framebuffer_nop_finish (CoglFramebuffer *framebuffer);
void
_cogl_framebuffer_nop_discard_buffers (CoglFramebuffer *framebuffer,
unsigned long buffers);
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);
#endif /* _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ */

View File

@ -0,0 +1,110 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2007,2008,2009,2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "cogl-framebuffer-nop-private.h"
#include <glib.h>
void
_cogl_framebuffer_nop_flush_state (CoglFramebuffer *draw_buffer,
CoglFramebuffer *read_buffer,
CoglFramebufferState state)
{
}
CoglBool
_cogl_offscreen_nop_allocate (CoglOffscreen *offscreen,
CoglError **error)
{
return TRUE;
}
void
_cogl_offscreen_nop_free (CoglOffscreen *offscreen)
{
}
void
_cogl_framebuffer_nop_clear (CoglFramebuffer *framebuffer,
unsigned long buffers,
float red,
float green,
float blue,
float alpha)
{
}
void
_cogl_framebuffer_nop_query_bits (CoglFramebuffer *framebuffer,
int *red,
int *green,
int *blue,
int *alpha)
{
*red = 0;
*green = 0;
*blue = 0;
*alpha = 0;
}
void
_cogl_framebuffer_nop_finish (CoglFramebuffer *framebuffer)
{
}
void
_cogl_framebuffer_nop_discard_buffers (CoglFramebuffer *framebuffer,
unsigned long buffers)
{
}
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)
{
}

View File

@ -0,0 +1,112 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
*
*
* Authors:
* Robert Bragg <robert@linux.intel.com>
*/
#ifndef _COGL_TEXTURE_2D_NOP_PRIVATE_H_
#define _COGL_TEXTURE_2D_NOP_PRIVATE_H_
#include "cogl-types.h"
#include "cogl-context-private.h"
#include "cogl-texture.h"
void
_cogl_texture_2d_nop_free (CoglTexture2D *tex_2d);
CoglBool
_cogl_texture_2d_nop_can_create (CoglContext *ctx,
int width,
int height,
CoglPixelFormat internal_format);
void
_cogl_texture_2d_nop_init (CoglTexture2D *tex_2d);
CoglTexture2D *
_cogl_texture_2d_nop_new_with_size (CoglContext *ctx,
int width,
int height,
CoglPixelFormat internal_format,
CoglError **error);
CoglTexture2D *
_cogl_texture_2d_nop_new_from_bitmap (CoglBitmap *bmp,
CoglPixelFormat internal_format,
CoglError **error);
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
CoglTexture2D *
_cogl_egl_texture_2d_nop_new_from_image (CoglContext *ctx,
int width,
int height,
CoglPixelFormat format,
EGLImageKHR image,
CoglError **error);
#endif
void
_cogl_texture_2d_nop_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter);
void
_cogl_texture_2d_nop_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p);
void
_cogl_texture_2d_nop_copy_from_framebuffer (CoglTexture2D *tex_2d,
CoglFramebuffer *src_fb,
int dst_x,
int dst_y,
int src_x,
int src_y,
int width,
int height);
unsigned int
_cogl_texture_2d_nop_get_gl_handle (CoglTexture2D *tex_2d);
void
_cogl_texture_2d_nop_generate_mipmap (CoglTexture2D *tex_2d);
void
_cogl_texture_2d_nop_copy_from_bitmap (CoglTexture2D *tex_2d,
CoglBitmap *bitmap,
int dst_x,
int dst_y,
int src_x,
int src_y,
int width,
int height);
void
_cogl_texture_2d_nop_get_data (CoglTexture2D *tex_2d,
CoglPixelFormat format,
size_t rowstride,
uint8_t *data);
#endif /* _COGL_TEXTURE_2D_NOP_PRIVATE_H_ */

View File

@ -0,0 +1,156 @@
/*
* Cogl
*
* An object oriented GL/GLES Abstraction/Utility Layer
*
* Copyright (C) 2009,2010,2011,2012 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*
*
* Authors:
* Neil Roberts <neil@linux.intel.com>
* Robert Bragg <robert@linux.intel.com>
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include "cogl-private.h"
#include "cogl-texture-2d-nop-private.h"
#include "cogl-texture-2d-private.h"
#include "cogl-error-private.h"
void
_cogl_texture_2d_nop_free (CoglTexture2D *tex_2d)
{
}
CoglBool
_cogl_texture_2d_nop_can_create (CoglContext *ctx,
int width,
int height,
CoglPixelFormat internal_format)
{
return TRUE;
}
void
_cogl_texture_2d_nop_init (CoglTexture2D *tex_2d)
{
}
CoglTexture2D *
_cogl_texture_2d_nop_new_with_size (CoglContext *ctx,
int width,
int height,
CoglPixelFormat internal_format,
CoglError **error)
{
return _cogl_texture_2d_create_base (ctx,
width, height,
internal_format);
}
CoglTexture2D *
_cogl_texture_2d_nop_new_from_bitmap (CoglBitmap *bmp,
CoglPixelFormat internal_format,
CoglError **error)
{
return _cogl_texture_2d_nop_new_with_size (_cogl_bitmap_get_context (bmp),
cogl_bitmap_get_width (bmp),
cogl_bitmap_get_height (bmp),
internal_format,
error);
}
#if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base)
CoglTexture2D *
_cogl_egl_texture_2d_nop_new_from_image (CoglContext *ctx,
int width,
int height,
CoglPixelFormat format,
EGLImageKHR image,
CoglError **error)
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Creating 2D textures from an EGLImage isn't "
"supported by the NOP backend");
return NULL;
}
#endif
void
_cogl_texture_2d_nop_flush_legacy_texobj_filters (CoglTexture *tex,
GLenum min_filter,
GLenum mag_filter)
{
}
void
_cogl_texture_2d_nop_flush_legacy_texobj_wrap_modes (CoglTexture *tex,
GLenum wrap_mode_s,
GLenum wrap_mode_t,
GLenum wrap_mode_p)
{
}
void
_cogl_texture_2d_nop_copy_from_framebuffer (CoglTexture2D *tex_2d,
CoglFramebuffer *src_fb,
int dst_x,
int dst_y,
int src_x,
int src_y,
int width,
int height)
{
}
unsigned int
_cogl_texture_2d_nop_get_gl_handle (CoglTexture2D *tex_2d)
{
return 0;
}
void
_cogl_texture_2d_nop_generate_mipmap (CoglTexture2D *tex_2d)
{
}
void
_cogl_texture_2d_nop_copy_from_bitmap (CoglTexture2D *tex_2d,
CoglBitmap *bitmap,
int dst_x,
int dst_y,
int src_x,
int src_y,
int width,
int height)
{
}
void
_cogl_texture_2d_nop_get_data (CoglTexture2D *tex_2d,
CoglPixelFormat format,
size_t rowstride,
uint8_t *data)
{
}