[Mesa-dev] [PATCH] glsl: include image qualifiers when printing IR
Samuel Pitoiset
samuel.pitoiset at gmail.com
Fri Apr 28 09:37:53 UTC 2017
On 04/28/2017 11:26 AM, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
> src/compiler/glsl/ir_print_visitor.cpp | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/src/compiler/glsl/ir_print_visitor.cpp b/src/compiler/glsl/ir_print_visitor.cpp
> index 6c1c86a..36dfbdd 100644
> --- a/src/compiler/glsl/ir_print_visitor.cpp
> +++ b/src/compiler/glsl/ir_print_visitor.cpp
> @@ -181,35 +181,49 @@ void ir_print_visitor::visit(ir_variable *ir)
> if (ir->data.stream & (1u << 31)) {
> if (ir->data.stream & ~(1u << 31)) {
> snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ",
> ir->data.stream & 3, (ir->data.stream >> 2) & 3,
> (ir->data.stream >> 4) & 3, (ir->data.stream >> 6) & 3);
> }
> } else if (ir->data.stream) {
> snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream);
> }
>
> + char image_format[32] = {0};
> + if (ir->data.image_format) {
> + snprintf(image_format, sizeof(image_format), "format=%x ",
> + ir->data.image_format);
> + }
> +
> const char *const cent = (ir->data.centroid) ? "centroid " : "";
> const char *const samp = (ir->data.sample) ? "sample " : "";
> const char *const patc = (ir->data.patch) ? "patch " : "";
> const char *const inv = (ir->data.invariant) ? "invariant " : "";
> const char *const prec = (ir->data.precise) ? "precise " : "";
> + const char *const image_read_only = (ir->data.image_read_only) ? "readonly " : "";
> + const char *const image_write_only = (ir->data.image_write_only) ? "writeonly " : "";
> + const char *const image_coherent = (ir->data.image_coherent) ? "coherent " : "";
> + const char *const image_volatile = (ir->data.image_coherent) ? "volatile " : "";
Should be image_volatile.
> + const char *const image_restrict = (ir->data.image_coherent) ? "restrict " : "";
Should be image_restrict.
With that fixed, this patch is:
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> const char *const mode[] = { "", "uniform ", "shader_storage ",
> "shader_shared ", "shader_in ", "shader_out ",
> "in ", "out ", "inout ",
> "const_in ", "sys ", "temporary " };
> STATIC_ASSERT(ARRAY_SIZE(mode) == ir_var_mode_count);
> const char *const interp[] = { "", "smooth", "flat", "noperspective" };
> STATIC_ASSERT(ARRAY_SIZE(interp) == INTERP_MODE_COUNT);
>
> - fprintf(f, "(%s%s%s%s%s%s%s%s%s%s%s) ",
> - binding, loc, component, cent, samp, patc, inv, prec, mode[ir->data.mode],
> + fprintf(f, "(%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s) ",
> + binding, loc, component, cent,
> + image_format, image_read_only, image_write_only,
> + image_coherent, image_volatile, image_restrict,
> + samp, patc, inv, prec, mode[ir->data.mode],
> stream,
> interp[ir->data.interpolation]);
>
> print_type(f, ir->type);
> fprintf(f, " %s)", unique_name(ir));
> }
>
>
> void ir_print_visitor::visit(ir_function_signature *ir)
> {
>
More information about the mesa-dev
mailing list