#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
#include "drivers/common/meta.h"
+#include "util/bitscan.h"
#include "radeon_common.h"
#include "radeon_mipmap_tree.h"
if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)R200_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- 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;
- }
+ GLbitfield mask = ctx->Light._EnabledLights;
+ while (mask) {
+ const int p = u_bit_scan(&mask);
+ struct gl_light *l = &ctx->Light.Light[p];
+ GLfloat *fcmd = (GLfloat *)R200_DB_STATE( lit[p] );
+
+ if (l->EyePosition[3] == 0.0) {
+ COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
+ COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
+ fcmd[LIT_POSITION_W] = 0;
+ fcmd[LIT_DIRECTION_W] = 0;
+ } else {
+ COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
+ 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;
+ }
- R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
+ R200_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
}
}
}
#include "tnl/t_pipeline.h"
#include "swrast_setup/swrast_setup.h"
#include "drivers/common/meta.h"
+#include "util/bitscan.h"
#include "radeon_context.h"
#include "radeon_mipmap_tree.h"
if (ctx->Light.Enabled) {
- GLint p;
- for (p = 0 ; p < MAX_LIGHTS; p++) {
- if (ctx->Light.Light[p].Enabled) {
- struct gl_light *l = &ctx->Light.Light[p];
- GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( lit[p] );
-
- if (l->EyePosition[3] == 0.0) {
- COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
- COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
- fcmd[LIT_POSITION_W] = 0;
- fcmd[LIT_DIRECTION_W] = 0;
- } else {
- COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
- 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;
- }
-
- RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
- }
+ GLbitfield mask = ctx->Light._EnabledLights;
+ while (mask) {
+ const int p = u_bit_scan(&mask);
+ struct gl_light *l = &ctx->Light.Light[p];
+ GLfloat *fcmd = (GLfloat *)RADEON_DB_STATE( lit[p] );
+
+ if (l->EyePosition[3] == 0.0) {
+ COPY_3FV( &fcmd[LIT_POSITION_X], l->_VP_inf_norm );
+ COPY_3FV( &fcmd[LIT_DIRECTION_X], l->_h_inf_norm );
+ fcmd[LIT_POSITION_W] = 0;
+ fcmd[LIT_DIRECTION_W] = 0;
+ } else {
+ COPY_4V( &fcmd[LIT_POSITION_X], l->_Position );
+ 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;
+ }
+
+ RADEON_DB_STATECHANGE( rmesa, &rmesa->hw.lit[p] );
}
}
}