tests: stop using cogl-auto-texture apis

The plan is to remove the cogl-auto-texture apis since they hide a bit
too much from developers but currently the conformance tests depend on
these apis in numerous places.

For the conformance tests it makes some sense to continue using high
level texture apis similar to the auto-texture apis since we may want
to make broad variations to how textures are allocated as part of the
testing running if that might help exercise more code paths.

This patch copies much of the auto-texture functionality into some
slightly more special purpose utilities in test-utils.c/h. Minor changes
include being constrained to the public Cogl api and they also don't
let you catch CoglErrors and just assume they should abort on error.

Reviewed-by: Neil Roberts <neil@linux.intel.com>

(cherry picked from commit 911df79776ce6f695351c15e9872b4f1479d30bf)

Conflicts:
	tests/conform/test-atlas-migration.c
	tests/conform/test-backface-culling.c
	tests/conform/test-blend-strings.c
	tests/conform/test-color-mask.c
	tests/conform/test-just-vertex-shader.c
	tests/conform/test-npot-texture.c
	tests/conform/test-primitive.c
	tests/conform/test-snippets.c
	tests/conform/test-texture-get-set-data.c
	tests/conform/test-texture-mipmap-get-set.c
	tests/conform/test-texture-no-allocate.c
	tests/conform/test-wrap-modes.c
This commit is contained in:
Robert Bragg 2013-06-09 01:09:04 +01:00 committed by Neil Roberts
parent 7d2e23bd75
commit 937337993d
19 changed files with 415 additions and 100 deletions

View File

@ -348,3 +348,185 @@ cogl_test_verbose (void)
{
return cogl_test_is_verbose;
}
static void
set_auto_mipmap_cb (CoglTexture *sub_texture,
const float *sub_texture_coords,
const float *meta_coords,
void *user_data)
{
cogl_primitive_texture_set_auto_mipmap (COGL_PRIMITIVE_TEXTURE (sub_texture),
FALSE);
}
CoglTexture *
test_utils_texture_new_with_size (CoglContext *ctx,
int width,
int height,
TestUtilsTextureFlags flags,
CoglPixelFormat internal_format)
{
CoglTexture *tex;
CoglError *skip_error = NULL;
if ((test_utils_is_pot (width) && test_utils_is_pot (height)) ||
(cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
cogl_has_feature (ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
{
/* First try creating a fast-path non-sliced texture */
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx,
width, height,
internal_format));
if (!cogl_texture_allocate (tex, &skip_error))
{
cogl_error_free (skip_error);
cogl_object_unref (tex);
tex = NULL;
}
}
else
tex = NULL;
if (!tex)
{
/* If it fails resort to sliced textures */
int max_waste = flags & TEST_UTILS_TEXTURE_NO_SLICING ?
-1 : COGL_TEXTURE_MAX_WASTE;
CoglTexture2DSliced *tex_2ds =
cogl_texture_2d_sliced_new_with_size (ctx,
width,
height,
max_waste,
internal_format);
tex = COGL_TEXTURE (tex_2ds);
}
if (flags & TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP)
{
/* To be able to iterate the slices of a #CoglTexture2DSliced we
* need to ensure the texture is allocated... */
cogl_texture_allocate (tex, NULL); /* don't catch exceptions */
cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex),
0, 0, 1, 1,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
set_auto_mipmap_cb,
NULL); /* don't catch exceptions */
}
cogl_texture_allocate (tex, NULL);
return tex;
}
CoglTexture *
test_utils_texture_new_from_bitmap (CoglBitmap *bitmap,
TestUtilsTextureFlags flags,
CoglPixelFormat internal_format)
{
CoglAtlasTexture *atlas_tex;
CoglTexture *tex;
CoglError *internal_error = NULL;
if (!flags)
{
/* First try putting the texture in the atlas */
if ((atlas_tex = cogl_atlas_texture_new_from_bitmap (bitmap,
internal_format,
&internal_error)) &&
cogl_texture_allocate (COGL_TEXTURE (atlas_tex), &internal_error))
{
return COGL_TEXTURE (atlas_tex);
}
cogl_error_free (internal_error);
internal_error = NULL;
}
/* If that doesn't work try a fast path 2D texture */
if ((test_utils_is_pot (cogl_bitmap_get_width (bitmap)) &&
test_utils_is_pot (cogl_bitmap_get_height (bitmap))) ||
(cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_BASIC) &&
cogl_has_feature (test_ctx, COGL_FEATURE_ID_TEXTURE_NPOT_MIPMAP)))
{
tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap,
internal_format,
&internal_error));
if (cogl_error_matches (internal_error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY))
{
g_assert_not_reached ();
return NULL;
}
if (!tex)
{
cogl_error_free (internal_error);
internal_error = NULL;
}
}
else
tex = NULL;
if (!tex)
{
/* Otherwise create a sliced texture */
int max_waste = flags & TEST_UTILS_TEXTURE_NO_SLICING ?
-1 : COGL_TEXTURE_MAX_WASTE;
CoglTexture2DSliced *tex_2ds =
cogl_texture_2d_sliced_new_from_bitmap (bitmap,
max_waste,
internal_format,
NULL); /* don't catch
exceptions */
tex = COGL_TEXTURE (tex_2ds);
}
if (flags & TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP)
{
cogl_meta_texture_foreach_in_region (COGL_META_TEXTURE (tex),
0, 0, 1, 1,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE,
set_auto_mipmap_cb,
NULL); /* don't catch exceptions */
}
cogl_texture_allocate (tex, NULL);
return tex;
}
CoglTexture *
test_utils_texture_new_from_data (CoglContext *ctx,
int width,
int height,
TestUtilsTextureFlags flags,
CoglPixelFormat format,
CoglPixelFormat internal_format,
int rowstride,
const uint8_t *data)
{
CoglBitmap *bmp;
CoglTexture *tex;
g_assert_cmpint (format, !=, COGL_PIXEL_FORMAT_ANY);
g_assert (data != NULL);
/* Wrap the data into a bitmap */
bmp = cogl_bitmap_new_for_data (ctx,
width, height,
format,
rowstride,
(uint8_t *) data);
tex = test_utils_texture_new_from_bitmap (bmp, flags, internal_format);
cogl_object_unref (bmp);
return tex;
}

