From 871683abd3699716e04f54b8f4e0693599b19907 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Tue, 18 May 2010 15:52:05 +0100 Subject: [PATCH] test-cogl-materials: Fix compilation under GLES 2 GLES 2 doesn't have GL_MAX_TEXTURE_UNITS. Instead the cogl backend uses GL_MAX_TEXTURE_IMAGE_UNITS with a maximum limit of 16. The same restriction is now used in the test. --- tests/conform/test-cogl-materials.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/conform/test-cogl-materials.c b/tests/conform/test-cogl-materials.c index aa9b75d85..04b78bd7f 100644 --- a/tests/conform/test-cogl-materials.c +++ b/tests/conform/test-cogl-materials.c @@ -1,3 +1,4 @@ +#include "config.h" #include #include @@ -156,11 +157,20 @@ test_using_all_layers (TestState *state, int x, int y) /* FIXME: Cogl doesn't provide a way to query the maximum number of texture layers so for now we'll just ask GL directly. */ +#ifdef HAVE_COGL_GLES2 + /* GLES 2 doesn't have GL_MAX_TEXTURE_UNITS and it uses + GL_MAX_TEXTURE_IMAGE_UNITS instead */ + glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n_layers); + /* Cogl can't support more than 16 layers under GLES 2 */ + if (n_layers > 16) + n_layers = 16; +#else glGetIntegerv (GL_MAX_TEXTURE_UNITS, &n_layers); /* Cogl currently can't cope with more than 32 layers so we'll also limit the maximum to that. */ if (n_layers > 32) n_layers = 32; +#endif for (i = 0; i < n_layers; i++) {