diff options
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_image.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_texture.c | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r200/r200_texstate.c | 20 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_texstate.c | 19 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r600/evergreen_tex.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r600/r600_texstate.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_texstate.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/swrast/swrast.c | 11 |
8 files changed, 72 insertions, 56 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 50fe9bd9f33..41cdbfd2cbd 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -682,6 +682,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, struct gl_texture_object *texObj; struct gl_texture_image *texImage; int level = 0, internalFormat; + gl_format texFormat; texObj = _mesa_get_current_tex_object(ctx, target); intelObj = intel_texture_object(texObj); @@ -700,10 +701,14 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, if (rb->region == NULL) return; - if (texture_format == __DRI_TEXTURE_FORMAT_RGB) + if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { internalFormat = GL_RGB; - else + texFormat = MESA_FORMAT_XRGB8888; + } + else { internalFormat = GL_RGBA; + texFormat = MESA_FORMAT_ARGB8888; + } mt = intel_miptree_create_for_region(intel, target, internalFormat, @@ -724,16 +729,13 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, intel_miptree_release(intel, &intelObj->mt); intelObj->mt = mt; + _mesa_init_teximage_fields(&intel->ctx, target, texImage, rb->region->width, rb->region->height, 1, - 0, internalFormat); + 0, internalFormat, texFormat); intelImage->face = target_to_face(target); intelImage->level = level; - if (texture_format == __DRI_TEXTURE_FORMAT_RGB) - texImage->TexFormat = MESA_FORMAT_XRGB8888; - else - texImage->TexFormat = MESA_FORMAT_ARGB8888; texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); @@ -789,11 +791,10 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target, intelObj->mt = mt; _mesa_init_teximage_fields(&intel->ctx, target, texImage, image->region->width, image->region->height, 1, - 0, image->internal_format); + 0, image->internal_format, image->format); intelImage->face = target_to_face(target); intelImage->level = 0; - texImage->TexFormat = image->format; texImage->RowStride = image->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index 060c2c5bcc0..2480b1ea500 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -603,11 +603,12 @@ nouveau_set_texbuffer(__DRIcontext *dri_ctx, nouveau_update_renderbuffers(dri_ctx, draw); nouveau_surface_ref(&to_nouveau_renderbuffer(rb)->surface, s); + s->format = get_texbuffer_format(rb, format); + /* Update the image fields. */ _mesa_init_teximage_fields(ctx, target, ti, s->width, s->height, - 1, 0, s->cpp); + 1, 0, s->cpp, s->format); ti->RowStride = s->pitch / s->cpp; - ti->TexFormat = s->format = get_texbuffer_format(rb, format); /* Try to validate it. */ if (!validate_teximage(ctx, t, 0, 0, 0, 0, s->width, s->height, 1)) diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index ee968d69f66..24fb031ecb9 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -778,6 +778,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format radeonTexObjPtr t; uint32_t pitch_val; uint32_t internalFormat, type, format; + gl_format texFormat; type = GL_BGRA; format = GL_UNSIGNED_BYTE; @@ -817,10 +818,6 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format radeon_miptree_unreference(&t->mt); radeon_miptree_unreference(&rImage->mt); - _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->base.Width, rb->base.Height, 1, 0, rb->cpp); - texImage->RowStride = rb->pitch / rb->cpp; - rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; @@ -833,27 +830,34 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format switch (rb->cpp) { case 4: if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format; } else { - texImage->TexFormat = MESA_FORMAT_ARGB8888; + texFormat = MESA_FORMAT_ARGB8888; t->pp_txformat = tx_table_le[MESA_FORMAT_ARGB8888].format; } t->pp_txfilter |= tx_table_le[MESA_FORMAT_ARGB8888].filter; break; case 3: default: - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; t->pp_txformat = tx_table_le[MESA_FORMAT_RGB888].format; t->pp_txfilter |= tx_table_le[MESA_FORMAT_RGB888].filter; break; case 2: - texImage->TexFormat = MESA_FORMAT_RGB565; + texFormat = MESA_FORMAT_RGB565; t->pp_txformat = tx_table_le[MESA_FORMAT_RGB565].format; t->pp_txfilter |= tx_table_le[MESA_FORMAT_RGB565].filter; break; } + + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, + rb->base.Width, rb->base.Height, 1, 0, + rb->cpp, texFormat); + texImage->RowStride = rb->pitch / rb->cpp; + + t->pp_txsize = ((rb->base.Width - 1) << RADEON_TEX_USIZE_SHIFT) | ((rb->base.Height - 1) << RADEON_TEX_VSIZE_SHIFT); t->pp_txformat |= R200_TXFORMAT_NON_POWER2; diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index a4fbd99308b..ed9955b05d8 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -428,6 +428,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format radeonTexObjPtr t; uint32_t pitch_val; uint32_t internalFormat, type, format; + gl_format texFormat; type = GL_BGRA; format = GL_UNSIGNED_BYTE; @@ -467,9 +468,6 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format radeon_miptree_unreference(&t->mt); radeon_miptree_unreference(&rImage->mt); - _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->base.Width, rb->base.Height, 1, 0, rb->cpp); - texImage->RowStride = rb->pitch / rb->cpp; rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; @@ -482,27 +480,34 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_format switch (rb->cpp) { case 4: if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); } else { - texImage->TexFormat = MESA_FORMAT_ARGB8888; + texFormat = MESA_FORMAT_ARGB8888; t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); } pitch_val /= 4; break; case 3: default: - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); pitch_val /= 4; break; case 2: - texImage->TexFormat = MESA_FORMAT_RGB565; + texFormat = MESA_FORMAT_RGB565; t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5); pitch_val /= 2; break; } + + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, + rb->base.Width, rb->base.Height, 1, 0, + rb->cpp, texFormat); + texImage->RowStride = rb->pitch / rb->cpp; + + pitch_val--; t->pp_txsize = (((R300_TX_WIDTHMASK_MASK & ((rb->base.Width - 1) << R300_TX_WIDTHMASK_SHIFT))) | ((R300_TX_HEIGHTMASK_MASK & ((rb->base.Height - 1) << R300_TX_HEIGHTMASK_SHIFT)))); diff --git a/src/mesa/drivers/dri/r600/evergreen_tex.c b/src/mesa/drivers/dri/r600/evergreen_tex.c index d4c2cb96862..40a465b878e 100644 --- a/src/mesa/drivers/dri/r600/evergreen_tex.c +++ b/src/mesa/drivers/dri/r600/evergreen_tex.c @@ -1152,6 +1152,7 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur radeonTexObjPtr t; uint32_t pitch_val; uint32_t internalFormat, type, format; + gl_format texFormat; type = GL_BGRA; format = GL_UNSIGNED_BYTE; @@ -1191,10 +1192,6 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur radeon_miptree_unreference(&t->mt); radeon_miptree_unreference(&rImage->mt); - _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->base.Width, rb->base.Height, 1, 0, rb->cpp); - texImage->RowStride = rb->pitch / rb->cpp; - rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; @@ -1205,7 +1202,7 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur switch (rb->cpp) { case 4: if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) { - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); @@ -1219,7 +1216,7 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); } else { - texImage->TexFormat = MESA_FORMAT_ARGB8888; + texFormat = MESA_FORMAT_ARGB8888; SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); @@ -1238,7 +1235,7 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur case 3: default: // FMT_8_8_8 ??? - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; SETfield(t->SQ_TEX_RESOURCE7, FMT_8_8_8_8, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); @@ -1254,7 +1251,7 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur pitch_val /= 4; break; case 2: - texImage->TexFormat = MESA_FORMAT_RGB565; + texFormat = MESA_FORMAT_RGB565; SETfield(t->SQ_TEX_RESOURCE7, FMT_5_6_5, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_shift, EG_SQ_TEX_RESOURCE_WORD7_0__DATA_FORMAT_mask); @@ -1271,6 +1268,11 @@ void evergreenSetTexBuffer(__DRIcontext *pDRICtx, GLint target, GLint glx_textur break; } + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, + rb->base.Width, rb->base.Height, 1, 0, + rb->cpp, texFormat); + texImage->RowStride = rb->pitch / rb->cpp; + pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 20fe32ae9ec..aafa6875774 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -1001,6 +1001,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeonTexObjPtr t; uint32_t pitch_val; uint32_t internalFormat, type, format; + gl_format texFormat; type = GL_BGRA; format = GL_UNSIGNED_BYTE; @@ -1046,10 +1047,6 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeon_miptree_unreference(&t->mt); radeon_miptree_unreference(&rImage->mt); - _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->base.Width, rb->base.Height, 1, 0, rb->cpp); - texImage->RowStride = rb->pitch / rb->cpp; - rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; @@ -1060,7 +1057,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo switch (rb->cpp) { case 4: if (glx_texture_format == __DRI_TEXTURE_FORMAT_RGB) { - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); @@ -1073,7 +1070,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_1, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); } else { - texImage->TexFormat = MESA_FORMAT_ARGB8888; + texFormat = MESA_FORMAT_ARGB8888; SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); @@ -1091,7 +1088,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo case 3: default: // FMT_8_8_8 ??? - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); @@ -1106,7 +1103,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo pitch_val /= 4; break; case 2: - texImage->TexFormat = MESA_FORMAT_RGB565; + texFormat = MESA_FORMAT_RGB565; SETfield(t->SQ_TEX_RESOURCE1, FMT_5_6_5, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); @@ -1122,6 +1119,11 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo break; } + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, + rb->base.Width, rb->base.Height, 1, 0, + rb->cpp, texFormat); + texImage->RowStride = rb->pitch / rb->cpp; + pitch_val = (pitch_val + R700_TEXEL_PITCH_ALIGNMENT_MASK) & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 7409aeeeaa8..32c021cb545 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -653,6 +653,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form radeonTexObjPtr t; uint32_t pitch_val; uint32_t internalFormat, type, format; + gl_format texFormat; type = GL_BGRA; format = GL_UNSIGNED_BYTE; @@ -692,10 +693,6 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form radeon_miptree_unreference(&t->mt); radeon_miptree_unreference(&rImage->mt); - _mesa_init_teximage_fields(radeon->glCtx, target, texImage, - rb->base.Width, rb->base.Height, 1, 0, rb->cpp); - texImage->RowStride = rb->pitch / rb->cpp; - rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; @@ -707,27 +704,32 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint texture_form case 4: if (texture_format == __DRI_TEXTURE_FORMAT_RGB) { t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format; - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; } else { t->pp_txformat = tx_table[MESA_FORMAT_ARGB8888].format; - texImage->TexFormat = MESA_FORMAT_ARGB8888; + texFormat = MESA_FORMAT_ARGB8888; } t->pp_txfilter |= tx_table[MESA_FORMAT_ARGB8888].filter; break; case 3: default: - texImage->TexFormat = MESA_FORMAT_RGB888; + texFormat = MESA_FORMAT_RGB888; t->pp_txformat = tx_table[MESA_FORMAT_RGB888].format; t->pp_txfilter |= tx_table[MESA_FORMAT_RGB888].filter; break; case 2: - texImage->TexFormat = MESA_FORMAT_RGB565; + texFormat = MESA_FORMAT_RGB565; t->pp_txformat = tx_table[MESA_FORMAT_RGB565].format; t->pp_txfilter |= tx_table[MESA_FORMAT_RGB565].filter; break; } + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, + rb->base.Width, rb->base.Height, 1, 0, + rb->cpp, texFormat); + texImage->RowStride = rb->pitch / rb->cpp; + t->pp_txpitch &= (1 << 13) -1; pitch_val = rb->pitch; diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 52ba3acf658..c7aaafcee8c 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -69,6 +69,7 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, struct gl_texture_object *texObj; struct gl_texture_image *texImage; uint32_t internalFormat; + gl_format texFormat; dri_ctx = pDRICtx->driverPrivate; @@ -82,15 +83,13 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, sPriv->swrast_loader->getDrawableInfo(dPriv, &x, &y, &w, &h, dPriv->loaderPrivate); - _mesa_init_teximage_fields(&dri_ctx->Base, target, texImage, - w, h, 1, 0, internalFormat); - if (texture_format == __DRI_TEXTURE_FORMAT_RGB) - texImage->TexFormat = MESA_FORMAT_XRGB8888; + texFormat = MESA_FORMAT_XRGB8888; else - texImage->TexFormat = MESA_FORMAT_ARGB8888; + texFormat = MESA_FORMAT_ARGB8888; - _mesa_set_fetch_functions(texImage, 2); + _mesa_init_teximage_fields(&dri_ctx->Base, target, texImage, + w, h, 1, 0, internalFormat, texFormat); sPriv->swrast_loader->getImage(dPriv, x, y, w, h, (char *)texImage->Data, dPriv->loaderPrivate); |