mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
Initial support for ARB_depth_texture
Currently only GL_DEPTH_COMPONENT16 are supported. I don't know what the hardware bits are to select the other formats, but it shouldn't be too hard to figure out.
This commit is contained in:
parent
b961eccc92
commit
42a4386a4c
4 changed files with 77 additions and 2 deletions
|
|
@ -93,6 +93,8 @@ int hw_tcl_on = 1;
|
|||
|
||||
const struct dri_extension card_extensions[] = {
|
||||
/* *INDENT-OFF* */
|
||||
{"GL_ARB_depth_texture", NULL},
|
||||
{"GL_ARB_fragment_program", NULL},
|
||||
{"GL_ARB_multisample", GL_ARB_multisample_functions},
|
||||
{"GL_ARB_multitexture", NULL},
|
||||
{"GL_ARB_texture_border_clamp", NULL},
|
||||
|
|
@ -105,7 +107,6 @@ const struct dri_extension card_extensions[] = {
|
|||
{"GL_ARB_texture_mirrored_repeat", NULL},
|
||||
{"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions},
|
||||
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
|
||||
{"GL_ARB_fragment_program", NULL},
|
||||
{"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
|
||||
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
|
||||
{"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions},
|
||||
|
|
@ -130,6 +131,7 @@ const struct dri_extension card_extensions[] = {
|
|||
{"GL_NV_blend_square", NULL},
|
||||
{"GL_NV_vertex_program", GL_NV_vertex_program_functions},
|
||||
{"GL_SGIS_generate_mipmap", NULL},
|
||||
{"GL_SGIX_depth_texture", NULL},
|
||||
{NULL, NULL}
|
||||
/* *INDENT-ON* */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -482,6 +482,25 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx,
|
|||
case GL_RGBA32F_ARB:
|
||||
return &_mesa_texformat_rgba_float32;
|
||||
|
||||
case GL_DEPTH_COMPONENT:
|
||||
case GL_DEPTH_COMPONENT16:
|
||||
case GL_DEPTH_COMPONENT24:
|
||||
case GL_DEPTH_COMPONENT32:
|
||||
#if 0
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
case GL_UNSIGNED_SHORT:
|
||||
return &_mesa_texformat_z16;
|
||||
case GL_UNSIGNED_INT:
|
||||
return &_mesa_texformat_z32;
|
||||
case GL_UNSIGNED_INT_24_8_EXT:
|
||||
default:
|
||||
return &_mesa_texformat_z24_s8;
|
||||
}
|
||||
#else
|
||||
return &_mesa_texformat_z16;
|
||||
#endif
|
||||
|
||||
default:
|
||||
_mesa_problem(ctx,
|
||||
"unexpected internalFormat 0x%x in r300ChooseTextureFormat",
|
||||
|
|
@ -1057,6 +1076,19 @@ static void r300TexParameter(GLcontext * ctx, GLenum target,
|
|||
driSwapOutTextureObject((driTextureObject *) t);
|
||||
break;
|
||||
|
||||
case GL_DEPTH_TEXTURE_MODE:
|
||||
if (texObj->Image[0][texObj->BaseLevel]->TexFormat->BaseFormat
|
||||
== GL_DEPTH_COMPONENT) {
|
||||
r300SetDepthTexMode(texObj);
|
||||
break;
|
||||
} else {
|
||||
/* If the texture isn't a depth texture, changing this
|
||||
* state won't cause any changes to the hardware.
|
||||
* Don't force a flush of texture state.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
#ifndef __r300_TEX_H__
|
||||
#define __r300_TEX_H__
|
||||
|
||||
extern void r300SetDepthTexMode(struct gl_texture_object *tObj);
|
||||
|
||||
extern void r300SetTexOffset(__DRIcontext *pDRICtx, GLint texname,
|
||||
unsigned long long offset, GLint depth,
|
||||
GLuint pitch);
|
||||
|
|
|
|||
|
|
@ -115,11 +115,45 @@ static const struct tx_table {
|
|||
_ASSIGN(LUMINANCE_ALPHA_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, Y, FL_I16A16)),
|
||||
_ASSIGN(INTENSITY_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, X, FL_I32)),
|
||||
_ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)),
|
||||
_ASSIGN(Z16, R300_EASY_TX_FORMAT(X, X, X, X, X16)),
|
||||
#if 0
|
||||
_ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)),
|
||||
_ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)),
|
||||
#endif
|
||||
/* *INDENT-ON* */
|
||||
};
|
||||
|
||||
#undef _ASSIGN
|
||||
|
||||
void r300SetDepthTexMode(struct gl_texture_object *tObj)
|
||||
{
|
||||
r300TexObjPtr t;
|
||||
|
||||
if (!tObj)
|
||||
return;
|
||||
|
||||
t = (r300TexObjPtr) tObj->DriverData;
|
||||
|
||||
switch (tObj->DepthMode) {
|
||||
case GL_LUMINANCE:
|
||||
t->format = R300_EASY_TX_FORMAT(X, X, X, X, X16);
|
||||
break;
|
||||
case GL_INTENSITY:
|
||||
t->format = R300_EASY_TX_FORMAT(X, X, X, ONE, X16);
|
||||
break;
|
||||
case GL_ALPHA:
|
||||
t->format = R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X16);
|
||||
break;
|
||||
default:
|
||||
/* Error...which should have already been caught by higher
|
||||
* levels of Mesa.
|
||||
*/
|
||||
ASSERT(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function computes the number of bytes of storage needed for
|
||||
* the given texture object (all mipmap levels, all cube faces).
|
||||
|
|
@ -146,7 +180,12 @@ static void r300SetTexImages(r300ContextPtr rmesa,
|
|||
*/
|
||||
if (!t->image_override
|
||||
&& VALID_FORMAT(baseImage->TexFormat->MesaFormat)) {
|
||||
t->format = tx_table[baseImage->TexFormat->MesaFormat].format;
|
||||
if (baseImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) {
|
||||
r300SetDepthTexMode(tObj);
|
||||
} else {
|
||||
t->format = tx_table[baseImage->TexFormat->MesaFormat].format;
|
||||
}
|
||||
|
||||
t->filter |= tx_table[baseImage->TexFormat->MesaFormat].filter;
|
||||
} else if (!t->image_override) {
|
||||
_mesa_problem(NULL, "unexpected texture format in %s",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue