diff options
author | marha <marha@users.sourceforge.net> | 2014-04-23 22:47:55 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-04-23 22:47:55 +0200 |
commit | 24fb0da18f1c44dfa1f76d8cde8efbb958aa7659 (patch) | |
tree | 76157bb2f88c9383b0824476a9e3a9f9a1bff9fa /mesalib/src/mesa/state_tracker/st_atom_framebuffer.c | |
parent | 6876c31f186414ce975180af79902314c8cdc82a (diff) | |
parent | d26ea2f474c48afa7d3c261572da5d85b7b62bd8 (diff) | |
download | vcxsrv-24fb0da18f1c44dfa1f76d8cde8efbb958aa7659.tar.gz vcxsrv-24fb0da18f1c44dfa1f76d8cde8efbb958aa7659.tar.bz2 vcxsrv-24fb0da18f1c44dfa1f76d8cde8efbb958aa7659.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
mesalib/include/GL/glext.h
xorg-server/.gitignore
xorg-server/glx/glxext.c
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_atom_framebuffer.c')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_framebuffer.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c index 4c4f839d1..a17417c35 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c @@ -31,6 +31,8 @@ * Brian Paul */ +#include <limits.h> + #include "st_context.h" #include "st_atom.h" #include "st_cb_bitmap.h" @@ -44,6 +46,26 @@ /** + * Update framebuffer size. + * + * We need to derive pipe_framebuffer size from the bound pipe_surfaces here + * instead of copying gl_framebuffer size because for certain target types + * (like PIPE_TEXTURE_1D_ARRAY) gl_framebuffer::Height has the number of layers + * instead of 1. + */ +static void +update_framebuffer_size(struct pipe_framebuffer_state *framebuffer, + struct pipe_surface *surface) +{ + assert(surface); + assert(surface->width < UINT_MAX); + assert(surface->height < UINT_MAX); + framebuffer->width = MIN2(framebuffer->width, surface->width); + framebuffer->height = MIN2(framebuffer->height, surface->height); +} + + +/** * Update framebuffer state (color, depth, stencil, etc. buffers) */ static void @@ -57,8 +79,8 @@ update_framebuffer_state( struct st_context *st ) st_flush_bitmap_cache(st); st->state.fb_orientation = st_fb_orientation(fb); - framebuffer->width = fb->Width; - framebuffer->height = fb->Height; + framebuffer->width = UINT_MAX; + framebuffer->height = UINT_MAX; /*printf("------ fb size %d x %d\n", fb->Width, fb->Height);*/ @@ -81,6 +103,7 @@ update_framebuffer_state( struct st_context *st ) if (strb->surface) { pipe_surface_reference(&framebuffer->cbufs[i], strb->surface); + update_framebuffer_size(framebuffer, strb->surface); } strb->defined = GL_TRUE; /* we'll be drawing something */ } @@ -100,12 +123,14 @@ update_framebuffer_state( struct st_context *st ) st_update_renderbuffer_surface(st, strb); } pipe_surface_reference(&framebuffer->zsbuf, strb->surface); + update_framebuffer_size(framebuffer, strb->surface); } else { strb = st_renderbuffer(fb->Attachment[BUFFER_STENCIL].Renderbuffer); if (strb) { assert(strb->surface); pipe_surface_reference(&framebuffer->zsbuf, strb->surface); + update_framebuffer_size(framebuffer, strb->surface); } else pipe_surface_reference(&framebuffer->zsbuf, NULL); @@ -122,6 +147,12 @@ update_framebuffer_state( struct st_context *st ) } #endif + /* _mesa_test_framebuffer_completeness refuses framebuffers with no + * attachments, so this should never happen. + */ + assert(framebuffer->width != UINT_MAX); + assert(framebuffer->height != UINT_MAX); + cso_set_framebuffer(st->cso_context, framebuffer); } |