[mutter] cogl: Add pixel_format_to_gl_with_target driver vfunc
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Add pixel_format_to_gl_with_target driver vfunc
- Date: Tue, 7 Mar 2017 12:40:36 +0000 (UTC)
commit aa5738c777883f270ae9cb3b2988d194792fed75
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Mar 3 17:11:19 2017 +0100
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
cogl/cogl/cogl-driver.h | 7 ++++++
cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 29 +++++++++++++++++++++-----
cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 26 +++++++++++++++++++----
cogl/cogl/driver/nop/cogl-driver-nop.c | 1 +
4 files changed, 52 insertions(+), 11 deletions(-)
---
diff --git a/cogl/cogl/cogl-driver.h b/cogl/cogl/cogl-driver.h
index 648228c..85aa0d8 100644
--- a/cogl/cogl/cogl-driver.h
+++ b/cogl/cogl/cogl-driver.h
@@ -55,6 +55,13 @@ struct _CoglDriverVtable
GLenum *out_glintformat,
GLenum *out_glformat,
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
(* update_features) (CoglContext *context,
diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
index 1cc63e8..178262a 100644
--- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -96,11 +96,12 @@ _cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
}
static CoglPixelFormat
-_cogl_driver_pixel_format_to_gl (CoglContext *context,
- CoglPixelFormat format,
- GLenum *out_glintformat,
- GLenum *out_glformat,
- GLenum *out_gltype)
+_cogl_driver_pixel_format_to_gl_with_target (CoglContext *context,
+ CoglPixelFormat format,
+ CoglPixelFormat target_format,
+ GLenum *out_glintformat,
+ GLenum *out_glformat,
+ GLenum *out_gltype)
{
CoglPixelFormat required_format;
GLenum glintformat = 0;
@@ -178,7 +179,8 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
* and buffer format are the same here, the pixels
* 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))
glformat = GL_RGBA;
else
@@ -297,6 +299,20 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
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
_cogl_get_gl_version (CoglContext *ctx,
int *major_out,
@@ -677,6 +693,7 @@ _cogl_driver_gl =
{
_cogl_driver_pixel_format_from_gl_internal,
_cogl_driver_pixel_format_to_gl,
+ _cogl_driver_pixel_format_to_gl_with_target,
_cogl_driver_update_features,
_cogl_offscreen_gl_allocate,
_cogl_offscreen_gl_free,
diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
index bf63fcc..521f6ef 100644
--- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
+++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c
@@ -67,11 +67,12 @@ _cogl_driver_pixel_format_from_gl_internal (CoglContext *context,
}
static CoglPixelFormat
-_cogl_driver_pixel_format_to_gl (CoglContext *context,
- CoglPixelFormat format,
- GLenum *out_glintformat,
- GLenum *out_glformat,
- GLenum *out_gltype)
+_cogl_driver_pixel_format_to_gl_with_target (CoglContext *context,
+ CoglPixelFormat format,
+ CoglPixelFormat target_format,
+ GLenum *out_glintformat,
+ GLenum *out_glformat,
+ GLenum *out_gltype)
{
CoglPixelFormat required_format;
GLenum glintformat;
@@ -219,6 +220,20 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
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
_cogl_get_gl_version (CoglContext *ctx,
int *major_out,
@@ -457,6 +472,7 @@ _cogl_driver_gles =
{
_cogl_driver_pixel_format_from_gl_internal,
_cogl_driver_pixel_format_to_gl,
+ _cogl_driver_pixel_format_to_gl_with_target,
_cogl_driver_update_features,
_cogl_offscreen_gl_allocate,
_cogl_offscreen_gl_free,
diff --git a/cogl/cogl/driver/nop/cogl-driver-nop.c b/cogl/cogl/driver/nop/cogl-driver-nop.c
index d9b1d0f..6e04e71 100644
--- a/cogl/cogl/driver/nop/cogl-driver-nop.c
+++ b/cogl/cogl/driver/nop/cogl-driver-nop.c
@@ -61,6 +61,7 @@ _cogl_driver_nop =
{
NULL, /* pixel_format_from_gl_internal */
NULL, /* pixel_format_to_gl */
+ NULL, /* pixel_format_to_gl_with_target */
_cogl_driver_update_features,
_cogl_offscreen_nop_allocate,
_cogl_offscreen_nop_free,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]