mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
cogl: Add pixel_format_to_gl_with_target driver vfunc
This is used by the GL driver in order to determine whether swizzling actually applies given the bitmap and target texture internal format. If both agree that they store BGRA, then swizzling may apply. https://bugzilla.gnome.org/show_bug.cgi?id=779234
This commit is contained in:
parent
f7ffb1790f
commit
aa5738c777
@ -55,6 +55,13 @@ struct _CoglDriverVtable
|
|||||||
GLenum *out_glintformat,
|
GLenum *out_glintformat,
|
||||||
GLenum *out_glformat,
|
GLenum *out_glformat,
|
||||||
GLenum *out_gltype);
|
GLenum *out_gltype);
|
||||||
|
CoglPixelFormat
|
||||||
|
(* pixel_format_to_gl_with_target) (CoglContext *context,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
CoglPixelFormat target_format,
|
||||||
|
GLenum *out_glintformat,
|
||||||
|
GLenum *out_glformat,
|
||||||
|
GLenum *out_gltype);
|
||||||
|
|
||||||
CoglBool
|
CoglBool
|
||||||
(* update_features) (CoglContext *context,
|
(* update_features) (CoglContext *context,
|
||||||
|
@ -96,11 +96,12 @@ _cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglPixelFormat
|
static CoglPixelFormat
|
||||||
_cogl_driver_pixel_format_to_gl (CoglContext *context,
|
_cogl_driver_pixel_format_to_gl_with_target (CoglContext *context,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GLenum *out_glintformat,
|
CoglPixelFormat target_format,
|
||||||
GLenum *out_glformat,
|
GLenum *out_glintformat,
|
||||||
GLenum *out_gltype)
|
GLenum *out_glformat,
|
||||||
|
GLenum *out_gltype)
|
||||||
{
|
{
|
||||||
CoglPixelFormat required_format;
|
CoglPixelFormat required_format;
|
||||||
GLenum glintformat = 0;
|
GLenum glintformat = 0;
|
||||||
@ -178,7 +179,8 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
|
|||||||
* and buffer format are the same here, the pixels
|
* and buffer format are the same here, the pixels
|
||||||
* will be flipped through this extension.
|
* will be flipped through this extension.
|
||||||
*/
|
*/
|
||||||
if (_cogl_has_private_feature
|
if (target_format == format &&
|
||||||
|
_cogl_has_private_feature
|
||||||
(context, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE))
|
(context, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE))
|
||||||
glformat = GL_RGBA;
|
glformat = GL_RGBA;
|
||||||
else
|
else
|
||||||
@ -297,6 +299,20 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
|
|||||||
return required_format;
|
return required_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CoglPixelFormat
|
||||||
|
_cogl_driver_pixel_format_to_gl (CoglContext *context,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
GLenum *out_glintformat,
|
||||||
|
GLenum *out_glformat,
|
||||||
|
GLenum *out_gltype)
|
||||||
|
{
|
||||||
|
return _cogl_driver_pixel_format_to_gl_with_target (context,
|
||||||
|
format, format,
|
||||||
|
out_glintformat,
|
||||||
|
out_glformat,
|
||||||
|
out_gltype);
|
||||||
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_get_gl_version (CoglContext *ctx,
|
_cogl_get_gl_version (CoglContext *ctx,
|
||||||
int *major_out,
|
int *major_out,
|
||||||
@ -677,6 +693,7 @@ _cogl_driver_gl =
|
|||||||
{
|
{
|
||||||
_cogl_driver_pixel_format_from_gl_internal,
|
_cogl_driver_pixel_format_from_gl_internal,
|
||||||
_cogl_driver_pixel_format_to_gl,
|
_cogl_driver_pixel_format_to_gl,
|
||||||
|
_cogl_driver_pixel_format_to_gl_with_target,
|
||||||
_cogl_driver_update_features,
|
_cogl_driver_update_features,
|
||||||
_cogl_offscreen_gl_allocate,
|
_cogl_offscreen_gl_allocate,
|
||||||
_cogl_offscreen_gl_free,
|
_cogl_offscreen_gl_free,
|
||||||
|
@ -67,11 +67,12 @@ _cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CoglPixelFormat
|
static CoglPixelFormat
|
||||||
_cogl_driver_pixel_format_to_gl (CoglContext *context,
|
_cogl_driver_pixel_format_to_gl_with_target (CoglContext *context,
|
||||||
CoglPixelFormat format,
|
CoglPixelFormat format,
|
||||||
GLenum *out_glintformat,
|
CoglPixelFormat target_format,
|
||||||
GLenum *out_glformat,
|
GLenum *out_glintformat,
|
||||||
GLenum *out_gltype)
|
GLenum *out_glformat,
|
||||||
|
GLenum *out_gltype)
|
||||||
{
|
{
|
||||||
CoglPixelFormat required_format;
|
CoglPixelFormat required_format;
|
||||||
GLenum glintformat;
|
GLenum glintformat;
|
||||||
@ -219,6 +220,20 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
|
|||||||
return required_format;
|
return required_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CoglPixelFormat
|
||||||
|
_cogl_driver_pixel_format_to_gl (CoglContext *context,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
GLenum *out_glintformat,
|
||||||
|
GLenum *out_glformat,
|
||||||
|
GLenum *out_gltype)
|
||||||
|
{
|
||||||
|
return _cogl_driver_pixel_format_to_gl_with_target (context,
|
||||||
|
format, format,
|
||||||
|
out_glintformat,
|
||||||
|
out_glformat,
|
||||||
|
out_gltype);
|
||||||
|
}
|
||||||
|
|
||||||
static CoglBool
|
static CoglBool
|
||||||
_cogl_get_gl_version (CoglContext *ctx,
|
_cogl_get_gl_version (CoglContext *ctx,
|
||||||
int *major_out,
|
int *major_out,
|
||||||
@ -457,6 +472,7 @@ _cogl_driver_gles =
|
|||||||
{
|
{
|
||||||
_cogl_driver_pixel_format_from_gl_internal,
|
_cogl_driver_pixel_format_from_gl_internal,
|
||||||
_cogl_driver_pixel_format_to_gl,
|
_cogl_driver_pixel_format_to_gl,
|
||||||
|
_cogl_driver_pixel_format_to_gl_with_target,
|
||||||
_cogl_driver_update_features,
|
_cogl_driver_update_features,
|
||||||
_cogl_offscreen_gl_allocate,
|
_cogl_offscreen_gl_allocate,
|
||||||
_cogl_offscreen_gl_free,
|
_cogl_offscreen_gl_free,
|
||||||
|
@ -61,6 +61,7 @@ _cogl_driver_nop =
|
|||||||
{
|
{
|
||||||
NULL, /* pixel_format_from_gl_internal */
|
NULL, /* pixel_format_from_gl_internal */
|
||||||
NULL, /* pixel_format_to_gl */
|
NULL, /* pixel_format_to_gl */
|
||||||
|
NULL, /* pixel_format_to_gl_with_target */
|
||||||
_cogl_driver_update_features,
|
_cogl_driver_update_features,
|
||||||
_cogl_offscreen_nop_allocate,
|
_cogl_offscreen_nop_allocate,
|
||||||
_cogl_offscreen_nop_free,
|
_cogl_offscreen_nop_free,
|
||||||
|
Loading…
Reference in New Issue
Block a user