glamor: Stop trying to store the pixmap's "format" in glamor_pixmap_fbo.
"format" is a bit of a confused term (internalformat vs GL format), and all we really needed was "is this GL_RED?" Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
1b2e224d7d
commit
34485be256
|
@ -169,8 +169,7 @@ glamor_bind_texture(glamor_screen_private *glamor_priv, GLenum texture,
|
||||||
/* Is the operand a GL_RED fbo?
|
/* Is the operand a GL_RED fbo?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (glamor_fbo_red_is_alpha(glamor_priv, fbo)) {
|
if (fbo->is_red) {
|
||||||
|
|
||||||
/* If destination is also GL_RED, then preserve the bits in
|
/* If destination is also GL_RED, then preserve the bits in
|
||||||
* the R channel */
|
* the R channel */
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ glamor_pixmap_ensure_fb(glamor_screen_private *glamor_priv,
|
||||||
|
|
||||||
glamor_pixmap_fbo *
|
glamor_pixmap_fbo *
|
||||||
glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
|
glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
|
||||||
int w, int h, GLenum format, GLint tex, int flag)
|
int w, int h, Bool is_red, GLint tex, int flag)
|
||||||
{
|
{
|
||||||
glamor_pixmap_fbo *fbo;
|
glamor_pixmap_fbo *fbo;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ glamor_create_fbo_from_tex(glamor_screen_private *glamor_priv,
|
||||||
fbo->tex = tex;
|
fbo->tex = tex;
|
||||||
fbo->width = w;
|
fbo->width = w;
|
||||||
fbo->height = h;
|
fbo->height = h;
|
||||||
fbo->format = format;
|
fbo->is_red = is_red;
|
||||||
|
|
||||||
if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
|
if (flag != GLAMOR_CREATE_FBO_NO_FBO) {
|
||||||
if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
|
if (glamor_pixmap_ensure_fb(glamor_priv, fbo) != 0) {
|
||||||
|
@ -163,7 +163,8 @@ glamor_create_fbo(glamor_screen_private *glamor_priv,
|
||||||
if (!tex) /* Texture creation failed due to GL_OUT_OF_MEMORY */
|
if (!tex) /* Texture creation failed due to GL_OUT_OF_MEMORY */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return glamor_create_fbo_from_tex(glamor_priv, w, h, format, tex, flag);
|
return glamor_create_fbo_from_tex(glamor_priv, w, h, format == GL_RED,
|
||||||
|
tex, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -311,8 +311,7 @@ typedef struct glamor_pixmap_fbo {
|
||||||
GLuint fb; /**< GL FBO name */
|
GLuint fb; /**< GL FBO name */
|
||||||
int width; /**< width in pixels */
|
int width; /**< width in pixels */
|
||||||
int height; /**< height in pixels */
|
int height; /**< height in pixels */
|
||||||
GLenum format; /**< GL format used to create the texture. */
|
Bool is_red;
|
||||||
GLenum type; /**< GL type used to create the texture. */
|
|
||||||
} glamor_pixmap_fbo;
|
} glamor_pixmap_fbo;
|
||||||
|
|
||||||
typedef struct glamor_pixmap_clipped_regions {
|
typedef struct glamor_pixmap_clipped_regions {
|
||||||
|
@ -527,7 +526,7 @@ glamor_pixmap_fbo *glamor_pixmap_detach_fbo(glamor_pixmap_private *
|
||||||
void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo);
|
void glamor_pixmap_attach_fbo(PixmapPtr pixmap, glamor_pixmap_fbo *fbo);
|
||||||
glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
|
glamor_pixmap_fbo *glamor_create_fbo_from_tex(glamor_screen_private *
|
||||||
glamor_priv, int w, int h,
|
glamor_priv, int w, int h,
|
||||||
GLenum format, GLint tex,
|
Bool is_red, GLint tex,
|
||||||
int flag);
|
int flag);
|
||||||
glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
|
glamor_pixmap_fbo *glamor_create_fbo(glamor_screen_private *glamor_priv, int w,
|
||||||
int h, GLenum format, int flag);
|
int h, GLenum format, int flag);
|
||||||
|
@ -542,14 +541,6 @@ static inline Bool glamor_picture_is_alpha(PicturePtr picture)
|
||||||
return picture->format == PICT_a1 || picture->format == PICT_a8;
|
return picture->format == PICT_a1 || picture->format == PICT_a8;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return whether 'fbo' is storing alpha bits in the red channel */
|
|
||||||
static inline Bool
|
|
||||||
glamor_fbo_red_is_alpha(glamor_screen_private *glamor_priv, glamor_pixmap_fbo *fbo)
|
|
||||||
{
|
|
||||||
/* True when the format is GL_RED (that can only happen when our one channel format is GL_RED */
|
|
||||||
return fbo->format == GL_RED;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return whether 'picture' is storing alpha bits in the red channel */
|
/* Return whether 'picture' is storing alpha bits in the red channel */
|
||||||
static inline Bool
|
static inline Bool
|
||||||
glamor_picture_red_is_alpha(PicturePtr picture)
|
glamor_picture_red_is_alpha(PicturePtr picture)
|
||||||
|
|
|
@ -529,7 +529,7 @@ glamor_set_composite_texture(glamor_screen_private *glamor_priv, int unit,
|
||||||
* sometimes get zero bits in the R channel, which is harmless.
|
* sometimes get zero bits in the R channel, which is harmless.
|
||||||
*/
|
*/
|
||||||
glamor_bind_texture(glamor_priv, GL_TEXTURE0 + unit, fbo,
|
glamor_bind_texture(glamor_priv, GL_TEXTURE0 + unit, fbo,
|
||||||
glamor_fbo_red_is_alpha(glamor_priv, dest_priv->fbo));
|
dest_priv->fbo->is_red);
|
||||||
repeat_type = picture->repeatType;
|
repeat_type = picture->repeatType;
|
||||||
switch (picture->repeatType) {
|
switch (picture->repeatType) {
|
||||||
case RepeatNone:
|
case RepeatNone:
|
||||||
|
|
|
@ -40,7 +40,7 @@ glamor_format_for_pixmap(PixmapPtr pixmap, GLenum *format, GLenum *type)
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
if (priv->is_cbcr) {
|
if (priv->is_cbcr) {
|
||||||
*format = priv->fbo->format;
|
*format = GL_RG;
|
||||||
*type = GL_UNSIGNED_BYTE;
|
*type = GL_UNSIGNED_BYTE;
|
||||||
} else {
|
} else {
|
||||||
*format = GL_RGB;
|
*format = GL_RGB;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user