From 79c55e55f808d77cb0dff7cda826719d5fda3c7d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Mar 2009 19:03:30 -0600 Subject: dri: use BorderColor instead of _BorderChan --- src/mesa/drivers/dri/radeon/radeon_tex.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/mesa/drivers/dri/radeon') diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index b0aec21670..f2b6deb9c0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -239,8 +239,13 @@ static void radeonSetTexFilter( radeonTexObjPtr t, GLenum minf, GLenum magf ) } } -static void radeonSetTexBorderColor( radeonTexObjPtr t, GLubyte c[4] ) +static void radeonSetTexBorderColor( radeonTexObjPtr t, const GLfloat color[4] ) { + GLubyte c[4]; + CLAMPED_FLOAT_TO_UBYTE(c[0], color[0]); + CLAMPED_FLOAT_TO_UBYTE(c[1], color[1]); + CLAMPED_FLOAT_TO_UBYTE(c[2], color[2]); + CLAMPED_FLOAT_TO_UBYTE(c[3], color[3]); t->pp_border_color = radeonPackColor( 4, c[0], c[1], c[2], c[3] ); } @@ -276,7 +281,7 @@ static radeonTexObjPtr radeonAllocTexObj( struct gl_texture_object *texObj ) radeonSetTexWrap( t, texObj->WrapS, texObj->WrapT ); radeonSetTexMaxAnisotropy( t, texObj->MaxAnisotropy ); radeonSetTexFilter( t, texObj->MinFilter, texObj->MagFilter ); - radeonSetTexBorderColor( t, texObj->_BorderChan ); + radeonSetTexBorderColor( t, texObj->BorderColor ); } return t; @@ -755,7 +760,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target, break; case GL_TEXTURE_BORDER_COLOR: - radeonSetTexBorderColor( t, texObj->_BorderChan ); + radeonSetTexBorderColor( t, texObj->BorderColor ); break; case GL_TEXTURE_BASE_LEVEL: -- cgit v1.2.3 From 7391ba1e9d81f15465059db25d1279eefdbeb1a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Apr 2009 10:08:20 -0600 Subject: mesa: rename some gl_light fields to be clearer EyeDirection -> SpotDirection _NormDirection -> _NormSpotDirection --- src/mesa/drivers/dri/r200/r200_state.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_lighting.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_state.c | 8 ++++---- src/mesa/main/attrib.c | 2 +- src/mesa/main/light.c | 26 +++++++++++++------------- src/mesa/main/mtypes.h | 4 ++-- src/mesa/shader/prog_statevars.c | 4 ++-- src/mesa/tnl/t_rasterpos.c | 2 +- src/mesa/tnl/t_vb_lighttmp.h | 6 +++--- src/mesa/x86/gen_matypes.c | 4 ++-- 10 files changed, 36 insertions(+), 36 deletions(-) (limited to 'src/mesa/drivers/dri/radeon') diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 0eaaaf69ac..2fcc87c0f5 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -1210,7 +1210,7 @@ void r200UpdateMaterial( GLcontext *ctx ) * _VP_inf_norm * _h_inf_norm * _Position - * _NormDirection + * _NormSpotDirection * _ModelViewInvScale * _NeedEyeCoords * _EyeZDir @@ -1267,9 +1267,9 @@ static void update_light( GLcontext *ctx ) fcmd[LIT_DIRECTION_W] = 0; } else { COPY_4V( &fcmd[LIT_POSITION_X], l->_Position ); - fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0]; - fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1]; - fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2]; + fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0]; + fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1]; + fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2]; fcmd[LIT_DIRECTION_W] = 0; } diff --git a/src/mesa/drivers/dri/radeon/radeon_lighting.c b/src/mesa/drivers/dri/radeon/radeon_lighting.c index 6d9ccfa24d..ac3b94e4a6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lighting.c +++ b/src/mesa/drivers/dri/radeon/radeon_lighting.c @@ -246,7 +246,7 @@ void radeonUpdateMaterial( GLcontext *ctx ) * _VP_inf_norm * _h_inf_norm * _Position - * _NormDirection + * _NormSpotDirection * _ModelViewInvScale * _NeedEyeCoords * _EyeZDir @@ -308,9 +308,9 @@ void radeonUpdateLighting( GLcontext *ctx ) fcmd[LIT_DIRECTION_W] = 0; } else { COPY_4V( &fcmd[LIT_POSITION_X], l->_Position ); - fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0]; - fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1]; - fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2]; + fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0]; + fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1]; + fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2]; fcmd[LIT_DIRECTION_W] = 0; } diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 32bcff3360..b6561001e7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -967,7 +967,7 @@ void radeonUpdateMaterial( GLcontext *ctx ) * _VP_inf_norm * _h_inf_norm * _Position - * _NormDirection + * _NormSpotDirection * _ModelViewInvScale * _NeedEyeCoords * _EyeZDir @@ -1028,9 +1028,9 @@ static void update_light( GLcontext *ctx ) fcmd[LIT_DIRECTION_W] = 0; } else { COPY_4V( &fcmd[LIT_POSITION_X], l->_Position ); - fcmd[LIT_DIRECTION_X] = -l->_NormDirection[0]; - fcmd[LIT_DIRECTION_Y] = -l->_NormDirection[1]; - fcmd[LIT_DIRECTION_Z] = -l->_NormDirection[2]; + fcmd[LIT_DIRECTION_X] = -l->_NormSpotDirection[0]; + fcmd[LIT_DIRECTION_Y] = -l->_NormSpotDirection[1]; + fcmd[LIT_DIRECTION_Z] = -l->_NormSpotDirection[2]; fcmd[LIT_DIRECTION_W] = 0; } diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 1d2c460488..d5d0a552db 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1104,7 +1104,7 @@ _mesa_PopAttrib(void) _mesa_light(ctx, i, GL_DIFFUSE, l->Diffuse); _mesa_light(ctx, i, GL_SPECULAR, l->Specular ); _mesa_light(ctx, i, GL_POSITION, l->EyePosition); - _mesa_light(ctx, i, GL_SPOT_DIRECTION, l->EyeDirection); + _mesa_light(ctx, i, GL_SPOT_DIRECTION, l->SpotDirection); _mesa_light(ctx, i, GL_SPOT_EXPONENT, &l->SpotExponent); _mesa_light(ctx, i, GL_SPOT_CUTOFF, &l->SpotCutoff); _mesa_light(ctx, i, GL_CONSTANT_ATTENUATION, diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index f72841b8cc..ac604fd12c 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -110,10 +110,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params) break; case GL_SPOT_DIRECTION: /* NOTE: Direction already transformed by inverse ModelView! */ - if (TEST_EQ_3V(light->EyeDirection, params)) + if (TEST_EQ_3V(light->SpotDirection, params)) return; FLUSH_VERTICES(ctx, _NEW_LIGHT); - COPY_3V(light->EyeDirection, params); + COPY_3V(light->SpotDirection, params); break; case GL_SPOT_EXPONENT: ASSERT(params[0] >= 0.0); @@ -325,7 +325,7 @@ _mesa_GetLightfv( GLenum light, GLenum pname, GLfloat *params ) COPY_4V( params, ctx->Light.Light[l].EyePosition ); break; case GL_SPOT_DIRECTION: - COPY_3V( params, ctx->Light.Light[l].EyeDirection ); + COPY_3V( params, ctx->Light.Light[l].SpotDirection ); break; case GL_SPOT_EXPONENT: params[0] = ctx->Light.Light[l].SpotExponent; @@ -387,9 +387,9 @@ _mesa_GetLightiv( GLenum light, GLenum pname, GLint *params ) params[3] = (GLint) ctx->Light.Light[l].EyePosition[3]; break; case GL_SPOT_DIRECTION: - params[0] = (GLint) ctx->Light.Light[l].EyeDirection[0]; - params[1] = (GLint) ctx->Light.Light[l].EyeDirection[1]; - params[2] = (GLint) ctx->Light.Light[l].EyeDirection[2]; + params[0] = (GLint) ctx->Light.Light[l].SpotDirection[0]; + params[1] = (GLint) ctx->Light.Light[l].SpotDirection[1]; + params[2] = (GLint) ctx->Light.Light[l].SpotDirection[2]; break; case GL_SPOT_EXPONENT: params[0] = (GLint) ctx->Light.Light[l].SpotExponent; @@ -1139,23 +1139,23 @@ compute_light_positions( GLcontext *ctx ) /* Note: we normalize the spot direction now */ if (ctx->_NeedEyeCoords) { - COPY_3V( light->_NormDirection, light->EyeDirection ); - NORMALIZE_3FV( light->_NormDirection ); + COPY_3V( light->_NormSpotDirection, light->SpotDirection ); + NORMALIZE_3FV( light->_NormSpotDirection ); } else { GLfloat spotDir[3]; - COPY_3V(spotDir, light->EyeDirection); + COPY_3V(spotDir, light->SpotDirection); NORMALIZE_3FV(spotDir); - TRANSFORM_NORMAL( light->_NormDirection, + TRANSFORM_NORMAL( light->_NormSpotDirection, spotDir, ctx->ModelviewMatrixStack.Top->m); } - NORMALIZE_3FV( light->_NormDirection ); + NORMALIZE_3FV( light->_NormSpotDirection ); if (!(light->_Flags & LIGHT_POSITIONAL)) { GLfloat PV_dot_dir = - DOT3(light->_VP_inf_norm, - light->_NormDirection); + light->_NormSpotDirection); if (PV_dot_dir > light->_CosCutoff) { double x = PV_dot_dir * (EXP_TABLE_SIZE-1); @@ -1279,7 +1279,7 @@ init_light( struct gl_light *l, GLuint n ) ASSIGN_4V( l->Specular, 0.0, 0.0, 0.0, 1.0 ); } ASSIGN_4V( l->EyePosition, 0.0, 0.0, 1.0, 0.0 ); - ASSIGN_3V( l->EyeDirection, 0.0, 0.0, -1.0 ); + ASSIGN_3V( l->SpotDirection, 0.0, 0.0, -1.0 ); l->SpotExponent = 0.0; _mesa_invalidate_spot_exp_table( l ); l->SpotCutoff = 180.0; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 10f0d067e3..3f31590000 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -460,7 +460,7 @@ struct gl_light GLfloat Diffuse[4]; /**< diffuse color */ GLfloat Specular[4]; /**< specular color */ GLfloat EyePosition[4]; /**< position in eye coordinates */ - GLfloat EyeDirection[4]; /**< spotlight dir in eye coordinates */ + GLfloat SpotDirection[4]; /**< spotlight direction in eye coordinates */ GLfloat SpotExponent; GLfloat SpotCutoff; /**< in degrees */ GLfloat _CosCutoffNeg; /**< = cos(SpotCutoff) */ @@ -479,7 +479,7 @@ struct gl_light GLfloat _Position[4]; /**< position in eye/obj coordinates */ GLfloat _VP_inf_norm[3]; /**< Norm direction to infinite light */ GLfloat _h_inf_norm[3]; /**< Norm( _VP_inf_norm + <0,0,1> ) */ - GLfloat _NormDirection[4]; /**< normalized spotlight direction */ + GLfloat _NormSpotDirection[4]; /**< normalized spotlight direction */ GLfloat _VP_inf_spot_attenuation; GLfloat _SpotExpTable[EXP_TABLE_SIZE][2]; /**< to replace a pow() call */ diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index b93e987f04..37a3f1fc8c 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -112,7 +112,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], value[3] = ctx->Light.Light[ln].SpotExponent; return; case STATE_SPOT_DIRECTION: - COPY_3V(value, ctx->Light.Light[ln].EyeDirection); + COPY_3V(value, ctx->Light.Light[ln].SpotDirection); value[3] = ctx->Light.Light[ln]._CosCutoff; return; case STATE_SPOT_CUTOFF: @@ -449,7 +449,7 @@ _mesa_fetch_state(GLcontext *ctx, const gl_state_index state[], /* here, state[2] is the light number */ /* pre-normalize spot dir */ const GLuint ln = (GLuint) state[2]; - COPY_3V(value, ctx->Light.Light[ln]._NormDirection); + COPY_3V(value, ctx->Light.Light[ln]._NormSpotDirection); value[3] = ctx->Light.Light[ln]._CosCutoff; } return; diff --git a/src/mesa/tnl/t_rasterpos.c b/src/mesa/tnl/t_rasterpos.c index 04fb1d8f8c..f1fdddf0f5 100644 --- a/src/mesa/tnl/t_rasterpos.c +++ b/src/mesa/tnl/t_rasterpos.c @@ -167,7 +167,7 @@ shade_rastpos(GLcontext *ctx, light->QuadraticAttenuation)); if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir_CosCutoff) { continue; diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index a78f27761f..124ca3c74f 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -141,7 +141,7 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir_CosCutoff) { continue; /* this light makes no contribution */ @@ -325,7 +325,7 @@ static void TAG(light_rgba)( GLcontext *ctx, /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir_CosCutoff) { continue; /* this light makes no contribution */ @@ -721,7 +721,7 @@ static void TAG(light_ci)( GLcontext *ctx, /* spotlight attenuation */ if (light->_Flags & LIGHT_SPOT) { - GLfloat PV_dot_dir = - DOT3(VP, light->_NormDirection); + GLfloat PV_dot_dir = - DOT3(VP, light->_NormSpotDirection); if (PV_dot_dir < light->_CosCutoff) { continue; /* this light makes no contribution */ } diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index 8c690b4f88..d56b701aa8 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -197,7 +197,7 @@ int main( int argc, char **argv ) OFFSET( "LIGHT_DIFFUSE ", struct gl_light, Diffuse ); OFFSET( "LIGHT_SPECULAR ", struct gl_light, Specular ); OFFSET( "LIGHT_EYE_POSITION ", struct gl_light, EyePosition ); - OFFSET( "LIGHT_EYE_DIRECTION ", struct gl_light, EyeDirection ); + OFFSET( "LIGHT_SPOT_DIRECTION ", struct gl_light, SpotDirection ); OFFSET( "LIGHT_SPOT_EXPONENT ", struct gl_light, SpotExponent ); OFFSET( "LIGHT_SPOT_CUTOFF ", struct gl_light, SpotCutoff ); OFFSET( "LIGHT_COS_CUTOFF ", struct gl_light, _CosCutoff ); @@ -211,7 +211,7 @@ int main( int argc, char **argv ) OFFSET( "LIGHT_POSITION ", struct gl_light, _Position ); OFFSET( "LIGHT_VP_INF_NORM ", struct gl_light, _VP_inf_norm ); OFFSET( "LIGHT_H_INF_NORM ", struct gl_light, _h_inf_norm ); - OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormDirection ); + OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormSpotDirection ); OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation ); printf( "\n" ); OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable ); -- cgit v1.2.3 From e798bf8053612516420a4ec42e2ff58433abd521 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Mon, 6 Apr 2009 08:59:57 +0200 Subject: radeon: Expose a 32 bit RGBA fbconfig even when the screen depth is 16. Otherwise current xserver / libGL no longer expose a 32 bit RGBA GLX visual, and compiz fails. Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20479 . --- src/mesa/drivers/dri/radeon/radeon_screen.c | 35 ++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'src/mesa/drivers/dri/radeon') diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index e964feb9cc..882853344b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -261,8 +261,6 @@ radeonFillInModes( __DRIscreenPrivate *psp, __GLcontextModes *m; unsigned depth_buffer_factor; unsigned back_buffer_factor; - GLenum fb_format; - GLenum fb_type; int i; /* Right now GLX_SWAP_COPY_OML isn't supported, but it would be easy @@ -293,20 +291,27 @@ radeonFillInModes( __DRIscreenPrivate *psp, depth_buffer_factor = ((depth_bits != 0) || (stencil_bits != 0)) ? 2 : 1; back_buffer_factor = (have_back_buffer) ? 2 : 1; - if ( pixel_bits == 16 ) { - fb_format = GL_RGB; - fb_type = GL_UNSIGNED_SHORT_5_6_5; - } - else { - fb_format = GL_BGRA; - fb_type = GL_UNSIGNED_INT_8_8_8_8_REV; - } + if (pixel_bits == 16) { + __DRIconfig **configs_a8r8g8b8; + __DRIconfig **configs_r5g6b5; + + configs_r5g6b5 = driCreateConfigs(GL_RGB, GL_UNSIGNED_SHORT_5_6_5, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, back_buffer_modes, + back_buffer_factor, msaa_samples_array, + 1); + configs_a8r8g8b8 = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + depth_bits_array, stencil_bits_array, + 1, back_buffer_modes, 1, + msaa_samples_array, 1); + configs = driConcatConfigs(configs_r5g6b5, configs_a8r8g8b8); + } else + configs = driCreateConfigs(GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, + depth_bits_array, stencil_bits_array, + depth_buffer_factor, + back_buffer_modes, back_buffer_factor, + msaa_samples_array, 1); - configs = driCreateConfigs(fb_format, fb_type, - depth_bits_array, stencil_bits_array, - depth_buffer_factor, - back_buffer_modes, back_buffer_factor, - msaa_samples_array, 1); if (configs == NULL) { fprintf( stderr, "[%s:%u] Error creating FBConfig!\n", __func__, __LINE__ ); -- cgit v1.2.3