[Mesa-dev] [PATCH 12/21] radeon: Enable vertex programs
Ian Romanick
idr at freedesktop.org
Sat Aug 27 00:57:02 PDT 2011
From: Ian Romanick <ian.d.romanick at intel.com>
Specifically, the following extensions are enabled:
GL_ARB_vertex_program
GL_EXT_gpu_program_paramaters
GL_NV_vertex_program
GL_NV_vertex_program1_1
In addition, ctx->Const.MaxCombinedTextureImageUnits is set.
This change was kept separate from the other drivers because the
Radeon driver has a hardware TNL mode. Additional code was needed to
detect enabling a vertex program and fallback to software TNL.
No piglit regressions were seen with this patch. The only vertex
program related test that fails uniquely on this driver is
all_state-01.txt. This test fails because it doesn't check whether
GL_ARB_point_parameters is supported, and the driver does not support
it.
Cc: Alex Deucher <alexdeucher at gmail.com>
Cc: Dave Airlie <airlied at redhat.com>
---
.../drivers/dri/radeon/radeon_common_context.h | 1 +
src/mesa/drivers/dri/radeon/radeon_context.c | 9 ++++++++-
src/mesa/drivers/dri/radeon/radeon_state.c | 10 ++++++++++
3 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h
index 3895ab8..f46581b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common_context.h
+++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h
@@ -63,6 +63,7 @@ typedef struct radeon_context *radeonContextPtr;
#define RADEON_TCL_FALLBACK_TEXGEN_2 0x40 /* texgen, unit 2 */
#define RADEON_TCL_FALLBACK_TCL_DISABLE 0x80 /* user disable */
#define RADEON_TCL_FALLBACK_FOGCOORDSPEC 0x100 /* fogcoord, sep. spec light */
+#define RADEON_TCL_FALLBCAK_SHADER 0x200 /* vertex shader */
/* The blit width for texture uploads
*/
diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c
index aac45be..167e248 100644
--- a/src/mesa/drivers/dri/radeon/radeon_context.c
+++ b/src/mesa/drivers/dri/radeon/radeon_context.c
@@ -83,6 +83,7 @@ static const struct tnl_pipeline_stage *radeon_pipeline[] = {
&_tnl_fog_coordinate_stage,
&_tnl_texgen_stage,
&_tnl_texture_transform_stage,
+ &_tnl_vertex_program_stage,
&_radeon_render_stage,
&_tnl_render_stage, /* FALLBACK: */
@@ -238,7 +239,9 @@ r100CreateContext( gl_api api,
"texture_units");
ctx->Const.MaxTextureImageUnits = ctx->Const.MaxTextureUnits;
ctx->Const.MaxTextureCoordUnits = ctx->Const.MaxTextureUnits;
- ctx->Const.MaxCombinedTextureImageUnits = ctx->Const.MaxTextureUnits;
+ ctx->Const.MaxCombinedTextureImageUnits =
+ ctx->Const.MaxVertexTextureImageUnits +
+ ctx->Const.MaxTextureImageUnits;
i = driQueryOptioni( &rmesa->radeon.optionCache, "allow_large_textures");
@@ -319,9 +322,11 @@ r100CreateContext( gl_api api,
ctx->Extensions.ARB_texture_env_crossbar = true;
ctx->Extensions.ARB_texture_env_dot3 = true;
ctx->Extensions.ARB_texture_mirrored_repeat = true;
+ ctx->Extensions.ARB_vertex_program = true;
ctx->Extensions.EXT_blend_logic_op = true;
ctx->Extensions.EXT_blend_subtract = true;
ctx->Extensions.EXT_fog_coord = true;
+ ctx->Extensions.EXT_gpu_program_parameters = true;
ctx->Extensions.EXT_packed_depth_stencil = true;
ctx->Extensions.EXT_secondary_color = true;
ctx->Extensions.EXT_stencil_wrap = true;
@@ -335,6 +340,8 @@ r100CreateContext( gl_api api,
ctx->Extensions.ATI_texture_mirror_once = true;
ctx->Extensions.MESA_ycbcr_texture = true;
ctx->Extensions.NV_blend_square = true;
+ ctx->Extensions.NV_vertex_program = true;
+ ctx->Extensions.NV_vertex_program1_1 = true;
#if FEATURE_OES_EGL_image
ctx->Extensions.OES_EGL_image = true;
#endif
diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c
index a93e618..b52565d 100644
--- a/src/mesa/drivers/dri/radeon/radeon_state.c
+++ b/src/mesa/drivers/dri/radeon/radeon_state.c
@@ -2242,6 +2242,15 @@ static void radeonPolygonStipple( struct gl_context *ctx, const GLubyte *mask )
}
+static void radeonBindProgram(struct gl_context *ctx, GLenum target,
+ struct gl_program *prog)
+{
+ (void) target;
+ assert(target == GL_VERTEX_PROGRAM_ARB);
+ TCL_FALLBACK(ctx, RADEON_TCL_FALLBCAK_SHADER, (prog != NULL));
+}
+
+
/* Initialize the driver's state functions.
* Many of the ctx->Driver functions might have been initialized to
* software defaults in the earlier _mesa_init_driver_functions() call.
@@ -2258,6 +2267,7 @@ void radeonInitStateFuncs( struct gl_context *ctx , GLboolean dri2 )
if (dri2)
ctx->Driver.ReadPixels = radeonReadPixels;
+ ctx->Driver.BindProgram = radeonBindProgram;
ctx->Driver.AlphaFunc = radeonAlphaFunc;
ctx->Driver.BlendEquationSeparate = radeonBlendEquationSeparate;
ctx->Driver.BlendFuncSeparate = radeonBlendFuncSeparate;
--
1.7.4.4
More information about the mesa-dev
mailing list