GL_ARB_shader_storage_buffer_object not started
GL_ARB_stencil_texturing DONE (i965/gen8+, nv50, nvc0, r600, radeonsi)
GL_ARB_texture_buffer_range DONE (nv50, nvc0, i965, r600, radeonsi)
- GL_ARB_texture_query_levels DONE (i965)
+ GL_ARB_texture_query_levels DONE (all drivers that support GLSL 1.30)
GL_ARB_texture_storage_multisample DONE (all drivers that support GL_ARB_texture_multisample)
GL_ARB_texture_view DONE (i965)
GL_ARB_vertex_attrib_binding DONE (all drivers)
As per NV_gpu_program4, retrieve the dimensions of the texture depending on
the target. For 1D (width), 2D/RECT/CUBE (width, height), 3D (width, height,
- depth), 1D array (width, layers), 2D array (width, height, layers)
+ depth), 1D array (width, layers), 2D array (width, height, layers).
+ Also return the number of accessible levels (last_level - first_level + 1)
+ in W.
.. math::
dst.z = texture\_depth(unit, lod)
+ dst.w = texture\_levels(unit)
+
.. opcode:: TG4 - Texture Gather
As per ARB_texture_gather, gathers the four texels to be used in a bi-linear
void
glsl_to_tgsi_visitor::visit(ir_texture *ir)
{
- st_src_reg result_src, coord, cube_sc, lod_info, projector, dx, dy, offset[MAX_GLSL_TEXTURE_OFFSET], sample_index, component;
+ st_src_reg result_src, coord, cube_sc, lod_info, projector, dx, dy;
+ st_src_reg offset[MAX_GLSL_TEXTURE_OFFSET], sample_index, component;
+ st_src_reg levels_src;
st_dst_reg result_dst, coord_dst, cube_sc_dst;
glsl_to_tgsi_instruction *inst = NULL;
unsigned opcode = TGSI_OPCODE_NOP;
ir->lod_info.lod->accept(this);
lod_info = this->result;
break;
+ case ir_query_levels:
+ opcode = TGSI_OPCODE_TXQ;
+ lod_info = st_src_reg(PROGRAM_IMMEDIATE, 0, GLSL_TYPE_INT);
+ levels_src = get_temp(ir->type);
+ break;
case ir_txf:
opcode = TGSI_OPCODE_TXF;
ir->lod_info.lod->accept(this);
case ir_lod:
opcode = TGSI_OPCODE_LODQ;
break;
- case ir_query_levels:
- assert(!"Unexpected ir_query_levels opcode");
- break;
}
if (ir->projector) {
if (opcode == TGSI_OPCODE_TXD)
inst = emit(ir, opcode, result_dst, coord, dx, dy);
- else if (opcode == TGSI_OPCODE_TXQ)
- inst = emit(ir, opcode, result_dst, lod_info);
- else if (opcode == TGSI_OPCODE_TXF) {
+ else if (opcode == TGSI_OPCODE_TXQ) {
+ if (ir->op == ir_query_levels) {
+ /* the level is stored in W */
+ inst = emit(ir, opcode, st_dst_reg(levels_src), lod_info);
+ result_dst.writemask = WRITEMASK_X;
+ levels_src.swizzle = SWIZZLE_WWWW;
+ emit(ir, TGSI_OPCODE_MOV, result_dst, levels_src);
+ } else
+ inst = emit(ir, opcode, result_dst, lod_info);
+ } else if (opcode == TGSI_OPCODE_TXF) {
inst = emit(ir, opcode, result_dst, coord);
} else if (opcode == TGSI_OPCODE_TXL2 || opcode == TGSI_OPCODE_TXB2) {
inst = emit(ir, opcode, result_dst, coord, lod_info);