summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-03-24 10:35:40 -0600
committerBrian Paul <brianp@vmware.com>2009-04-03 09:07:03 -0600
commitd5346a925c569d959eb9ebedda95fdddb9d5350c (patch)
tree3b0e525db3ecb66199fae4231480185bf4a1610a
parent5d7f3ae15c62d46e8857c159978c1c75e07cc59b (diff)
i965: comments, clean-up in prepare_wm_surfaces()
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 2f1f4c55f9..1fc537ca20 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -477,7 +477,8 @@ static void prepare_wm_surfaces(struct brw_context *brw )
GLuint i;
int old_nr_surfaces;
- if (brw->state.nr_color_regions > 1) {
+ /* Update surfaces for drawing buffers */
+ if (brw->state.nr_color_regions > 1) {
for (i = 0; i < brw->state.nr_color_regions; i++) {
brw_update_region_surface(brw, brw->state.color_regions[i], i,
GL_FALSE);
@@ -489,25 +490,28 @@ static void prepare_wm_surfaces(struct brw_context *brw )
old_nr_surfaces = brw->wm.nr_surfaces;
brw->wm.nr_surfaces = MAX_DRAW_BUFFERS;
+ /* Update surfaces for textures */
for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
- struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+ const GLuint j = MAX_DRAW_BUFFERS + i;
/* _NEW_TEXTURE, BRW_NEW_TEXDATA */
- if(texUnit->_ReallyEnabled) {
+ if (texUnit->_ReallyEnabled) {
if (texUnit->_Current == intel->frame_buffer_texobj) {
- dri_bo_unreference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]);
- brw->wm.surf_bo[i+MAX_DRAW_BUFFERS] = brw->wm.surf_bo[0];
- dri_bo_reference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]);
- brw->wm.nr_surfaces = i + MAX_DRAW_BUFFERS + 1;
+ /* render to texture */
+ dri_bo_unreference(brw->wm.surf_bo[j]);
+ brw->wm.surf_bo[j] = brw->wm.surf_bo[0];
+ dri_bo_reference(brw->wm.surf_bo[j]);
+ brw->wm.nr_surfaces = j + 1;
} else {
+ /* regular texture */
brw_update_texture_surface(ctx, i);
- brw->wm.nr_surfaces = i + MAX_DRAW_BUFFERS + 1;
+ brw->wm.nr_surfaces = j + 1;
}
} else {
- dri_bo_unreference(brw->wm.surf_bo[i+MAX_DRAW_BUFFERS]);
- brw->wm.surf_bo[i+MAX_DRAW_BUFFERS] = NULL;
+ dri_bo_unreference(brw->wm.surf_bo[j]);
+ brw->wm.surf_bo[j] = NULL;
}
-
}
dri_bo_unreference(brw->wm.bind_bo);