mirror of
https://github.com/brl/mutter.git
synced 2025-08-04 15:45:54 +00:00
cogl: Add an internal CoglTextureRectangle backend
This adds an internal rectangle texture backend which is mostly based on the CoglTexture2D backend. It will throw assert failures if any operations are attempted that rectangle textures don't support, such as mipmapping or hardware repeating.
This commit is contained in:
@@ -312,6 +312,13 @@ COGL_FEATURE_FUNCTION (void, glDeleteBuffers,
|
||||
const GLuint *buffers))
|
||||
COGL_FEATURE_END ()
|
||||
|
||||
COGL_FEATURE_BEGIN (texture_rectangle, 255, 255,
|
||||
"ARB\0",
|
||||
"texture_rectangle\0",
|
||||
COGL_FEATURE_TEXTURE_RECTANGLE,
|
||||
0)
|
||||
COGL_FEATURE_END ()
|
||||
|
||||
/* Cogl requires OpenGL 1.2 so we assume these functions are always
|
||||
available and don't bother setting any feature flags. We still have
|
||||
to fetch the function pointers though because under Windows you can
|
||||
|
@@ -70,6 +70,11 @@ _cogl_texture_driver_gen (GLenum gl_target,
|
||||
GE( glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) );
|
||||
break;
|
||||
|
||||
case GL_TEXTURE_RECTANGLE_ARB:
|
||||
/* Texture rectangles already default to GL_LINEAR so nothing
|
||||
needs to be done */
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
}
|
||||
@@ -201,26 +206,28 @@ _cogl_texture_driver_size_supported (GLenum gl_target,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
if (gl_target == GL_TEXTURE_2D)
|
||||
{
|
||||
/* Proxy texture allows for a quick check for supported size */
|
||||
GLenum proxy_target;
|
||||
GLint new_width = 0;
|
||||
|
||||
GLint new_width = 0;
|
||||
|
||||
GE( glTexImage2D (GL_PROXY_TEXTURE_2D, 0, GL_RGBA,
|
||||
width, height, 0 /* border */,
|
||||
gl_format, gl_type, NULL) );
|
||||
|
||||
GE( glGetTexLevelParameteriv (GL_PROXY_TEXTURE_2D, 0,
|
||||
GL_TEXTURE_WIDTH, &new_width) );
|
||||
|
||||
return new_width != 0;
|
||||
}
|
||||
if (gl_target == GL_TEXTURE_2D)
|
||||
proxy_target = GL_PROXY_TEXTURE_2D;
|
||||
#if HAVE_COGL_GL
|
||||
else if (gl_target == GL_TEXTURE_RECTANGLE_ARB)
|
||||
proxy_target = GL_PROXY_TEXTURE_RECTANGLE_ARB;
|
||||
#endif
|
||||
else
|
||||
{
|
||||
/* not used */
|
||||
return 0;
|
||||
}
|
||||
/* Unknown target, assume it's not supported */
|
||||
return FALSE;
|
||||
|
||||
/* Proxy texture allows for a quick check for supported size */
|
||||
GE( glTexImage2D (proxy_target, 0, GL_RGBA,
|
||||
width, height, 0 /* border */,
|
||||
gl_format, gl_type, NULL) );
|
||||
|
||||
GE( glGetTexLevelParameteriv (proxy_target, 0,
|
||||
GL_TEXTURE_WIDTH, &new_width) );
|
||||
|
||||
return new_width != 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
Reference in New Issue
Block a user