return op == TEXTURE_OP_NORMAL;
}
+static char
+sampler_type_name(enum mali_sampler_type t)
+{
+ switch (t) {
+ case MALI_SAMPLER_FLOAT:
+ return 'f';
+ case MALI_SAMPLER_UNSIGNED:
+ return 'u';
+ case MALI_SAMPLER_SIGNED:
+ return 'i';
+ default:
+ return '?';
+ }
+
+}
+
#undef DEFINE_CASE
static void
printf("texture%d, ", texture->texture_handle);
+ /* Print the type, GL style */
+ printf("%c", sampler_type_name(texture->sampler_type));
printf("sampler%d", texture->sampler_handle);
print_swizzle_vec4(texture->swizzle, false, false);
printf(", ");
printf("// unknownA = 0x%x\n", texture->unknownA);
printf("// unknown8 = 0x%x\n", texture->unknown8);
}
-
- /* Don't blow up */
- if (texture->unknown7 != 0x1)
- printf("// (!) unknown7 = %d\n", texture->unknown7);
}
void
#define TEXTURE_OP_LOD 0x12 /* textureLod */
#define TEXTURE_OP_TEXEL_FETCH 0x14 /* texelFetch */
+enum mali_sampler_type {
+ MALI_SAMPLER_UNK = 0x0,
+ MALI_SAMPLER_FLOAT = 0x1, /* sampler */
+ MALI_SAMPLER_UNSIGNED = 0x2, /* usampler */
+ MALI_SAMPLER_SIGNED = 0x3, /* isampler */
+};
+
typedef struct
__attribute__((__packed__))
{
unsigned out_full : 1;
- /* Always 1 afaict... */
- unsigned unknown7 : 2;
+ enum mali_sampler_type sampler_type : 2;
unsigned out_reg_select : 1;
unsigned out_upper : 1;
return true;
}
+static enum mali_sampler_type
+midgard_sampler_type(nir_alu_type t)
+{
+ switch (nir_alu_type_get_base_type(t)) {
+ case nir_type_float:
+ return MALI_SAMPLER_FLOAT;
+ case nir_type_int:
+ return MALI_SAMPLER_SIGNED;
+ case nir_type_uint:
+ return MALI_SAMPLER_UNSIGNED;
+ default:
+ unreachable("Unknown sampler type");
+ }
+}
+
static void
emit_texop_native(compiler_context *ctx, nir_tex_instr *instr,
unsigned midgard_texop)
.in_reg_full = 1,
.out_full = 1,
- /* Always 1 */
- .unknown7 = 1,
+ .sampler_type = midgard_sampler_type(instr->dest_type),
}
};