diff options
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_framebuffer.c | 35 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 5 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_texture.c | 6 |
4 files changed, 44 insertions, 6 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); } diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 059989342..70726886e 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -635,6 +635,8 @@ void st_init_extensions(struct st_context *st) if (!st->options.disable_shader_bit_encoding) { ctx->Extensions.ARB_shader_bit_encoding = GL_TRUE; } + + ctx->Extensions.EXT_shader_integer_mix = GL_TRUE; } else { /* Optional integer support for GLSL 1.2. */ if (screen->get_shader_param(screen, PIPE_SHADER_VERTEX, @@ -642,6 +644,8 @@ void st_init_extensions(struct st_context *st) screen->get_shader_param(screen, PIPE_SHADER_FRAGMENT, PIPE_SHADER_CAP_INTEGERS)) { ctx->Const.NativeIntegers = GL_TRUE; + + ctx->Extensions.EXT_shader_integer_mix = GL_TRUE; } } diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index edd0aa765..15b5279b8 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -632,7 +632,10 @@ glsl_to_tgsi_visitor::get_opcode(ir_instruction *ir, unsigned op, st_src_reg src0, st_src_reg src1) { int type = GLSL_TYPE_FLOAT; - + + if (op == TGSI_OPCODE_MOV) + return op; + assert(src0.type != GLSL_TYPE_ARRAY); assert(src0.type != GLSL_TYPE_STRUCT); assert(src1.type != GLSL_TYPE_ARRAY); diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index f664ef5f1..92035e801 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -443,7 +443,7 @@ struct pipe_sampler_view ** st_texture_get_sampler_view(struct st_context *st, struct st_texture_object *stObj) { - struct pipe_sampler_view **used = NULL, **free = NULL; + struct pipe_sampler_view *used = NULL, **free = NULL; GLuint i; for (i = 0; i < stObj->num_sampler_views; ++i) { @@ -455,7 +455,7 @@ st_texture_get_sampler_view(struct st_context *st, return sv; /* Wasn't the right one, but remember it as template */ - used = sv; + used = *sv; } else { /* Found a free slot, remember that */ free = sv; @@ -475,7 +475,7 @@ st_texture_get_sampler_view(struct st_context *st, /* Add just any sampler view to be used as a template */ if (used) - pipe_sampler_view_reference(free, *used); + pipe_sampler_view_reference(free, used); return free; } |