From: Brian Paul Date: Mon, 22 Feb 2010 15:04:39 +0000 (-0700) Subject: st/mesa: Add checks for ST_SURFACE_x vs MESA_BUFFER_x X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=504e297a2c395d136ff73279db28cc9de3303c2d;p=mesa.git st/mesa: Add checks for ST_SURFACE_x vs MESA_BUFFER_x The ST_SURFACE_x values should match the Mesa BUFFER_x values. Added some assertions to prevent future mix-ups. (cherry picked from commit 13cbb5fff68ef8831230638e9f0b29a217750e9d) --- diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 4e225a123c8..1d35e8d6574 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -160,6 +160,7 @@ void st_unreference_framebuffer( struct st_framebuffer *stfb ) * Set/replace a framebuffer surface. * The user of the state tracker can use this instead of * st_resize_framebuffer() to provide new surfaces when a window is resized. + * \param surfIndex an ST_SURFACE_x index */ void st_set_framebuffer_surface(struct st_framebuffer *stfb, @@ -170,6 +171,13 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, struct st_renderbuffer *strb; GLuint width, height, i; + /* sanity checks */ + assert(ST_SURFACE_FRONT_LEFT == BUFFER_FRONT_LEFT); + assert(ST_SURFACE_BACK_LEFT == BUFFER_BACK_LEFT); + assert(ST_SURFACE_FRONT_RIGHT == BUFFER_FRONT_RIGHT); + assert(ST_SURFACE_BACK_RIGHT == BUFFER_BACK_RIGHT); + assert(ST_SURFACE_DEPTH == BUFFER_DEPTH); + assert(surfIndex < BUFFER_COUNT); strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); diff --git a/src/mesa/state_tracker/st_public.h b/src/mesa/state_tracker/st_public.h index 5c9a8550db1..0824356cecc 100644 --- a/src/mesa/state_tracker/st_public.h +++ b/src/mesa/state_tracker/st_public.h @@ -34,7 +34,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_format.h" - +/** Renderbuffer surfaces (should match Mesa names) */ #define ST_SURFACE_FRONT_LEFT 0 #define ST_SURFACE_BACK_LEFT 1 #define ST_SURFACE_FRONT_RIGHT 2