[Mesa-dev] [PATCH 2/2] st/mesa: Only use "idx" after validating it in st_manager_add_color_renderbuffer().
Henri Verbeet
hverbeet at gmail.com
Wed Dec 25 03:41:58 PST 2013
In particular, we don't want it to be -1. In practice this is probably
unlikely to be an issue, since Attachment[-1] should still be a valid memory
location, and the code only reads it. No piglit regressions on AMD CEDAR.
Signed-off-by: Henri Verbeet <hverbeet at gmail.com>
---
src/mesa/state_tracker/st_manager.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index 8158450..26bf37e 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -834,9 +834,6 @@ st_manager_add_color_renderbuffer(struct st_context *st,
if (!stfb)
return FALSE;
- if (stfb->Base.Attachment[idx].Renderbuffer)
- return TRUE;
-
switch (idx) {
case BUFFER_FRONT_LEFT:
case BUFFER_BACK_LEFT:
@@ -848,6 +845,9 @@ st_manager_add_color_renderbuffer(struct st_context *st,
break;
}
+ if (stfb->Base.Attachment[idx].Renderbuffer)
+ return TRUE;
+
if (!st_framebuffer_add_renderbuffer(stfb, idx))
return FALSE;
--
1.7.10.4
More information about the mesa-dev
mailing list