diff options
Diffstat (limited to 'mesalib/src')
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/pack.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom.c | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom.h | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_sampler.c | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_texture.c | 36 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_bitmap.c | 11 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.c | 15 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_context.h | 13 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 6 |
11 files changed, 71 insertions, 48 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index ca01a3301..db49d90ea 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -3162,7 +3162,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, static GLenum get_temp_image_type(struct gl_context *ctx, gl_format format) { - GLenum baseFormat, type; + GLenum baseFormat; baseFormat = _mesa_get_format_base_format(format); diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index aa8ba1882..792a92da3 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -2564,6 +2564,8 @@ _mesa_GenerateMipmapEXT(GLenum target) srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); if (!srcImage) { _mesa_unlock_texture(ctx, texObj); + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGenerateMipmap(zero size base image)"); return; } diff --git a/mesalib/src/mesa/main/pack.c b/mesalib/src/mesa/main/pack.c index 7aebd45ea..4c99199d9 100644 --- a/mesalib/src/mesa/main/pack.c +++ b/mesalib/src/mesa/main/pack.c @@ -926,7 +926,7 @@ _mesa_pack_rgba_span_from_ints(struct gl_context *ctx, GLuint n, GLint rgba[][4] break; case GL_INT: /* No conversion necessary. */ - pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); + pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, (GLuint (*)[4]) rgba, n); break; case GL_UNSIGNED_SHORT: pack_ushort_from_int_rgba(ctx, dstAddr, dstFormat, rgba, n); diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c index e6fc114f1..102fee93b 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.c +++ b/mesalib/src/mesa/state_tracker/st_atom.c @@ -57,7 +57,8 @@ static const struct st_tracked_state *atoms[] = &st_update_blend, &st_update_sampler, &st_update_vertex_texture, - &st_update_texture, + &st_update_fragment_texture, + &st_update_geometry_texture, &st_update_framebuffer, &st_update_msaa, &st_update_vs_constants, diff --git a/mesalib/src/mesa/state_tracker/st_atom.h b/mesalib/src/mesa/state_tracker/st_atom.h index 703bc2ab3..6c7d09fba 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.h +++ b/mesalib/src/mesa/state_tracker/st_atom.h @@ -60,8 +60,9 @@ extern const struct st_tracked_state st_update_scissor; extern const struct st_tracked_state st_update_blend; extern const struct st_tracked_state st_update_msaa; extern const struct st_tracked_state st_update_sampler; -extern const struct st_tracked_state st_update_texture; +extern const struct st_tracked_state st_update_fragment_texture; extern const struct st_tracked_state st_update_vertex_texture; +extern const struct st_tracked_state st_update_geometry_texture; extern const struct st_tracked_state st_finalize_textures; extern const struct st_tracked_state st_update_fs_constants; extern const struct st_tracked_state st_update_gs_constants; diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c index f39fd7551..adcc7b505 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c +++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c @@ -253,24 +253,24 @@ update_samplers(struct st_context *st) PIPE_SHADER_FRAGMENT, &ctx->FragmentProgram._Current->Base, ctx->Const.MaxTextureImageUnits, - st->state.fragment_samplers, - &st->state.num_fragment_samplers); + st->state.samplers[PIPE_SHADER_FRAGMENT], + &st->state.num_samplers[PIPE_SHADER_FRAGMENT]); update_shader_samplers(st, PIPE_SHADER_VERTEX, &ctx->VertexProgram._Current->Base, ctx->Const.MaxVertexTextureImageUnits, - st->state.vertex_samplers, - &st->state.num_vertex_samplers); - -/* - update_shader_samplers(st, - PIPE_SHADER_GEOMETRY, - &ctx->GeometryProgram._Current->Base, - ctx->Const.MaxGeometryTextureImageUnits, - st->state.geometry_samplers, - &st->state.num_geometry_samplers); -*/ + st->state.samplers[PIPE_SHADER_VERTEX], + &st->state.num_samplers[PIPE_SHADER_VERTEX]); + + if (ctx->GeometryProgram._Current) { + update_shader_samplers(st, + PIPE_SHADER_GEOMETRY, + &ctx->GeometryProgram._Current->Base, + ctx->Const.MaxGeometryTextureImageUnits, + st->state.samplers[PIPE_SHADER_GEOMETRY], + &st->state.num_samplers[PIPE_SHADER_GEOMETRY]); + } } diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c index e88675d4e..6e2efd960 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_texture.c +++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c @@ -312,8 +312,8 @@ update_vertex_textures(struct st_context *st) PIPE_SHADER_VERTEX, &ctx->VertexProgram._Current->Base, ctx->Const.MaxVertexTextureImageUnits, - st->state.vertex_sampler_views, - &st->state.num_vertex_textures); + st->state.sampler_views[PIPE_SHADER_VERTEX], + &st->state.num_sampler_views[PIPE_SHADER_VERTEX]); } } @@ -327,12 +327,28 @@ update_fragment_textures(struct st_context *st) PIPE_SHADER_FRAGMENT, &ctx->FragmentProgram._Current->Base, ctx->Const.MaxTextureImageUnits, - st->state.fragment_sampler_views, - &st->state.num_fragment_textures); + st->state.sampler_views[PIPE_SHADER_FRAGMENT], + &st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]); } -const struct st_tracked_state st_update_texture = { +static void +update_geometry_textures(struct st_context *st) +{ + const struct gl_context *ctx = st->ctx; + + if (ctx->GeometryProgram._Current) { + update_textures(st, + PIPE_SHADER_GEOMETRY, + &ctx->GeometryProgram._Current->Base, + ctx->Const.MaxTextureImageUnits, + st->state.sampler_views[PIPE_SHADER_GEOMETRY], + &st->state.num_sampler_views[PIPE_SHADER_GEOMETRY]); + } +} + + +const struct st_tracked_state st_update_fragment_texture = { "st_update_texture", /* name */ { /* dirty */ _NEW_TEXTURE, /* mesa */ @@ -352,6 +368,16 @@ const struct st_tracked_state st_update_vertex_texture = { }; +const struct st_tracked_state st_update_geometry_texture = { + "st_update_geometry_texture", /* name */ + { /* dirty */ + _NEW_TEXTURE, /* mesa */ + ST_NEW_GEOMETRY_PROGRAM, /* st */ + }, + update_geometry_textures /* update */ +}; + + static void finalize_textures(struct st_context *st) diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c index 7d9ccc1e5..dbd778b4f 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c +++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c @@ -481,10 +481,11 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, /* user samplers, plus our bitmap sampler */ { struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; - uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_fragment_samplers); + uint num = MAX2(fpv->bitmap_sampler + 1, + st->state.num_samplers[PIPE_SHADER_FRAGMENT]); uint i; - for (i = 0; i < st->state.num_fragment_samplers; i++) { - samplers[i] = &st->state.fragment_samplers[i]; + for (i = 0; i < st->state.num_samplers[PIPE_SHADER_FRAGMENT]; i++) { + samplers[i] = &st->state.samplers[PIPE_SHADER_FRAGMENT][i]; } samplers[fpv->bitmap_sampler] = &st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT]; @@ -496,8 +497,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, { struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; uint num = MAX2(fpv->bitmap_sampler + 1, - st->state.num_fragment_textures); - memcpy(sampler_views, st->state.fragment_sampler_views, + st->state.num_sampler_views[PIPE_SHADER_FRAGMENT]); + memcpy(sampler_views, st->state.sampler_views[PIPE_SHADER_FRAGMENT], sizeof(sampler_views)); sampler_views[fpv->bitmap_sampler] = sv; cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views); diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c index 2f9516178..7735eee4f 100644 --- a/mesalib/src/mesa/state_tracker/st_context.c +++ b/mesalib/src/mesa/state_tracker/st_context.c @@ -237,7 +237,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, static void st_destroy_context_priv( struct st_context *st ) { - uint i; + uint shader, i; st_destroy_atoms( st ); st_destroy_draw( st ); @@ -248,14 +248,11 @@ static void st_destroy_context_priv( struct st_context *st ) st_destroy_drawpix(st); st_destroy_drawtex(st); - for (i = 0; i < Elements(st->state.fragment_sampler_views); i++) { - pipe_sampler_view_release(st->pipe, - &st->state.fragment_sampler_views[i]); - } - - for (i = 0; i < Elements(st->state.vertex_sampler_views); i++) { - pipe_sampler_view_release(st->pipe, - &st->state.vertex_sampler_views[i]); + for (shader = 0; shader < Elements(st->state.sampler_views); shader++) { + for (i = 0; i < Elements(st->state.sampler_views[0]); i++) { + pipe_sampler_view_release(st->pipe, + &st->state.sampler_views[shader][i]); + } } if (st->default_texture) { diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h index 0dfd81c1b..47d3af520 100644 --- a/mesalib/src/mesa/state_tracker/st_context.h +++ b/mesalib/src/mesa/state_tracker/st_context.h @@ -98,25 +98,20 @@ struct st_context struct pipe_blend_state blend; struct pipe_depth_stencil_alpha_state depth_stencil; struct pipe_rasterizer_state rasterizer; - struct pipe_sampler_state fragment_samplers[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_state vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_sampler_state samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; + GLuint num_samplers[PIPE_SHADER_TYPES]; + struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS]; + GLuint num_sampler_views[PIPE_SHADER_TYPES]; struct pipe_clip_state clip; struct { void *ptr; unsigned size; } constants[PIPE_SHADER_TYPES]; struct pipe_framebuffer_state framebuffer; - struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS]; - struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_scissor_state scissor; struct pipe_viewport_state viewport; unsigned sample_mask; - GLuint num_fragment_samplers; - GLuint num_vertex_samplers; - GLuint num_fragment_textures; - GLuint num_vertex_textures; - GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */ GLuint fb_orientation; 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 39717b6fd..9146f24f3 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -4028,7 +4028,7 @@ dst_register(struct st_translate *t, static struct ureg_src src_register(struct st_translate *t, gl_register_file file, - GLuint index) + GLint index) { switch(file) { case PROGRAM_UNDEFINED: @@ -4036,7 +4036,7 @@ src_register(struct st_translate *t, case PROGRAM_TEMPORARY: assert(index >= 0); - assert(index < Elements(t->temps)); + assert(index < (int) Elements(t->temps)); if (ureg_dst_is_undef(t->temps[index])) t->temps[index] = ureg_DECL_local_temporary(t->ureg); return ureg_src(t->temps[index]); @@ -4069,7 +4069,7 @@ src_register(struct st_translate *t, return ureg_src(t->address[index]); case PROGRAM_SYSTEM_VALUE: - assert(index < Elements(t->systemValues)); + assert(index < (int) Elements(t->systemValues)); return t->systemValues[index]; default: |