diff options
author | marha <marha@users.sourceforge.net> | 2012-11-09 13:28:28 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-11-09 13:28:28 +0100 |
commit | 19b61957dbf473cddbae72792ddeeaee4d4a7077 (patch) | |
tree | 0839a8b0cc9c6ea5f3ae63cc34726d4ef936995d /mesalib/src/mesa/state_tracker | |
parent | 480a7a0a6c9a8fae5b8fc7b7688173d5e425ae0e (diff) | |
parent | 8d57b7fcb22cf1a52203ee57c745b64bba649249 (diff) | |
download | vcxsrv-19b61957dbf473cddbae72792ddeeaee4d4a7077.tar.gz vcxsrv-19b61957dbf473cddbae72792ddeeaee4d4a7077.tar.bz2 vcxsrv-19b61957dbf473cddbae72792ddeeaee4d4a7077.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
mesa git update 9 nov 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker')
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_cb_texture.c | 5 | ||||
-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 | 69 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/state_tracker/st_texture.c | 10 |
5 files changed, 65 insertions, 28 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c index 6c287b3d4..b2711c342 100644 --- a/mesalib/src/mesa/state_tracker/st_cb_texture.c +++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c @@ -102,6 +102,9 @@ gl_target_to_pipe(GLenum target) return PIPE_TEXTURE_2D_ARRAY; case GL_TEXTURE_BUFFER: return PIPE_BUFFER; + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + return PIPE_TEXTURE_CUBE_ARRAY; default: assert(0); return 0; @@ -272,6 +275,7 @@ get_texture_dims(GLenum target) case GL_TEXTURE_EXTERNAL_OES: return 2; case GL_TEXTURE_3D: + case GL_TEXTURE_CUBE_MAP_ARRAY: return 3; default: assert(0 && "invalid texture target in get_texture_dims()"); @@ -1123,6 +1127,7 @@ copy_image_data_to_texture(struct st_context *st, assert(stImage->pt->target == PIPE_TEXTURE_1D_ARRAY || u_minify(stImage->pt->height0, src_level) == stImage->base.Height); assert(stImage->pt->target == PIPE_TEXTURE_2D_ARRAY || + stImage->pt->target == PIPE_TEXTURE_CUBE_ARRAY || u_minify(stImage->pt->depth0, src_level) == stImage->base.Depth); st_texture_image_copy(st->pipe, diff --git a/mesalib/src/mesa/state_tracker/st_extensions.c b/mesalib/src/mesa/state_tracker/st_extensions.c index 887700568..7570d6894 100644 --- a/mesalib/src/mesa/state_tracker/st_extensions.c +++ b/mesalib/src/mesa/state_tracker/st_extensions.c @@ -378,7 +378,8 @@ void st_init_extensions(struct st_context *st) * support the GL_POINT_SPRITE_R_MODE_NV option. */ { o(MESA_texture_array), PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS }, - { o(OES_standard_derivatives), PIPE_CAP_SM3 } + { o(OES_standard_derivatives), PIPE_CAP_SM3 }, + { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY } }; /* 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 a70a08bf3..c030a6b37 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -2565,10 +2565,18 @@ glsl_to_tgsi_visitor::visit(ir_call *ir) void glsl_to_tgsi_visitor::visit(ir_texture *ir) { - st_src_reg result_src, coord, lod_info, projector, dx, dy, offset; - st_dst_reg result_dst, coord_dst; + st_src_reg result_src, coord, cube_sc, lod_info, projector, dx, dy, offset; + st_dst_reg result_dst, coord_dst, cube_sc_dst; glsl_to_tgsi_instruction *inst = NULL; unsigned opcode = TGSI_OPCODE_NOP; + const glsl_type *sampler_type = ir->sampler->type; + bool is_cube_array = false; + + /* if we are a cube array sampler */ + if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE && + sampler_type->sampler_array)) { + is_cube_array = true; + } if (ir->coordinate) { ir->coordinate->accept(this); @@ -2591,20 +2599,20 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) /* Storage for our result. Ideally for an assignment we'd be using * the actual storage for the result here, instead. */ - result_src = get_temp(glsl_type::vec4_type); + result_src = get_temp(ir->type); result_dst = st_dst_reg(result_src); switch (ir->op) { case ir_tex: - opcode = TGSI_OPCODE_TEX; + opcode = (is_cube_array && ir->shadow_comparitor) ? TGSI_OPCODE_TEX2 : TGSI_OPCODE_TEX; break; case ir_txb: - opcode = TGSI_OPCODE_TXB; + opcode = is_cube_array ? TGSI_OPCODE_TXB2 : TGSI_OPCODE_TXB; ir->lod_info.bias->accept(this); lod_info = this->result; break; case ir_txl: - opcode = TGSI_OPCODE_TXL; + opcode = is_cube_array ? TGSI_OPCODE_TXL2 : TGSI_OPCODE_TXL; ir->lod_info.lod->accept(this); lod_info = this->result; break; @@ -2631,8 +2639,6 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) break; } - const glsl_type *sampler_type = ir->sampler->type; - if (ir->projector) { if (opcode == TGSI_OPCODE_TEX) { /* Slot the projector in as the last component of the coord. */ @@ -2692,17 +2698,25 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) */ ir->shadow_comparitor->accept(this); - /* XXX This will need to be updated for cubemap array samplers. */ - if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D && - sampler_type->sampler_array) || - sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) { - coord_dst.writemask = WRITEMASK_W; - } else { - coord_dst.writemask = WRITEMASK_Z; + if (is_cube_array) { + cube_sc = get_temp(glsl_type::float_type); + cube_sc_dst = st_dst_reg(cube_sc); + cube_sc_dst.writemask = WRITEMASK_X; + emit(ir, TGSI_OPCODE_MOV, cube_sc_dst, this->result); + cube_sc_dst.writemask = WRITEMASK_X; + } + else { + if ((sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D && + sampler_type->sampler_array) || + sampler_type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE) { + coord_dst.writemask = WRITEMASK_W; + } else { + coord_dst.writemask = WRITEMASK_Z; + } + + emit(ir, TGSI_OPCODE_MOV, coord_dst, this->result); + coord_dst.writemask = WRITEMASK_XYZW; } - - emit(ir, TGSI_OPCODE_MOV, coord_dst, this->result); - coord_dst.writemask = WRITEMASK_XYZW; } if (opcode == TGSI_OPCODE_TXL || opcode == TGSI_OPCODE_TXB || @@ -2719,7 +2733,11 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) inst = emit(ir, opcode, result_dst, lod_info); else if (opcode == TGSI_OPCODE_TXF) { inst = emit(ir, opcode, result_dst, coord); - } else + } else if (opcode == TGSI_OPCODE_TXL2 || opcode == TGSI_OPCODE_TXB2) { + inst = emit(ir, opcode, result_dst, coord, lod_info); + } else if (opcode == TGSI_OPCODE_TEX2) { + inst = emit(ir, opcode, result_dst, coord, cube_sc); + } else inst = emit(ir, opcode, result_dst, coord); if (ir->shadow_comparitor) @@ -2751,7 +2769,8 @@ glsl_to_tgsi_visitor::visit(ir_texture *ir) inst->tex_target = TEXTURE_3D_INDEX; break; case GLSL_SAMPLER_DIM_CUBE: - inst->tex_target = TEXTURE_CUBE_INDEX; + inst->tex_target = (sampler_type->sampler_array) + ? TEXTURE_CUBE_ARRAY_INDEX : TEXTURE_CUBE_INDEX; break; case GLSL_SAMPLER_DIM_RECT: inst->tex_target = TEXTURE_RECT_INDEX; @@ -4209,6 +4228,7 @@ compile_tgsi_instruction(struct st_translate *t, unsigned num_dst; unsigned num_src; + unsigned tex_target; num_dst = num_inst_dst_regs(inst->op); num_src = num_inst_src_regs(inst->op); @@ -4243,14 +4263,19 @@ compile_tgsi_instruction(struct st_translate *t, case TGSI_OPCODE_TXP: case TGSI_OPCODE_TXQ: case TGSI_OPCODE_TXF: + case TGSI_OPCODE_TEX2: + case TGSI_OPCODE_TXB2: + case TGSI_OPCODE_TXL2: src[num_src++] = t->samplers[inst->sampler]; for (i = 0; i < inst->tex_offset_num_offset; i++) { texoffsets[i] = translate_tex_offset(t, &inst->tex_offsets[i]); } + tex_target = st_translate_texture_target(inst->tex_target, inst->tex_shadow); + ureg_tex_insn(ureg, inst->op, - dst, num_dst, - st_translate_texture_target(inst->tex_target, inst->tex_shadow), + dst, num_dst, + tex_target, texoffsets, inst->tex_offset_num_offset, src, num_src); return; diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index 0acab4340..81a870f86 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -263,6 +263,7 @@ st_translate_texture_target( GLuint textarget, case TEXTURE_1D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW1D_ARRAY; case TEXTURE_2D_ARRAY_INDEX: return TGSI_TEXTURE_SHADOW2D_ARRAY; case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_SHADOWCUBE; + case TEXTURE_CUBE_ARRAY_INDEX: return TGSI_TEXTURE_SHADOWCUBE_ARRAY; default: break; } } @@ -272,6 +273,7 @@ st_translate_texture_target( GLuint textarget, case TEXTURE_2D_INDEX: return TGSI_TEXTURE_2D; case TEXTURE_3D_INDEX: return TGSI_TEXTURE_3D; case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_CUBE; + case TEXTURE_CUBE_ARRAY_INDEX: return TGSI_TEXTURE_CUBE_ARRAY; case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_RECT; case TEXTURE_1D_ARRAY_INDEX: return TGSI_TEXTURE_1D_ARRAY; case TEXTURE_2D_ARRAY_INDEX: return TGSI_TEXTURE_2D_ARRAY; @@ -563,10 +565,6 @@ translate_opcode( unsigned op ) return TGSI_OPCODE_DST; case OPCODE_ELSE: return TGSI_OPCODE_ELSE; - case OPCODE_EMIT_VERTEX: - return TGSI_OPCODE_EMIT; - case OPCODE_END_PRIMITIVE: - return TGSI_OPCODE_ENDPRIM; case OPCODE_ENDIF: return TGSI_OPCODE_ENDIF; case OPCODE_ENDLOOP: diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c index d6dbf8d6c..5a4dcaab2 100644 --- a/mesalib/src/mesa/state_tracker/st_texture.c +++ b/mesalib/src/mesa/state_tracker/st_texture.c @@ -165,6 +165,13 @@ st_gl_texture_dims_to_pipe_dims(GLenum texture, *depthOut = 1; *layersOut = depthIn; break; + case GL_TEXTURE_CUBE_MAP_ARRAY: + case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY: + *widthOut = widthIn; + *heightOut = heightIn; + *depthOut = 1; + *layersOut = depthIn; + break; default: assert(0 && "Unexpected texture in st_gl_texture_dims_to_pipe_dims()"); /* fall-through */ @@ -277,7 +284,8 @@ st_texture_image_data(struct st_context *st, GLuint layers; if (dst->target == PIPE_TEXTURE_1D_ARRAY || - dst->target == PIPE_TEXTURE_2D_ARRAY) + dst->target == PIPE_TEXTURE_2D_ARRAY || + dst->target == PIPE_TEXTURE_CUBE_ARRAY) layers = dst->array_size; else layers = u_minify(dst->depth0, level); |