View File

@ -5,6 +5,10 @@
#include <cogl/cogl-onscreen.h>
#include <cogl/cogl-offscreen.h>
#include <cogl/cogl-texture-2d.h>
#include <cogl/cogl-primitive-texture.h>
#include <cogl/cogl-texture-2d-sliced.h>
#include <cogl/cogl-meta-texture.h>
#include <cogl/cogl-atlas-texture.h>
#include <glib.h>
/* We don't really care about functions that are defined without a
@ -29,6 +33,27 @@ typedef enum _TestFlags
TEST_REQUIREMENT_PER_VERTEX_POINT_SIZE = 1<<11
} TestFlags;
/**
* TestUtilsTextureFlags:
* @TEST_UTILS_TEXTURE_NONE: No flags specified
* @TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP: Disables the automatic generation of
* the mipmap pyramid from the base level image whenever it is
* updated. The mipmaps are only generated when the texture is
* rendered with a mipmap filter so it should be free to leave out
* this flag when using other filtering modes
* @TEST_UTILS_TEXTURE_NO_SLICING: Disables the slicing of the texture
* @TEST_UTILS_TEXTURE_NO_ATLAS: Disables the insertion of the texture inside
* the texture atlas used by Cogl
*
* Flags to pass to the test_utils_texture_new_* family of functions.
*/
typedef enum {
TEST_UTILS_TEXTURE_NONE = 0,
TEST_UTILS_TEXTURE_NO_AUTO_MIPMAP = 1 << 0,
TEST_UTILS_TEXTURE_NO_SLICING = 1 << 1,
TEST_UTILS_TEXTURE_NO_ATLAS = 1 << 2
} TestUtilsTextureFlags;
extern CoglContext *test_ctx;
extern CoglFramebuffer *test_fb;
@ -39,6 +64,84 @@ test_utils_init (TestFlags requirement_flags,
void
test_utils_fini (void);
/*
* test_utils_texture_new_with_size:
* @context: A #CoglContext
* @width: width of texture in pixels.
* @height: height of texture in pixels.
* @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE
* @internal_format: the #CoglPixelFormat to use for the GPU storage of the
* texture.
*
* Creates a new #CoglTexture with the specified dimensions and pixel format.
*
* The storage for the texture is not necesarily created before this
* function returns. The storage can be explicitly allocated using
* cogl_texture_allocate() or preferably you can let Cogl
* automatically allocate the storage lazily when uploading data when
* Cogl may know more about how the texture will be used and can
* optimize how it is allocated.
*
* Return value: A newly created #CoglTexture
*/
CoglTexture *
test_utils_texture_new_with_size (CoglContext *ctx,
int width,
int height,
TestUtilsTextureFlags flags,
CoglPixelFormat internal_format);
/*
* test_utils_texture_new_from_data:
* @context: A #CoglContext
* @width: width of texture in pixels
* @height: height of texture in pixels
* @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE
* @format: the #CoglPixelFormat the buffer is stored in in RAM
* @internal_format: the #CoglPixelFormat that will be used for storing
* the buffer on the GPU. If COGL_PIXEL_FORMAT_ANY is given then a
* premultiplied format similar to the format of the source data will
* be used. The default blending equations of Cogl expect premultiplied
* color data; the main use of passing a non-premultiplied format here
* is if you have non-premultiplied source data and are going to adjust
* the blend mode (see cogl_material_set_blend()) or use the data for
* something other than straight blending.
* @rowstride: the memory offset in bytes between the starts of
* scanlines in @data
* @data: pointer the memory region where the source buffer resides
* @error: A #CoglError to catch exceptional errors or %NULL
*
* Creates a new #CoglTexture based on data residing in memory.
*
* Return value: A newly created #CoglTexture or %NULL on failure
*/
CoglTexture *
test_utils_texture_new_from_data (CoglContext *ctx,
int width,
int height,
TestUtilsTextureFlags flags,
CoglPixelFormat format,
CoglPixelFormat internal_format,
int rowstride,
const uint8_t *data);
/*
* test_utils_texture_new_from_bitmap:
* @bitmap: A #CoglBitmap pointer
* @flags: Optional flags for the texture, or %TEST_UTILS_TEXTURE_NONE
* @internal_format: the #CoglPixelFormat to use for the GPU storage of the
* texture
* @error: A #CoglError to catch exceptional errors or %NULL
*
* Creates a #CoglTexture from a #CoglBitmap.
*
* Return value: A newly created #CoglTexture or %NULL on failure
*/
CoglTexture *
test_utils_texture_new_from_bitmap (CoglBitmap *bitmap,
TestUtilsTextureFlags flags,
CoglPixelFormat internal_format);
/*
* test_utils_check_pixel:
* @framebuffer: The #CoglFramebuffer to read from
@ -157,4 +260,16 @@ test_utils_create_color_texture (CoglContext *context,
CoglBool
cogl_test_verbose (void);
/* test_util_is_pot:
* @number: A number to test
*
* Returns whether the given integer is a power of two
*/
static inline CoglBool
test_utils_is_pot (unsigned int number)
{
/* Make sure there is only one bit set */
return (number & (number - 1)) == 0;
}
#endif /* _TEST_UTILS_H_ */

View File

@ -53,9 +53,10 @@ create_texture (int size)
}
}
texture = cogl_texture_new_from_data (size, /* width */
texture = test_utils_texture_new_from_data (test_ctx,
size, /* width */
size, /* height */
COGL_TEXTURE_NONE, /* flags */
TEST_UTILS_TEXTURE_NONE, /* flags */
/* format */
COGL_PIXEL_FORMAT_RGBA_8888,
/* internal format */

View File

@ -266,9 +266,10 @@ make_texture (void)
*(--p) = 255;
}
tex = cogl_texture_new_from_data (TEXTURE_SIZE,
tex = test_utils_texture_new_from_data (test_ctx,
TEXTURE_SIZE,
COGL_TEXTURE_NO_ATLAS,
TEXTURE_SIZE,
TEST_UTILS_TEXTURE_NO_ATLAS,
COGL_PIXEL_FORMAT_RGBA_8888,
COGL_PIXEL_FORMAT_ANY,
TEXTURE_SIZE * 4,
@ -292,9 +293,11 @@ test_backface_culling (void)
state.texture = make_texture ();
tex = cogl_texture_new_with_size (state.width, state.height,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY); /* internal fmt */
tex = test_utils_texture_new_with_size (test_ctx,
state.width, state.height,
TEST_UTILS_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY); /* internal
format */
state.offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (tex));
state.offscreen_tex = tex;

View File

@ -196,9 +196,10 @@ make_texture (uint32_t color)
/* Note: we don't use COGL_PIXEL_FORMAT_ANY for the internal format here
* since we don't want to allow Cogl to premultiply our data. */
tex = cogl_texture_new_from_data (QUAD_WIDTH,
tex = test_utils_texture_new_from_data (test_ctx,
QUAD_WIDTH,
COGL_TEXTURE_NONE,
QUAD_WIDTH,
TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888,
COGL_PIXEL_FORMAT_RGBA_8888,
QUAD_WIDTH * 4,

View File

@ -81,8 +81,8 @@ test_color_mask (void)
for (i = 0; i < NUM_FBOS; i++)
{
state.tex[i] = cogl_texture_new_with_size (128, 128,
COGL_TEXTURE_NO_ATLAS,
state.tex[i] = test_utils_texture_new_with_size (test_ctx, 128, 128,
TEST_UTILS_TEXTURE_NO_ATLAS,
COGL_PIXEL_FORMAT_RGB_888);

View File

@ -18,8 +18,9 @@ create_dummy_texture (void)
vertex shader */
static const uint8_t data[4] = { 0x00, 0xff, 0x00, 0xff };
return cogl_texture_new_from_data (1, 1, /* size */
COGL_TEXTURE_NONE,
return test_utils_texture_new_from_data (test_ctx,
1, 1, /* size */
TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGB_888,
COGL_PIXEL_FORMAT_ANY,
4, /* rowstride */

View File

@ -111,11 +111,11 @@ test_using_all_layers (TestState *state, int x, int y)
will use a red texture. The layers will all be modulated together
so the final fragment should be red. */
white_texture = cogl_texture_new_from_data (1, 1, COGL_TEXTURE_NONE,
white_texture = test_utils_texture_new_from_data (1, 1, TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
4, white_pixel);
red_texture = cogl_texture_new_from_data (1, 1, COGL_TEXTURE_NONE,
red_texture = test_utils_texture_new_from_data (1, 1, TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
4, red_pixel);

View File

@ -85,9 +85,9 @@ make_texture (guchar ref)
/* Note: we don't use COGL_PIXEL_FORMAT_ANY for the internal format here
* since we don't want to allow Cogl to premultiply our data. */
tex = cogl_texture_new_from_data (QUAD_WIDTH * 2,
tex = test_utils_texture_new_from_data (QUAD_WIDTH * 2,
QUAD_WIDTH * 2,
COGL_TEXTURE_NONE,
TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888,
COGL_PIXEL_FORMAT_RGBA_8888,
QUAD_WIDTH * 8,

View File

@ -87,9 +87,10 @@ make_texture (void)
}
}
tex = cogl_texture_new_from_data (TEXTURE_SIZE,
tex = test_utils_texture_new_from_data (test_ctx,
TEXTURE_SIZE,
COGL_TEXTURE_NO_ATLAS,
TEXTURE_SIZE,
TEST_UTILS_TEXTURE_NO_ATLAS,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
TEXTURE_SIZE * 4,

View File

@ -170,8 +170,9 @@ test_paint (TestState *state)
tex_data[3] = (TEX_COLOR >> 24) & 0xff;
tex_data[4] = (TEX_COLOR >> 16) & 0xff;
tex_data[5] = (TEX_COLOR >> 8) & 0xff;
tex = cogl_texture_new_from_data (2, 1, /* size */
COGL_TEXTURE_NO_ATLAS,
tex = test_utils_texture_new_from_data (test_ctx,
2, 1, /* size */
TEST_UTILS_TEXTURE_NO_ATLAS,
COGL_PIXEL_FORMAT_RGB_888,
COGL_PIXEL_FORMAT_ANY,
6, /* rowstride */

View File

@ -44,8 +44,8 @@ on_paint (ClutterActor *actor, void *state)
*/
data = g_malloc (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
tex = cogl_texture_new_from_data (FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
COGL_TEXTURE_NO_SLICING,
tex = test_utils_texture_new_from_data (FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
TEST_UTILS_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888, /* data fmt */
COGL_PIXEL_FORMAT_ANY, /* internal fmt */
FRAMEBUFFER_WIDTH * 4, /* rowstride */

View File

@ -22,8 +22,9 @@ create_texture_pipeline (TestState *state)
0x00, 0x00, 0xff, 0xff, /* blue */ 0xff, 0xff, 0x00, 0xff, /* yellow */
};
tex = cogl_texture_new_from_data (2, 2, /* width/height */
COGL_TEXTURE_NO_ATLAS,
tex = test_utils_texture_new_from_data (test_ctx,
2, 2, /* width/height */
TEST_UTILS_TEXTURE_NO_ATLAS,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
8, /* rowstride */

View File

@ -5,7 +5,7 @@
#include "test-utils.h"
static void
check_texture (int width, int height, CoglTextureFlags flags)
check_texture (int width, int height, TestUtilsTextureFlags flags)
{
CoglTexture *tex;
uint8_t *data, *p;
@ -22,7 +22,8 @@ check_texture (int width, int height, CoglTextureFlags flags)
*(p++) = (x ^ y);
}
tex = cogl_texture_new_from_data (width, height,
tex = test_utils_texture_new_from_data (test_ctx,
width, height,
flags,
COGL_PIXEL_FORMAT_RGBA_8888,
COGL_PIXEL_FORMAT_RGBA_8888,
@ -129,13 +130,13 @@ void
test_texture_get_set_data (void)
{
/* First try without atlasing */
check_texture (256, 256, COGL_TEXTURE_NO_ATLAS);
check_texture (256, 256, TEST_UTILS_TEXTURE_NO_ATLAS);
/* Try again with atlasing. This should end up testing the atlas
backend and the sub texture backend */
check_texture (256, 256, 0);
/* Try with a really big texture in the hope that it will end up
sliced. */
check_texture (4, 5128, COGL_TEXTURE_NO_ATLAS);
check_texture (4, 5128, TEST_UTILS_TEXTURE_NO_ATLAS);
/* And in the other direction. */
check_texture (5128, 4, COGL_TEXTURE_NO_ATLAS);
check_texture (5128, 4, TEST_UTILS_TEXTURE_NO_ATLAS);
}

View File

@ -33,7 +33,7 @@ make_texture (void)
p += 3;
}
tex = cogl_texture_new_from_data (TEX_SIZE, TEX_SIZE, COGL_TEXTURE_NONE,
tex = test_utils_texture_new_from_data (TEX_SIZE, TEX_SIZE, TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGB_888,
COGL_PIXEL_FORMAT_ANY,
TEX_SIZE * 3,

View File

@ -16,6 +16,7 @@ test_texture_no_allocate (void)
uint8_t *tex_data;
CoglTexture *texture;
CoglTexture2D *texture_2d;
GError *error = NULL;
tex_data = g_malloc (BIG_TEX_WIDTH * BIG_TEX_HEIGHT * 4);
@ -25,30 +26,36 @@ test_texture_no_allocate (void)
/* Try to create an atlas texture that is too big so it will
* internally be freed without allocating */
texture = cogl_texture_new_from_data (BIG_TEX_WIDTH,
texture = COGL_TEXTURE (
cogl_atlas_texture_new_from_data (test_ctx,
BIG_TEX_WIDTH,
BIG_TEX_HEIGHT,
COGL_TEXTURE_NONE, /* flags */
/* format */
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
/* internal format */
COGL_PIXEL_FORMAT_ANY,
/* rowstride */
BIG_TEX_WIDTH * 4,
tex_data);
tex_data,
&error));
g_free (tex_data);
/* It's ok if this causes an error, we just don't want it to
* crash */
if (texture)
if (texture == NULL)
cogl_error_free (error);
else
cogl_object_unref (texture);
/* Try to create a sliced texture without allocating it */
texture = cogl_texture_new_with_size (BIG_TEX_WIDTH,
texture = COGL_TEXTURE (
cogl_texture_2d_sliced_new_with_size (test_ctx,
BIG_TEX_WIDTH,
BIG_TEX_HEIGHT,
COGL_TEXTURE_NO_ATLAS,
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
COGL_TEXTURE_MAX_WASTE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE));
cogl_object_unref (texture);
/* 2D texture */

View File

@ -69,7 +69,7 @@ create_source_rect (void)
g_free (data);
tex = cogl_texture_new_from_foreign (gl_tex,
tex = test_utils_texture_new_from_foreign (gl_tex,
GL_TEXTURE_RECTANGLE_ARB,
256, 256, 0, 0,
COGL_PIXEL_FORMAT_RGBA_8888);
@ -99,7 +99,7 @@ create_source_2d (void)
*(p++) = 255;
}
tex = cogl_texture_new_from_data (256, 256, COGL_TEXTURE_NONE,
tex = test_utils_texture_new_from_data (256, 256, TEST_UTILS_TEXTURE_NONE,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
256 * 4,

View File

@ -210,8 +210,8 @@ on_paint (ClutterActor *actor, void *state)
* Next test offscreen drawing...
*/
data = g_malloc (FRAMEBUFFER_WIDTH * 4 * FRAMEBUFFER_HEIGHT);
tex = cogl_texture_new_from_data (FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
COGL_TEXTURE_NO_SLICING,
tex = test_utils_texture_new_from_data (FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT,
TEST_UTILS_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888, /* data fmt */
COGL_PIXEL_FORMAT_ANY, /* internal fmt */
FRAMEBUFFER_WIDTH * 4, /* rowstride */

View File

@ -15,7 +15,7 @@ typedef struct _TestState
} TestState;
static CoglTexture *
create_texture (CoglTextureFlags flags)
create_texture (TestUtilsTextureFlags flags)
{
uint8_t *data = g_malloc (TEX_SIZE * TEX_SIZE * 4), *p = data;
CoglTexture *tex;
@ -30,7 +30,8 @@ create_texture (CoglTextureFlags flags)
*(p++) = 255;
}
tex = cogl_texture_new_from_data (TEX_SIZE, TEX_SIZE, flags,
tex = test_utils_texture_new_from_data (test_ctx,
TEX_SIZE, TEX_SIZE, flags,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
COGL_PIXEL_FORMAT_ANY,
TEX_SIZE * 4,
@ -238,15 +239,15 @@ static void
paint (TestState *state)
{
/* Draw the tests first with a non atlased texture */
state->texture = create_texture (COGL_TEXTURE_NO_ATLAS);
state->texture = create_texture (TEST_UTILS_TEXTURE_NO_ATLAS);
draw_tests (state);
cogl_object_unref (state->texture);
/* Draw the tests again with a possible atlased texture. This should
end up testing software repeats */
state->texture = create_texture (COGL_TEXTURE_NONE);
cogl_push_matrix ();
cogl_translate (0.0f, TEX_SIZE * 2.0f, 0.0f);
state->texture = create_texture (TEST_UTILS_TEXTURE_NONE);
cogl_framebuffer_push_matrix (test_fb);
cogl_framebuffer_translate (test_fb, 0.0f, TEX_SIZE * 2.0f, 0.0f);
draw_tests (state);
cogl_pop_matrix ();
cogl_object_unref (state->texture);