diff options
author | marha <marha@users.sourceforge.net> | 2014-05-01 16:56:41 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-05-01 16:56:41 +0200 |
commit | ea0cd87ecbe9fc3c5503ccad7f87a895a458d6d4 (patch) | |
tree | a961f21249024edee920dc41bb54b2507cf08696 /mesalib/src/mesa/state_tracker | |
parent | 03418d6378fe72bea2ff4b941792054dd208b65d (diff) | |
download | vcxsrv-ea0cd87ecbe9fc3c5503ccad7f87a895a458d6d4.tar.gz vcxsrv-ea0cd87ecbe9fc3c5503ccad7f87a895a458d6d4.tar.bz2 vcxsrv-ea0cd87ecbe9fc3c5503ccad7f87a895a458d6d4.zip |
xkeyboard-config libxcb xserver mesa git update 1 May 2014
xserver commit 2535b76c0d32bc1dd0ddaca06a419a68a4757df1
libxcb commit d978a4f69b30b630f28d07f1003cf290284d24d8
xkeyboard-config commit 5274a69ee85fb6c425c33c631fa8ea1310a8f097
mesa commit a773fdc64da8ba88d8c7f8e383c45248b0c3aa19
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom.h | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_framebuffer.c | 15 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_msaa.c | 23 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_clear.c | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_drawtex.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_extensions.c | 3 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 91 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_manager.c | 11 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_program.c | 21 |
11 files changed, 137 insertions, 40 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_atom.c b/mesalib/src/mesa/state_tracker/st_atom.c index 99e9df26b..625ea2965 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.c +++ b/mesalib/src/mesa/state_tracker/st_atom.c @@ -61,6 +61,7 @@ static const struct st_tracked_state *atoms[] = &st_update_sampler, /* depends on update_*_texture for swizzle */ &st_update_framebuffer, &st_update_msaa, + &st_update_sample_shading, &st_update_vs_constants, &st_update_gs_constants, &st_update_fs_constants, diff --git a/mesalib/src/mesa/state_tracker/st_atom.h b/mesalib/src/mesa/state_tracker/st_atom.h index 60d89d75f..c50111d50 100644 --- a/mesalib/src/mesa/state_tracker/st_atom.h +++ b/mesalib/src/mesa/state_tracker/st_atom.h @@ -59,6 +59,7 @@ extern const struct st_tracked_state st_update_viewport; 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_sample_shading; extern const struct st_tracked_state st_update_sampler; extern const struct st_tracked_state st_update_fragment_texture; extern const struct st_tracked_state st_update_vertex_texture; diff --git a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c index a17417c35..b195c55b3 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_framebuffer.c @@ -113,6 +113,12 @@ update_framebuffer_state( struct st_context *st ) pipe_surface_reference(&framebuffer->cbufs[i], NULL); } + /* Remove trailing GL_NONE draw buffers. */ + while (framebuffer->nr_cbufs && + !framebuffer->cbufs[framebuffer->nr_cbufs-1]) { + framebuffer->nr_cbufs--; + } + /* * Depth/Stencil renderbuffer/surface. */ @@ -147,11 +153,10 @@ 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); + if (framebuffer->width == UINT_MAX) + framebuffer->width = 0; + if (framebuffer->height == UINT_MAX) + framebuffer->height = 0; cso_set_framebuffer(st->cso_context, framebuffer); } diff --git a/mesalib/src/mesa/state_tracker/st_atom_msaa.c b/mesalib/src/mesa/state_tracker/st_atom_msaa.c index 2f3a42e02..703cb5e75 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_msaa.c +++ b/mesalib/src/mesa/state_tracker/st_atom_msaa.c @@ -27,8 +27,10 @@ #include "st_context.h" +#include "pipe/p_screen.h" #include "pipe/p_context.h" #include "st_atom.h" +#include "st_program.h" #include "cso_cache/cso_context.h" #include "util/u_framebuffer.h" @@ -70,6 +72,18 @@ static void update_sample_mask( struct st_context *st ) } } +static void update_sample_shading( struct st_context *st ) +{ + if (!st->fp) + return; + + if (!st->ctx->Extensions.ARB_sample_shading) + return; + + cso_set_min_samples( + st->cso_context, + _mesa_get_min_invocations_per_fragment(st->ctx, &st->fp->Base, false)); +} const struct st_tracked_state st_update_msaa = { "st_update_msaa", /* name */ @@ -79,3 +93,12 @@ const struct st_tracked_state st_update_msaa = { }, update_sample_mask /* update */ }; + +const struct st_tracked_state st_update_sample_shading = { + "st_update_sample_shading", /* name */ + { /* dirty */ + (_NEW_MULTISAMPLE | _NEW_PROGRAM | _NEW_BUFFERS), /* mesa */ + ST_NEW_FRAGMENT_PROGRAM | ST_NEW_FRAMEBUFFER, /* st */ + }, + update_sample_shading /* update */ +}; diff --git a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c index 306eeb153..a04163cc1 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -121,7 +121,7 @@ load_color_map_texture(struct gl_context *ctx, struct pipe_resource *pt) rgba[2] = ctx->PixelMaps.BtoB.Map[j * bSize / texSize]; rgba[3] = ctx->PixelMaps.AtoA.Map[i * aSize / texSize]; util_pack_color(rgba, pt->format, &uc); - *(dest + k) = uc.ui; + *(dest + k) = uc.ui[0]; } } diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c index fcd7e1382..371f7fcda 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_clear.c +++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c @@ -240,6 +240,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) cso_save_depth_stencil_alpha(st->cso_context); cso_save_rasterizer(st->cso_context); cso_save_sample_mask(st->cso_context); + cso_save_min_samples(st->cso_context); cso_save_viewport(st->cso_context); cso_save_fragment_shader(st->cso_context); cso_save_stream_outputs(st->cso_context); @@ -309,6 +310,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw); cso_set_stream_outputs(st->cso_context, 0, NULL, NULL); cso_set_sample_mask(st->cso_context, ~0); + cso_set_min_samples(st->cso_context, 1); cso_set_rasterizer(st->cso_context, &st->clear.raster); /* viewport state: viewport matching window dims */ @@ -348,6 +350,7 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers) cso_restore_depth_stencil_alpha(st->cso_context); cso_restore_rasterizer(st->cso_context); cso_restore_sample_mask(st->cso_context); + cso_restore_min_samples(st->cso_context); cso_restore_viewport(st->cso_context); cso_restore_fragment_shader(st->cso_context); cso_restore_vertex_shader(st->cso_context); diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c index b0a44fd90..f997e6b00 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_drawtex.c +++ b/mesalib/src/mesa/state_tracker/st_cb_drawtex.c @@ -123,7 +123,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, /* determine how many enabled sets of texcoords */ numTexCoords = 0; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) { + if (ctx->Texture.Unit[i]._Current && + ctx->Texture.Unit[i]._Current->Target == GL_TEXTURE_2D) { numTexCoords++; } } @@ -192,7 +193,8 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, /* texcoords */ for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { - if (ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_2D_BIT) { + if (ctx->Texture.Unit[i]._Current && + ctx->Texture.Unit[i]._Current->Target == GL_TEXTURE_2D) { struct gl_texture_object *obj = ctx->Texture.Unit[i]._Current; struct gl_texture_image *img = obj->Image[0][obj->BaseLevel]; const GLfloat wt = (GLfloat) img->Width; diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 70726886e..a245fdf18 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -425,7 +425,8 @@ void st_init_extensions(struct st_context *st) { o(OES_standard_derivatives), PIPE_CAP_SM3 }, { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY }, { o(ARB_texture_multisample), PIPE_CAP_TEXTURE_MULTISAMPLE }, - { o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD } + { o(ARB_texture_query_lod), PIPE_CAP_TEXTURE_QUERY_LOD }, + { o(ARB_sample_shading), PIPE_CAP_SAMPLE_SHADING }, }; /* Required: render target and sampler support */ 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 15b5279b8..d1c3856b5 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -241,7 +241,7 @@ public: unsigned op; st_dst_reg dst; - st_src_reg src[3]; + st_src_reg src[4]; /** Pointer to the ir source this tree came from for debugging */ ir_instruction *ir; GLboolean cond_update; @@ -411,7 +411,12 @@ public: glsl_to_tgsi_instruction *emit(ir_instruction *ir, unsigned op, st_dst_reg dst, st_src_reg src0, st_src_reg src1, st_src_reg src2); - + + glsl_to_tgsi_instruction *emit(ir_instruction *ir, unsigned op, + st_dst_reg dst, + st_src_reg src0, st_src_reg src1, + st_src_reg src2, st_src_reg src3); + unsigned get_opcode(ir_instruction *ir, unsigned op, st_dst_reg dst, st_src_reg src0, st_src_reg src1); @@ -524,8 +529,9 @@ num_inst_src_regs(unsigned opcode) glsl_to_tgsi_instruction * glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, - st_dst_reg dst, - st_src_reg src0, st_src_reg src1, st_src_reg src2) + st_dst_reg dst, + st_src_reg src0, st_src_reg src1, + st_src_reg src2, st_src_reg src3) { glsl_to_tgsi_instruction *inst = new(mem_ctx) glsl_to_tgsi_instruction(); int num_reladdr = 0, i; @@ -540,7 +546,9 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, num_reladdr += src0.reladdr != NULL || src0.reladdr2 != NULL; num_reladdr += src1.reladdr != NULL || src1.reladdr2 != NULL; num_reladdr += src2.reladdr != NULL || src2.reladdr2 != NULL; + num_reladdr += src3.reladdr != NULL || src3.reladdr2 != NULL; + reladdr_to_temp(ir, &src3, &num_reladdr); reladdr_to_temp(ir, &src2, &num_reladdr); reladdr_to_temp(ir, &src1, &num_reladdr); reladdr_to_temp(ir, &src0, &num_reladdr); @@ -556,6 +564,7 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, inst->src[0] = src0; inst->src[1] = src1; inst->src[2] = src2; + inst->src[3] = src3; inst->ir = ir; inst->dead_mask = 0; @@ -577,7 +586,7 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, } } else { - for (i=0; i<3; i++) { + for (i=0; i<4; i++) { if(inst->src[i].reladdr) { switch(inst->src[i].file) { case PROGRAM_STATE_VAR: @@ -600,12 +609,19 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, return inst; } +glsl_to_tgsi_instruction * +glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, + st_dst_reg dst, st_src_reg src0, + st_src_reg src1, st_src_reg src2) +{ + return emit(ir, op, dst, src0, src1, src2, undef_src); +} glsl_to_tgsi_instruction * glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, st_dst_reg dst, st_src_reg src0, st_src_reg src1) { - return emit(ir, op, dst, src0, src1, undef_src); + return emit(ir, op, dst, src0, src1, undef_src, undef_src); } glsl_to_tgsi_instruction * @@ -613,13 +629,13 @@ glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op, st_dst_reg dst, st_src_reg src0) { assert(dst.writemask != 0); - return emit(ir, op, dst, src0, undef_src, undef_src); + return emit(ir, op, dst, src0, undef_src, undef_src, undef_src); } glsl_to_tgsi_instruction * glsl_to_tgsi_visitor::emit(ir_instruction *ir, unsigned op) { - return emit(ir, op, undef_dst, undef_src, undef_src, undef_src); + return emit(ir, op, undef_dst, undef_src, undef_src, undef_src, undef_src); } /** @@ -690,7 +706,10 @@ glsl_to_tgsi_visitor::get_opcode(ir_instruction *ir, unsigned op, case2fi(SSG, ISSG); case3(ABS, IABS, IABS); - + + case2iu(IBFE, UBFE); + case2iu(IMSB, UMSB); + case2iu(IMUL_HI, UMUL_HI); default: break; } @@ -1934,6 +1953,33 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) emit(ir, TGSI_OPCODE_CMP, result_dst, op[0], op[1], op[2]); } break; + case ir_triop_bitfield_extract: + emit(ir, TGSI_OPCODE_IBFE, result_dst, op[0], op[1], op[2]); + break; + case ir_quadop_bitfield_insert: + emit(ir, TGSI_OPCODE_BFI, result_dst, op[0], op[1], op[2], op[3]); + break; + case ir_unop_bitfield_reverse: + emit(ir, TGSI_OPCODE_BREV, result_dst, op[0]); + break; + case ir_unop_bit_count: + emit(ir, TGSI_OPCODE_POPC, result_dst, op[0]); + break; + case ir_unop_find_msb: + emit(ir, TGSI_OPCODE_IMSB, result_dst, op[0]); + break; + case ir_unop_find_lsb: + emit(ir, TGSI_OPCODE_LSB, result_dst, op[0]); + break; + case ir_binop_imul_high: + emit(ir, TGSI_OPCODE_IMUL_HI, result_dst, op[0], op[1]); + break; + case ir_triop_fma: + /* NOTE: Perhaps there should be a special opcode that enforces fused + * mul-add. Just use MAD for now. + */ + emit(ir, TGSI_OPCODE_MAD, result_dst, op[0], op[1], op[2]); + break; case ir_unop_pack_snorm_2x16: case ir_unop_pack_unorm_2x16: case ir_unop_pack_half_2x16: @@ -1947,22 +1993,14 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir) case ir_unop_unpack_snorm_4x8: case ir_unop_unpack_unorm_4x8: case ir_binop_pack_half_2x16_split: - case ir_unop_bitfield_reverse: - case ir_unop_bit_count: - case ir_unop_find_msb: - case ir_unop_find_lsb: case ir_binop_bfm: - case ir_triop_fma: case ir_triop_bfi: - case ir_triop_bitfield_extract: - case ir_quadop_bitfield_insert: case ir_quadop_vector: case ir_binop_vector_extract: case ir_triop_vector_insert: case ir_binop_ldexp: case ir_binop_carry: case ir_binop_borrow: - case ir_binop_imul_high: /* This operation is not supported, or should have already been handled. */ assert(!"Invalid ir opcode in glsl_to_tgsi_visitor::visit()"); @@ -4163,7 +4201,11 @@ struct st_translate { static unsigned mesa_sysval_to_semantic[SYSTEM_VALUE_MAX] = { TGSI_SEMANTIC_FACE, TGSI_SEMANTIC_VERTEXID, - TGSI_SEMANTIC_INSTANCEID + TGSI_SEMANTIC_INSTANCEID, + TGSI_SEMANTIC_SAMPLEID, + TGSI_SEMANTIC_SAMPLEPOS, + TGSI_SEMANTIC_SAMPLEMASK, + TGSI_SEMANTIC_INVOCATIONID, }; /** @@ -4381,7 +4423,8 @@ translate_dst(struct st_translate *t, break; case TGSI_PROCESSOR_FRAGMENT: - if (dst_reg->index >= FRAG_RESULT_COLOR) { + if (dst_reg->index == FRAG_RESULT_COLOR || + dst_reg->index >= FRAG_RESULT_DATA0) { dst = ureg_saturate(dst); } break; @@ -4876,6 +4919,15 @@ st_translate_program( TGSI_SEMANTIC_COLOR, outputSemanticIndex[i]); break; + case TGSI_SEMANTIC_SAMPLEMASK: + t->outputs[i] = ureg_DECL_output(ureg, + TGSI_SEMANTIC_SAMPLEMASK, + outputSemanticIndex[i]); + /* TODO: If we ever support more than 32 samples, this will have + * to become an array. + */ + t->outputs[i] = ureg_writemask(t->outputs[i], TGSI_WRITEMASK_X); + break; default: assert(!"fragment shader outputs must be POSITION/STENCIL/COLOR"); ret = PIPE_ERROR_BAD_INPUT; @@ -5343,6 +5395,7 @@ st_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) DIV_TO_MUL_RCP | EXP_TO_EXP2 | LOG_TO_LOG2 | + LDEXP_TO_ARITH | (options->EmitNoPow ? POW_TO_EXP2 : 0) | (!ctx->Const.NativeIntegers ? INT_DIV_TO_MUL_RCP : 0)); diff --git a/mesalib/src/mesa/state_tracker/st_manager.c b/mesalib/src/mesa/state_tracker/st_manager.c index 314d34232..706af7fd1 100644 --- a/mesalib/src/mesa/state_tracker/st_manager.c +++ b/mesalib/src/mesa/state_tracker/st_manager.c @@ -183,8 +183,13 @@ st_framebuffer_validate(struct st_framebuffer *stfb, uint width, height; unsigned i; boolean changed = FALSE; - int32_t new_stamp = p_atomic_read(&stfb->iface->stamp); + int32_t new_stamp; + /* Check for incomplete framebuffers (e.g. EGL_KHR_surfaceless_context) */ + if (!stfb->iface) + return; + + new_stamp = p_atomic_read(&stfb->iface->stamp); if (stfb->iface_stamp == new_stamp) return; @@ -663,13 +668,11 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi, } if (attribs->flags & ST_CONTEXT_FLAG_DEBUG){ - struct gl_debug_state *debug = _mesa_get_debug_state(st->ctx); - if (!debug) { + if (!_mesa_set_debug_state_int(st->ctx, GL_DEBUG_OUTPUT, GL_TRUE)) { *error = ST_CONTEXT_ERROR_NO_MEMORY; return NULL; } st->ctx->Const.ContextFlags |= GL_CONTEXT_FLAG_DEBUG_BIT; - debug->DebugOutput = GL_TRUE; } if (attribs->flags & ST_CONTEXT_FLAG_FORWARD_COMPATIBLE) diff --git a/mesalib/src/mesa/state_tracker/st_program.c b/mesalib/src/mesa/state_tracker/st_program.c index 2f0ec32f5..f9887a2c4 100644 --- a/mesalib/src/mesa/state_tracker/st_program.c +++ b/mesalib/src/mesa/state_tracker/st_program.c @@ -682,6 +682,7 @@ st_translate_fragment_program(struct st_context *st, /* handle remaining outputs (color) */ for (attr = 0; attr < FRAG_RESULT_MAX; attr++) { if (outputsWritten & BITFIELD64_BIT(attr)) { + int semantic = TGSI_SEMANTIC_COLOR; switch (attr) { case FRAG_RESULT_DEPTH: case FRAG_RESULT_STENCIL: @@ -689,17 +690,21 @@ st_translate_fragment_program(struct st_context *st, assert(0); break; case FRAG_RESULT_COLOR: - write_all = GL_TRUE; /* fallthrough */ - default: - assert(attr == FRAG_RESULT_COLOR || - (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX)); - fs_output_semantic_name[fs_num_outputs] = TGSI_SEMANTIC_COLOR; - fs_output_semantic_index[fs_num_outputs] = numColors; - outputMapping[attr] = fs_num_outputs; - numColors++; + write_all = GL_TRUE; + break; + case FRAG_RESULT_SAMPLE_MASK: + semantic = TGSI_SEMANTIC_SAMPLEMASK; break; } + assert(attr == FRAG_RESULT_COLOR || + attr == FRAG_RESULT_SAMPLE_MASK || + (FRAG_RESULT_DATA0 <= attr && attr < FRAG_RESULT_MAX)); + fs_output_semantic_name[fs_num_outputs] = semantic; + fs_output_semantic_index[fs_num_outputs] = numColors; + outputMapping[attr] = fs_num_outputs; + numColors++; + fs_num_outputs++; } } |