radeon/r200/r300/r600: add is_format_renderable function

This commit is contained in:
Maciej Cencora
2010-03-07 14:34:21 +01:00
parent bd2239e497
commit a17563c7dd
9 changed files with 70 additions and 0 deletions
+1
View File
@@ -266,6 +266,7 @@ static void r200_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.emit_query_finish = r200_emit_query_finish;
radeon->vtbl.check_blit = r200_check_blit;
radeon->vtbl.blit = r200_blit;
radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
+6
View File
@@ -321,6 +321,12 @@ static void r300_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.check_blit = r300_check_blit;
radeon->vtbl.blit = r300_blit;
if (radeon->radeonScreen->chip_family >= CHIP_FAMILY_RV515) {
radeon->vtbl.is_format_renderable = r500IsFormatRenderable;
} else {
radeon->vtbl.is_format_renderable = r300IsFormatRenderable;
}
}
static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
+39
View File
@@ -308,6 +308,45 @@ static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx,
return &t->base;
}
unsigned r300IsFormatRenderable(gl_format mesa_format)
{
switch (mesa_format)
{
case MESA_FORMAT_RGB565:
case MESA_FORMAT_RGBA5551:
case MESA_FORMAT_RGBA8888:
case MESA_FORMAT_RGB565_REV:
case MESA_FORMAT_RGBA8888_REV:
case MESA_FORMAT_ARGB4444:
case MESA_FORMAT_ARGB1555:
case MESA_FORMAT_XRGB8888:
case MESA_FORMAT_ARGB8888:
case MESA_FORMAT_ARGB4444_REV:
case MESA_FORMAT_ARGB1555_REV:
case MESA_FORMAT_XRGB8888_REV:
case MESA_FORMAT_ARGB8888_REV:
case MESA_FORMAT_SRGBA8:
case MESA_FORMAT_SARGB8:
case MESA_FORMAT_SL8:
case MESA_FORMAT_A8:
case MESA_FORMAT_L8:
case MESA_FORMAT_I8:
case MESA_FORMAT_Z16:
return 1;
default:
return 0;
}
}
unsigned r500IsFormatRenderable(gl_format mesa_format)
{
if (mesa_format == MESA_FORMAT_S8_Z24) {
return 1;
} else {
return r300IsFormatRenderable(mesa_format);
}
}
void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_table *functions)
{
/* Note: we only plug in the functions we implement in the driver
+3
View File
@@ -53,4 +53,7 @@ extern void r300InitTextureFuncs(radeonContextPtr radeon, struct dd_function_tab
int32_t r300TranslateTexFormat(gl_format mesaFormat);
unsigned r300IsFormatRenderable(gl_format mesaFormat);
unsigned r500IsFormatRenderable(gl_format mesaFormat);
#endif /* __r300_TEX_H__ */
+1
View File
@@ -239,6 +239,7 @@ static void r600_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.emit_query_finish = r600_emit_query_finish;
radeon->vtbl.check_blit = r600_check_blit;
radeon->vtbl.blit = r600_blit;
radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
@@ -539,6 +539,7 @@ struct radeon_context {
unsigned reg_width,
unsigned reg_height,
unsigned flip_y);
unsigned (*is_format_renderable)(gl_format mesa_format);
} vtbl;
};
@@ -200,6 +200,7 @@ static void r100_init_vtbl(radeonContextPtr radeon)
radeon->vtbl.emit_query_finish = r100_emit_query_finish;
radeon->vtbl.check_blit = r100_check_blit;
radeon->vtbl.blit = r100_blit;
radeon->vtbl.is_format_renderable = radeonIsFormatRenderable;
}
/* Create the device specific context.
@@ -1006,3 +1006,19 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level,
radeon_texsubimage(ctx, 3, target, level, xoffset, yoffset, zoffset, width, height, depth, 0,
format, type, pixels, packing, texObj, texImage, 0);
}
unsigned radeonIsFormatRenderable(gl_format mesa_format)
{
if (mesa_format == _dri_texformat_argb8888 || mesa_format == _dri_texformat_rgb565 ||
mesa_format == _dri_texformat_argb1555 || mesa_format == _dri_texformat_argb4444)
return 1;
switch (mesa_format)
{
case MESA_FORMAT_Z16:
case MESA_FORMAT_S8_Z24:
return 1;
default:
return 0;
}
}
@@ -135,4 +135,6 @@ void radeonCopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level,
GLint x, GLint y,
GLsizei width, GLsizei height);
unsigned radeonIsFormatRenderable(gl_format mesa_format);
#endif