Dnia sobota, 16 maja 2009 o 19:11:43 Maciej Cencora napisał(a):
> Dnia sobota, 9 maja 2009 o 15:02:56 Maciej Cencora napisał(a):
> > Hi,
> >
> > I'd like to implement ARB_texture_rg support in core mesa and then in
> > r300 driver.
> > What files I'd have to modify to implement it in core mesa? Will I have
> > to implement any new functions, or this will be mostly adding new switch
> > cases?
> >
> > I guess the first thing would be to create new ARB_texture_rg.xml file in
> > glapi dir and include it in gl_API.xml. What then?
> >
> > Regards,
> > Maciej Cencora
>
> Here's first version of the patch. It's based on Ian Romanick's patch with
> some modifications:
> - renamed _mesa_texformat_r to _mesa_texformat_red, MESA_FORMAT_R to
> MESA_FORMAT_RED and similar,
> - remove RG16 and R16 formats related code (mesa lacks support fixed point
> 16bit per component textures).
>
> I haven't implemented support for R8I, R8UI, RG8I and RG16UI because mesa
> lacks support for EXT_texture_integer extension.
>
> Most of the code seems pretty straight, the only thing I'm not sure about
> are the chunks for texstate.c file.
>
> I've tested these patches with attached demo (based on
> progs/tests/texobj.c). Results:
> R8 and RG8 textures works in swrast and r300,
> R32F and RG32F works on r300,
> R16F and RG16F doesn't work on r300 (don't know why).
>
> Floating point format won't work on swrast because it doesn't support
> ARB_texture_float.
>
> There are some legal issues with ARB_texture_float extension, so mesa
> advertises MESAX_texture_float. What's the difference between these two
> extensions? Where is the MESAX_texture_float specification?
>
> Attached files:
> 0001-Implement-a-big-chunk-of-GL_ARB_texture_rg-in-swrast.patch - Ian's
> patch 0002-mesa-add-support-for-ARB_texture_rg.patch - my patch
> 0003-r300-add-support-for-ARB_texture_rg-extension.patch - my patch
> combined.patch - combined 0001 and 0002 for easier review
> texobjrg.c - test app
>
> Please review and comment
>
> Regards,
> Maciej Cencora
Update:
R16F and RG16F are working now on r300. I forgot to enable
ARB_half_float_pixel extension.
Here's updated patch for r300.
Maciej Cencora
From 1f7ec359c6d9cefe7d778f19a2a4b4c6b376a464 Mon Sep 17 00:00:00 2001
From: Maciej Cencora <[email protected]>
Date: Sat, 16 May 2009 18:28:17 +0200
Subject: [PATCH] r300: add support for ARB_texture_rg and ARB_half_float_pixel extension
---
src/mesa/drivers/dri/r300/r300_context.c | 2 ++
src/mesa/drivers/dri/r300/r300_tex.c | 13 +++++++++++++
src/mesa/drivers/dri/r300/r300_texstate.c | 6 ++++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 12bee1a..21d9022 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -95,6 +95,7 @@ const struct dri_extension card_extensions[] = {
/* *INDENT-OFF* */
{"GL_ARB_depth_texture", NULL},
{"GL_ARB_fragment_program", NULL},
+ {"GL_ARB_half_float_pixel", NULL},
{"GL_ARB_multitexture", NULL},
{"GL_ARB_point_parameters", GL_ARB_point_parameters_functions},
{"GL_ARB_shadow", NULL},
@@ -106,6 +107,7 @@ const struct dri_extension card_extensions[] = {
{"GL_ARB_texture_env_crossbar", NULL},
{"GL_ARB_texture_env_dot3", NULL},
{"GL_ARB_texture_mirrored_repeat", NULL},
+ {"GL_ARB_texture_rg", NULL},
{"GL_ARB_vertex_program", GL_ARB_vertex_program_functions},
{"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions},
{"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions},
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 7c699ec..5e0e5c6 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -410,6 +410,19 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx,
case GL_RGBA32F_ARB:
return &_mesa_texformat_rgba_float32;
+ case GL_R8:
+ return &_mesa_texformat_r8;
+ case GL_RG8:
+ return &_mesa_texformat_rg88;
+ case GL_R16F:
+ return &_mesa_texformat_red_float16;
+ case GL_R32F:
+ return &_mesa_texformat_red_float32;
+ case GL_RG16F:
+ return &_mesa_texformat_rg_float16;
+ case GL_RG32F:
+ return &_mesa_texformat_rg_float32;
+
case GL_DEPTH_COMPONENT:
case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT24:
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index abe613e..ac4a835 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -107,6 +107,12 @@ static const struct tx_table {
_ASSIGN(RGBA_FLOAT16, R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R16G16B16A16)),
_ASSIGN(RGB_FLOAT32, 0xffffffff),
_ASSIGN(RGB_FLOAT16, 0xffffffff),
+ _ASSIGN(R8, R300_EASY_TX_FORMAT(ZERO, ZERO, X, ONE, X8)),
+ _ASSIGN(RG88, R300_EASY_TX_FORMAT(ZERO, Y, X, ONE, Y8X8)),
+ _ASSIGN(RED_FLOAT16, R300_EASY_TX_FORMAT(ZERO, ZERO, X, ONE, FL_I16)),
+ _ASSIGN(RG_FLOAT16, R300_EASY_TX_FORMAT(ZERO, X, Y, ONE, FL_I16A16)),
+ _ASSIGN(RED_FLOAT32, R300_EASY_TX_FORMAT(ZERO, ZERO, X, ONE, FL_I32)),
+ _ASSIGN(RG_FLOAT32, R300_EASY_TX_FORMAT(ZERO, X, Y, ONE, FL_I32A32)),
_ASSIGN(ALPHA_FLOAT32, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I32)),
_ASSIGN(ALPHA_FLOAT16, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I16)),
_ASSIGN(LUMINANCE_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, ONE, FL_I32)),
--
1.6.0.4
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables
unlimited royalty-free distribution of the report engine
for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev