mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
drivers: use more mesa format functions
This commit is contained in:
parent
9fbb8884f0
commit
ddffe4546a
6 changed files with 32 additions and 22 deletions
|
|
@ -466,6 +466,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
|
|||
struct gl_texture_image *texImage)
|
||||
{
|
||||
irb->texformat = texImage->TexFormat;
|
||||
gl_format texFormat;
|
||||
|
||||
if (texImage->TexFormat == &_mesa_texformat_argb8888) {
|
||||
irb->Base._ActualFormat = GL_RGBA8;
|
||||
|
|
@ -509,15 +510,17 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb,
|
|||
return GL_FALSE;
|
||||
}
|
||||
|
||||
texFormat = texImage->TexFormat->MesaFormat;
|
||||
|
||||
irb->Base.InternalFormat = irb->Base._ActualFormat;
|
||||
irb->Base.Width = texImage->Width;
|
||||
irb->Base.Height = texImage->Height;
|
||||
irb->Base.RedBits = texImage->TexFormat->RedBits;
|
||||
irb->Base.GreenBits = texImage->TexFormat->GreenBits;
|
||||
irb->Base.BlueBits = texImage->TexFormat->BlueBits;
|
||||
irb->Base.AlphaBits = texImage->TexFormat->AlphaBits;
|
||||
irb->Base.DepthBits = texImage->TexFormat->DepthBits;
|
||||
irb->Base.StencilBits = texImage->TexFormat->StencilBits;
|
||||
irb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE);
|
||||
irb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE);
|
||||
irb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE);
|
||||
irb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE);
|
||||
irb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB);
|
||||
irb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT);
|
||||
|
||||
irb->Base.Delete = intel_delete_renderbuffer;
|
||||
irb->Base.AllocStorage = intel_nop_alloc_storage;
|
||||
|
|
|
|||
|
|
@ -404,19 +404,18 @@ intelTexImage(GLcontext * ctx,
|
|||
} else if (intelImage->base.Border == 0) {
|
||||
int comp_byte = 0;
|
||||
GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat);
|
||||
|
||||
GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat->MesaFormat);
|
||||
if (intelImage->base.IsCompressed) {
|
||||
comp_byte =
|
||||
intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat);
|
||||
}
|
||||
|
||||
|
||||
/* Didn't fit in the object miptree, but it's suitable for inclusion in
|
||||
* a miptree, so create one just for our level and store it in the image.
|
||||
* It'll get moved into the object miptree at validate time.
|
||||
*/
|
||||
intelImage->mt = intel_miptree_create(intel, target,
|
||||
intelImage->base.TexFormat->BaseFormat,
|
||||
baseFormat,
|
||||
internalFormat,
|
||||
level, level,
|
||||
width, height, depth,
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
|
|||
GLenum pname, const GLfloat * params)
|
||||
{
|
||||
radeonTexObj* t = radeon_tex_obj(texObj);
|
||||
GLenum texBaseFormat;
|
||||
|
||||
if (RADEON_DEBUG & (RADEON_STATE | RADEON_TEXTURE)) {
|
||||
fprintf(stderr, "%s( %s )\n", __FUNCTION__,
|
||||
|
|
@ -238,8 +239,10 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
|
|||
case GL_DEPTH_TEXTURE_MODE:
|
||||
if (!texObj->Image[0][texObj->BaseLevel])
|
||||
return;
|
||||
if (texObj->Image[0][texObj->BaseLevel]->TexFormat->BaseFormat
|
||||
== GL_DEPTH_COMPONENT) {
|
||||
texBaseFormat = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
|
||||
|
||||
if (texBaseFormat == GL_DEPTH_COMPONENT ||
|
||||
texBaseFormat == GL_DEPTH_STENCIL) {
|
||||
r300SetDepthTexMode(texObj);
|
||||
break;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t)
|
|||
|
||||
if (!t->image_override
|
||||
&& VALID_FORMAT(firstImage->TexFormat->MesaFormat)) {
|
||||
if (firstImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) {
|
||||
if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) {
|
||||
r300SetDepthTexMode(&t->base);
|
||||
} else {
|
||||
t->pp_txformat = tx_table[firstImage->TexFormat->MesaFormat].format;
|
||||
|
|
|
|||
|
|
@ -286,6 +286,7 @@ static void r600TexParameter(GLcontext * ctx, GLenum target,
|
|||
GLenum pname, const GLfloat * params)
|
||||
{
|
||||
radeonTexObj* t = radeon_tex_obj(texObj);
|
||||
GLenum baseFormat;
|
||||
|
||||
radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_VERBOSE,
|
||||
"%s( %s )\n", __FUNCTION__,
|
||||
|
|
@ -327,8 +328,9 @@ static void r600TexParameter(GLcontext * ctx, GLenum target,
|
|||
case GL_DEPTH_TEXTURE_MODE:
|
||||
if (!texObj->Image[0][texObj->BaseLevel])
|
||||
return;
|
||||
if (texObj->Image[0][texObj->BaseLevel]->TexFormat->BaseFormat
|
||||
== GL_DEPTH_COMPONENT) {
|
||||
baseFormat = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
|
||||
if (baseFormat == GL_DEPTH_COMPONENT ||
|
||||
baseFormat == GL_DEPTH_STENCIL) {
|
||||
r600SetDepthTexMode(texObj);
|
||||
break;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -387,6 +387,8 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb,
|
|||
struct gl_texture_image *texImage)
|
||||
{
|
||||
int retry = 0;
|
||||
gl_format texFormat;
|
||||
|
||||
restart:
|
||||
if (texImage->TexFormat == &_mesa_texformat_argb8888) {
|
||||
rrb->cpp = 4;
|
||||
|
|
@ -438,24 +440,25 @@ restart:
|
|||
return GL_FALSE;
|
||||
}
|
||||
texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0,
|
||||
texImage->TexFormat->DataType,
|
||||
_mesa_get_format_datatype(texImage->TexFormat->MesaFormat),
|
||||
1);
|
||||
|
||||
retry++;
|
||||
goto restart;
|
||||
}
|
||||
|
||||
texFormat = texImage->TexFormat->MesaFormat;
|
||||
|
||||
rrb->pitch = texImage->Width * rrb->cpp;
|
||||
rrb->base.InternalFormat = rrb->base._ActualFormat;
|
||||
rrb->base.Width = texImage->Width;
|
||||
rrb->base.Height = texImage->Height;
|
||||
rrb->base.RedBits = texImage->TexFormat->RedBits;
|
||||
rrb->base.GreenBits = texImage->TexFormat->GreenBits;
|
||||
rrb->base.BlueBits = texImage->TexFormat->BlueBits;
|
||||
rrb->base.AlphaBits = texImage->TexFormat->AlphaBits;
|
||||
rrb->base.DepthBits = texImage->TexFormat->DepthBits;
|
||||
rrb->base.StencilBits = texImage->TexFormat->StencilBits;
|
||||
|
||||
rrb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE);
|
||||
rrb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE);
|
||||
rrb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE);
|
||||
rrb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE);
|
||||
rrb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB);
|
||||
rrb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT);
|
||||
rrb->base.Delete = radeon_delete_renderbuffer;
|
||||
rrb->base.AllocStorage = radeon_nop_alloc_storage;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue