Re: [Mesa-dev] [PATCH 0/9] Clean up draw path state updates.

2018-03-20 Thread Mathias Fröhlich
Hi Brian, On Tuesday, 20 March 2018 16:16:13 CET Brian Paul wrote: > The code changes look good, AFAICT. But some of the comments could be > improved, IMHO. See other replies... > > Otherwise, for the series, > Reviewed-by: Brian Paul Thanks for the review! Will incorporate the proposed chan

[Mesa-dev] [RFC v1 11/38] nir: Add helpers for working with deref instructions

2018-03-20 Thread Jason Ekstrand
This commit adds a pass for lowering deref instructions to deref chains as well as some smaller helpers to ease the transition. --- src/compiler/Makefile.sources | 1 + src/compiler/nir/meson.build | 1 + src/compiler/nir/nir.h | 50 ++- src/compiler/nir/nir_builder.h | 23 +++

[Mesa-dev] [PATCH 01/38] nir: Add src/dest num_components helpers

2018-03-20 Thread Jason Ekstrand
We already have these for bit_size --- src/compiler/nir/nir.h | 12 1 file changed, 12 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 7ad19b4..8f4a28c 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -626,11 +626,23 @@ nir_src_bit_

[Mesa-dev] [RFC v1 10/38] nir: Add deref sources to texture instructions

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir.h | 2 ++ src/compiler/nir/nir_print.c | 6 ++ 2 files changed, 8 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 14b532d..b575545 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -1233,6 +1233,8 @@ typedef enu

[Mesa-dev] [RFC v1 00/38] nir: Move to using instructions for derefs

2018-03-20 Thread Jason Ekstrand
This is something that Connor and I have been talking about for some time now. The basic idea is to replace the current singly linked nir_deref list with deref instructions. This is similar to what LLVM does and it offers quite a bit more freedom when we start getting more realistic pointers from

[Mesa-dev] [PATCH 03/38] nir/vars_to_ssa: Remove copies from the correct set

2018-03-20 Thread Jason Ekstrand
Cc: mesa-sta...@lists.freedesktop.org --- src/compiler/nir/nir_lower_vars_to_ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index e8cfe30..0cc6514 100644 --- a/src/compiler/nir/nir_lower

[Mesa-dev] [RFC v1 13/38] glsl/nir: Only claim to handle intrinsic functions

2018-03-20 Thread Jason Ekstrand
Non-intrinsic function handling has never actually been tested and probably doesn't work. Just get rid of it for now. We can always add it back in later if it's useful. --- src/compiler/glsl/glsl_to_nir.cpp | 25 ++--- 1 file changed, 2 insertions(+), 23 deletions(-) diff --

[Mesa-dev] [PATCH 02/38] nir: Return a cursor from nir_instr_remove

2018-03-20 Thread Jason Ekstrand
Because nir_instr_remove is an inline wrapper around nir_instr_remove_v, the compiler should be able to tell that the return value is unused and not emit the extra code in most cases. --- src/compiler/nir/nir.c| 2 +- src/compiler/nir/nir.h| 16

[Mesa-dev] [RFC v1 08/38] nir/builder: Add deref building helpers

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_builder.h | 87 ++ 1 file changed, 87 insertions(+) diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 36e0ae3..27aa65b 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h

[Mesa-dev] [RFC v1 07/38] nir: Add a deref instruction type

2018-03-20 Thread Jason Ekstrand
This commit adds a new instruction type to NIR for handling derefs. Nothing uses it yet but this adds the data structure as well as all of the code to validate, print, clone, and [de]serialize them. --- src/compiler/nir/nir.c| 50 +++ src/compiler/nir/nir.h

[Mesa-dev] [PATCH 05/38] nir/validator: Validate that all used variables exist

2018-03-20 Thread Jason Ekstrand
We were validating this for locals but nothing else. --- src/compiler/nir/nir_validate.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index a49948f..e9d6bd5 100644 --- a/src/compiler/nir/nir_v

[Mesa-dev] [RFC v1 09/38] nir: Add _deref versions of all of the _var intrinsics

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir.h| 2 +- src/compiler/nir/nir_builder.h| 37 + src/compiler/nir/nir_intrinsics.h | 84 +++ 3 files changed, 122 insertions(+), 1 deletion(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h i

[Mesa-dev] [PATCH 04/38] nir/lower_indirect_derefs: Support interp_var_at intrinsics

2018-03-20 Thread Jason Ekstrand
This fixes the fs-interpolateAtCentroid-block-array piglit test on i965. Cc: mesa-sta...@lists.freedesktop.org --- src/compiler/nir/nir_lower_indirect_derefs.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/co

[Mesa-dev] [RFC v1 06/38] nir: Rename image intrinsics to image_var

2018-03-20 Thread Jason Ekstrand
Generated with git grep -l nir_intrinsic_image | xargs \ sed -i 's/nir_intrinsic_image/nir_intrinsic_image_var/g' and some manual fixing in nir_intrinsics.h --- src/amd/common/ac_nir_to_llvm.c| 42 - src/amd/vulkan/radv_meta_bufimage.c| 8 ++--

[Mesa-dev] [RFC v1 17/38] nir/lower_atomics: Rework the main walker loop a bit

2018-03-20 Thread Jason Ekstrand
This replaces some "if (...} { }" with "if (...) continue;" to reduce nesting depth and makes nir_metadata_preserve conditional on progress for the given impl. --- src/compiler/nir/nir_lower_atomics.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/c

[Mesa-dev] [RFC v1 15/38] prog/nir: Simplify some load/store operations

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_builder.h | 6 ++ src/mesa/program/prog_to_nir.c | 29 ++--- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index f1e52b2..6667d52 100644 --- a/src/compiler/nir/n

[Mesa-dev] [RFC v1 20/38] nir: Support deref instructions in lower_global_vars_to_local

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_global_vars_to_local.c | 62 +++ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/src/compiler/nir/nir_lower_global_vars_to_local.c b/src/compiler/nir/nir_lower_global_vars_to_local.c index c8fdfde..14aa366 100644 --- a/src/compile

[Mesa-dev] [RFC v1 23/38] nir: Support deref instructions in lower_var_copies

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir.h | 3 ++ src/compiler/nir/nir_builder.h | 48 ++ src/compiler/nir/nir_lower_var_copies.c | 90 +++-- 3 files changed, 138 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compil

[Mesa-dev] [RFC v1 22/38] nir: Add a deref path helper struct

2018-03-20 Thread Jason Ekstrand
This commit introduces a new nir_deref.h header for helpers that are less common and really only needed by a few heavy-duty passes. In this header is a new struct for representing a full deref path which can be walked in either direction. --- src/compiler/Makefile.sources | 1 + src/compiler/nir

[Mesa-dev] [RFC v1 16/38] prog/nir: Use deref instructions for params

2018-03-20 Thread Jason Ekstrand
--- src/mesa/program/prog_to_nir.c | 36 ++-- 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index 26dfc37..14391a3 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/pro

[Mesa-dev] [RFC v1 14/38] glsl/nir: Use deref instructions instead of dref chains

2018-03-20 Thread Jason Ekstrand
--- src/compiler/glsl/glsl_to_nir.cpp | 239 +++--- 1 file changed, 94 insertions(+), 145 deletions(-) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 9da4526..be7a510 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/sr

[Mesa-dev] [RFC v1 24/38] nir: Support deref instructions in split_var_copies

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_split_var_copies.c | 42 + 1 file changed, 42 insertions(+) diff --git a/src/compiler/nir/nir_split_var_copies.c b/src/compiler/nir/nir_split_var_copies.c index bc3ceed..bcd1f10 100644 --- a/src/compiler/nir/nir_split_var_copies.c +++ b/sr

[Mesa-dev] [RFC v1 12/38] anv, i965, radv, st, ir3: Call nir_lower_deref_instrs

2018-03-20 Thread Jason Ekstrand
This inserts a call to nir_lower_deref_instrs at every call site of glsl_to_nir, spirv_to_nir, and prog_to_nir. --- src/amd/vulkan/radv_shader.c| 2 ++ src/gallium/drivers/freedreno/ir3/ir3_cmdline.c | 3 +++ src/intel/vulkan/anv_pipeline.c | 2 ++ src/mesa/driv

[Mesa-dev] [RFC v1 28/38] nir: Support deref instructions in lower_system_values

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_system_values.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c index fb560ee..104df51 100644 --- a/src/compiler/nir/nir_lower_system_values.c

[Mesa-dev] [RFC v1 30/38] nir: Support deref instructions in propagate_invariant

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_propagate_invariant.c | 23 --- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/compiler/nir/nir_propagate_invariant.c b/src/compiler/nir/nir_propagate_invariant.c index 7b5bd6c..b48b91c 100644 --- a/src/compiler/nir/nir_propagate_in

[Mesa-dev] [RFC v1 31/38] nir: Support deref instructions in gather_info

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_gather_info.c | 26 -- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c index 743f968..50d67b6 100644 --- a/src/compiler/nir/nir_gather_info.c +++ b/src/compiler/

[Mesa-dev] [RFC v1 21/38] nir: Support deref instructions in lower_io_to_temporaries

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_io_to_temporaries.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compiler/nir/nir_lower_io_to_temporaries.c b/src/compiler/nir/nir_lower_io_to_temporaries.c index 301ba65..7ba66ba 100644 --- a/src/compiler/nir/nir_lower_io_to_temporaries.c +++ b/src/com

[Mesa-dev] [RFC v1 32/38] nir: Support deref instructions in lower_io

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_io.c | 70 + 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index df91feb..549583d 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compil

[Mesa-dev] [RFC v1 25/38] nir: Support deref instructions in lower_vars_to_ssa

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_vars_to_ssa.c | 75 1 file changed, 58 insertions(+), 17 deletions(-) diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c index 0cc6514..403ce26 100644 --- a/src/compiler/nir/nir_lower_va

[Mesa-dev] [RFC v1 35/38] nir: Support deref instructions in remove_unused_varyings

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_linking_helpers.c | 50 ++ 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c index 2b0a266..1a0cb91 100644 --- a/src/compiler/nir/nir_linking_help

[Mesa-dev] [RFC v1 38/38] i965: Move nir_lower_deref_instrs to right before locals_to_regs

2018-03-20 Thread Jason Ekstrand
--- src/intel/compiler/brw_nir.c| 2 ++ src/mesa/drivers/dri/i965/brw_program.c | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index cf994ac..4fc6cae 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src

[Mesa-dev] [RFC v1 26/38] nir: Support deref instructions in lower_indirect_derefs

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_indirect_derefs.c | 156 +++ 1 file changed, 156 insertions(+) diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c b/src/compiler/nir/nir_lower_indirect_derefs.c index 02f202d..ebeb79b 100644 --- a/src/compiler/nir/nir_lower_indirect_d

[Mesa-dev] [RFC v1 36/38] intel, ir3: Disable nir_opt_copy_prop_vars

2018-03-20 Thread Jason Ekstrand
This pass doesn't handle deref instructions yet. Making it handle both legacy derefs and deref instructions would be painful. Since it's not important for correctness, just disable it for now. --- src/gallium/drivers/freedreno/ir3/ir3_nir.c | 2 +- src/intel/compiler/brw_nir.c| 2

[Mesa-dev] [RFC v1 29/38] nir: Support deref instructions in lower_clip_cull

2018-03-20 Thread Jason Ekstrand
--- .../nir/nir_lower_clip_cull_distance_arrays.c | 69 -- 1 file changed, 65 insertions(+), 4 deletions(-) diff --git a/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c b/src/compiler/nir/nir_lower_clip_cull_distance_arrays.c index 95eda82..69b31d5 100644 --- a/sr

[Mesa-dev] [RFC v1 33/38] nir: Support deref instructions in lower_atomics

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_atomics.c | 115 +-- 1 file changed, 110 insertions(+), 5 deletions(-) diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/nir/nir_lower_atomics.c index 2287517..9cf6608 100644 --- a/src/compiler/nir/nir_lower_atomics.c

[Mesa-dev] [RFC v1 27/38] nir/deref: Add a deref cleanup function

2018-03-20 Thread Jason Ekstrand
Sometimes it's useful for a pass to be able to clean up its own derefs instead of waiting for DCE. This little helper makes it very easy. --- src/compiler/nir/nir.h | 2 ++ src/compiler/nir/nir_deref.c | 13 + 2 files changed, 15 insertions(+) diff --git a/src/compiler/nir/nir

[Mesa-dev] [RFC v1 18/38] nir: Support deref instructions in remove_dead_variables

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_remove_dead_variables.c | 99 1 file changed, 99 insertions(+) diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c index eff66f9..6b1927f 100644 --- a/src/compiler/nir/nir_remove_dead_varia

[Mesa-dev] [RFC v1 34/38] nir: Support deref instructions in lower_wpos_ytransform

2018-03-20 Thread Jason Ekstrand
--- src/compiler/nir/nir_lower_wpos_ytransform.c | 29 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/compiler/nir/nir_lower_wpos_ytransform.c b/src/compiler/nir/nir_lower_wpos_ytransform.c index 62166e7..2e0dd86 100644 --- a/src/compiler/nir/nir_l

[Mesa-dev] [RFC v1 37/38] intel/nir: Fixup deref modes after lowering patch vertices

2018-03-20 Thread Jason Ekstrand
--- src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp b/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp index 69da83a..0fd1492 100644 --- a/src/mesa/drivers/dri/i965/brw_nir_uniforms.cpp +++ b/src/mes

[Mesa-dev] [RFC v1 19/38] nir: Add a pass for fixing deref modes

2018-03-20 Thread Jason Ekstrand
This will be needed by anything which changes variable modes without rewriting derefs. --- src/compiler/nir/nir.h | 2 ++ src/compiler/nir/nir_deref.c | 30 ++ 2 files changed, 32 insertions(+) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index d

[Mesa-dev] [PATCH] mesa: readpixels add support for GL_HALF_FLOAT

2018-03-20 Thread Lin Johnson
Ext_color_buffer_half_float is using type GL_HALF_FLOAT and data_type GL_FLOAT. This fix Android CTS test android.view.cts.PixelCopyTest #TestWindowProducerCopyToRGBA16F Signed-off-by: Lin Johnson --- src/mesa/main/readpix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/rea

Re: [Mesa-dev] [PATCH] mesa: readpixels add support for GL_HALF_FLOAT

2018-03-20 Thread Alejandro Piñeiro
On 21/03/18 06:57, Lin Johnson wrote: > Ext_color_buffer_half_float is using type GL_HALF_FLOAT > and data_type GL_FLOAT. This fix Android CTS test > android.view.cts.PixelCopyTest > #TestWindowProducerCopyToRGBA16F > > Signed-off-by: Lin Johnson > --- > src/mesa/main/readpix.c | 2 ++ > 1 file

<    1   2