nir: Add handle/index-based image intrinsics

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Jason Ekstrand
2018-08-16 15:11:44 -05:00
parent 3942943819
commit 0de003be03
3 changed files with 82 additions and 20 deletions

View File

@@ -687,6 +687,10 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
[NIR_INTRINSIC_REDUCTION_OP] = "reduction_op",
[NIR_INTRINSIC_CLUSTER_SIZE] = "cluster_size",
[NIR_INTRINSIC_PARAM_IDX] = "param_idx",
[NIR_INTRINSIC_IMAGE_DIM] = "image_dim",
[NIR_INTRINSIC_IMAGE_ARRAY] = "image_array",
[NIR_INTRINSIC_ACCESS] = "access",
[NIR_INTRINSIC_FORMAT] = "format",
};
for (unsigned idx = 1; idx < NIR_INTRINSIC_NUM_INDEX_FLAGS; idx++) {
if (!info->index_map[idx])
@@ -702,6 +706,24 @@ print_intrinsic_instr(nir_intrinsic_instr *instr, print_state *state)
} else if (idx == NIR_INTRINSIC_REDUCTION_OP) {
nir_op reduction_op = nir_intrinsic_reduction_op(instr);
fprintf(fp, " reduction_op=%s", nir_op_infos[reduction_op].name);
} else if (idx == NIR_INTRINSIC_IMAGE_DIM) {
static const char *dim_name[] = {
[GLSL_SAMPLER_DIM_1D] = "1D",
[GLSL_SAMPLER_DIM_2D] = "2D",
[GLSL_SAMPLER_DIM_3D] = "3D",
[GLSL_SAMPLER_DIM_CUBE] = "Cube",
[GLSL_SAMPLER_DIM_RECT] = "Rect",
[GLSL_SAMPLER_DIM_BUF] = "Buf",
[GLSL_SAMPLER_DIM_MS] = "2D-MSAA",
[GLSL_SAMPLER_DIM_SUBPASS] = "Subpass",
[GLSL_SAMPLER_DIM_SUBPASS_MS] = "Subpass-MSAA",
};
enum glsl_sampler_dim dim = nir_intrinsic_image_dim(instr);
assert(dim < ARRAY_SIZE(dim_name) && dim_name[idx]);
fprintf(fp, " image_dim=%s", dim_name[dim]);
} else if (idx == NIR_INTRINSIC_IMAGE_ARRAY) {
bool array = nir_intrinsic_image_dim(instr);
fprintf(fp, " image_dim=%s", array ? "true" : "false");
} else {
unsigned off = info->index_map[idx] - 1;
assert(index_name[idx]); /* forgot to update index_name table? */