@ -2429,9 +2429,24 @@ static void emit_txq(struct dump_ctx *ctx,
get_wm_string ( twm ) , get_string ( dtypeprefix ) ,
get_wm_string ( twm ) , get_string ( dtypeprefix ) ,
srcs [ sampler_index ] ) ;
srcs [ sampler_index ] ) ;
} else {
} else {
const struct tgsi_full_src_register * src = & inst - > Src [ 1 ] ;
int gles_sampler_index = 0 ;
for ( int i = 0 ; i < src - > Register . Index ; + + i ) {
if ( ctx - > samplers_used & ( 1 < < i ) )
+ + gles_sampler_index ;
}
char sampler_str [ 64 ] ;
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_SAMPLER ) & & src - > Register . Indirect ) {
snprintf ( sampler_str , sizeof ( sampler_str ) , " addr%d+%d " , src - > Indirect . Index , gles_sampler_index ) ;
} else {
snprintf ( sampler_str , sizeof ( sampler_str ) , " %d " , gles_sampler_index ) ;
}
emit_buff ( & ctx - > glsl_strbufs , " %s%s = %s(%s_texlod[%s]); \n " , dst , get_wm_string ( twm ) ,
emit_buff ( & ctx - > glsl_strbufs , " %s%s = %s(%s_texlod[%s]); \n " , dst , get_wm_string ( twm ) ,
get_string ( dtypeprefix ) , tgsi_proc_to_prefix ( ctx - > info . processor ) ,
get_string ( dtypeprefix ) , tgsi_proc_to_prefix ( ctx - > info . processor ) ,
srcs [ sampler_index ] ) ;
sampler_str ) ;
ctx - > gles_use_tex_query_level = true ;
ctx - > gles_use_tex_query_level = true ;
}
}
}
}
@ -4315,9 +4330,6 @@ get_source_info(struct dump_ctx *ctx,
strbuf_fmt ( src_buf , " %s%s(%sconst%d[%d]%s) " , prefix , get_string ( csp ) , cname , dim , src - > Register . Index , swizzle ) ;
strbuf_fmt ( src_buf , " %s%s(%sconst%d[%d]%s) " , prefix , get_string ( csp ) , cname , dim , src - > Register . Index , swizzle ) ;
}
}
} else if ( src - > Register . File = = TGSI_FILE_SAMPLER ) {
} else if ( src - > Register . File = = TGSI_FILE_SAMPLER ) {
if ( ! ctx - > cfg - > use_gles | |
! ( inst - > Instruction . Opcode = = TGSI_OPCODE_TXQ ) | |
! ( inst - > Dst [ 0 ] . Register . WriteMask & 0x8 ) ) {
const char * cname = tgsi_proc_to_prefix ( ctx - > prog_type ) ;
const char * cname = tgsi_proc_to_prefix ( ctx - > prog_type ) ;
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_SAMPLER ) ) {
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_SAMPLER ) ) {
int basearrayidx = lookup_sampler_array ( ctx , src - > Register . Index ) ;
int basearrayidx = lookup_sampler_array ( ctx , src - > Register . Index ) ;
@ -4329,15 +4341,6 @@ get_source_info(struct dump_ctx *ctx,
} else {
} else {
strbuf_fmt ( src_buf , " %ssamp%d%s " , cname , src - > Register . Index , swizzle ) ;
strbuf_fmt ( src_buf , " %ssamp%d%s " , cname , src - > Register . Index , swizzle ) ;
}
}
} else {
/* This is probably incorrect, we assume that the base-index is the sum of all arrays sizes up
* to this array of samplers */
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_SAMPLER ) & & src - > Register . Indirect ) {
strbuf_fmt ( src_buf , " addr%d+%d " , src - > Indirect . Index , src - > Register . Index ) ;
} else {
strbuf_fmt ( src_buf , " %d " , src - > Register . Index ) ;
}
}
sinfo - > sreg_index = src - > Register . Index ;
sinfo - > sreg_index = src - > Register . Index ;
} else if ( src - > Register . File = = TGSI_FILE_IMAGE ) {
} else if ( src - > Register . File = = TGSI_FILE_IMAGE ) {
const char * cname = tgsi_proc_to_prefix ( ctx - > prog_type ) ;
const char * cname = tgsi_proc_to_prefix ( ctx - > prog_type ) ;
@ -6115,14 +6118,12 @@ static int emit_ios_common(const struct dump_ctx *ctx,
}
}
}
}
unsigned n_samplers = 0 ;
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_SAMPLER ) ) {
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_SAMPLER ) ) {
for ( i = 0 ; i < ctx - > num_sampler_arrays ; i + + ) {
for ( i = 0 ; i < ctx - > num_sampler_arrays ; i + + ) {
uint32_t first = ctx - > sampler_arrays [ i ] . first ;
uint32_t first = ctx - > sampler_arrays [ i ] . first ;
uint32_t range = ctx - > sampler_arrays [ i ] . array_size ;
uint32_t range = ctx - > sampler_arrays [ i ] . array_size ;
emit_sampler_decl ( ctx , glsl_strbufs , shadow_samp_mask , first , range , ctx - > samplers + first ) ;
emit_sampler_decl ( ctx , glsl_strbufs , shadow_samp_mask , first , range , ctx - > samplers + first ) ;
n_samplers + = range ;
}
}
} else {
} else {
uint nsamp = util_last_bit ( ctx - > samplers_used ) ;
uint nsamp = util_last_bit ( ctx - > samplers_used ) ;
@ -6132,12 +6133,12 @@ static int emit_ios_common(const struct dump_ctx *ctx,
continue ;
continue ;
emit_sampler_decl ( ctx , glsl_strbufs , shadow_samp_mask , i , 0 , ctx - > samplers + i ) ;
emit_sampler_decl ( ctx , glsl_strbufs , shadow_samp_mask , i , 0 , ctx - > samplers + i ) ;
+ + n_samplers ;
}
}
}
}
if ( ctx - > cfg - > use_gles & & ctx - > gles_use_tex_query_level )
if ( ctx - > cfg - > use_gles & & ctx - > gles_use_tex_query_level )
emit_hdrf ( glsl_strbufs , " uniform int %s_texlod[%d]; \n " , tgsi_proc_to_prefix ( ctx - > info . processor ) , n_samplers ) ;
emit_hdrf ( glsl_strbufs , " uniform int %s_texlod[%d]; \n " , tgsi_proc_to_prefix ( ctx - > info . processor ) ,
util_bitcount ( ctx - > samplers_used ) ) ;
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_IMAGE ) ) {
if ( ctx - > info . indirect_files & ( 1 < < TGSI_FILE_IMAGE ) ) {
for ( i = 0 ; i < ctx - > num_image_arrays ; i + + ) {
for ( i = 0 ; i < ctx - > num_image_arrays ; i + + ) {