[Mesa-dev] [PATCH 3/3] nir: rename nir_lower_samplers.c{pp,}

Gottfried Haider gottfried.haider at gmail.com
Thu Sep 17 11:52:54 PDT 2015


Patches 1-3
Tested-by: Gottfried Haider <gottfried.haider at gmail.com>

Thanks!

On Thu, Sep 17, 2015 at 5:25 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> With the only C++ function having it's own wrapper we can 'demote' this
> file to a normal C one. This allows us to get rid of extern C {
> support C99 designated initializers in CPP code.
>
> This may cause build issue due to the missing dependency. If doing
> incremental build run the following:
>
> sed -i -e 's|samplers\.cpp|samplers.c|' src/glsl/nir/.deps/nir_lower_samplers.Plo
>
> Cc: Gottfried Haider <gottfried.haider at gmail.com>
> Reported-by: Gottfried Haider <gottfried.haider at gmail.com>
> Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
> ---
>
> Patch is generated with -M, so git might complain while applying
>
> -Emil
>
>  src/glsl/Makefile.sources                                     | 2 +-
>  src/glsl/nir/{nir_lower_samplers.cpp => nir_lower_samplers.c} | 6 ++----
>  2 files changed, 3 insertions(+), 5 deletions(-)
>  rename src/glsl/nir/{nir_lower_samplers.cpp => nir_lower_samplers.c} (98%)
>
> diff --git a/src/glsl/Makefile.sources b/src/glsl/Makefile.sources
> index da7fdf9..6bce2af 100644
> --- a/src/glsl/Makefile.sources
> +++ b/src/glsl/Makefile.sources
> @@ -42,7 +42,7 @@ NIR_FILES = \
>         nir/nir_lower_io.c \
>         nir/nir_lower_outputs_to_temporaries.c \
>         nir/nir_lower_phis_to_scalar.c \
> -       nir/nir_lower_samplers.cpp \
> +       nir/nir_lower_samplers.c \
>         nir/nir_lower_system_values.c \
>         nir/nir_lower_tex_projector.c \
>         nir/nir_lower_to_source_mods.c \
> diff --git a/src/glsl/nir/nir_lower_samplers.cpp b/src/glsl/nir/nir_lower_samplers.c
> similarity index 98%
> rename from src/glsl/nir/nir_lower_samplers.cpp
> rename to src/glsl/nir/nir_lower_samplers.c
> index c8e1faa..58ea0db 100644
> --- a/src/glsl/nir/nir_lower_samplers.cpp
> +++ b/src/glsl/nir/nir_lower_samplers.c
> @@ -29,12 +29,10 @@
>  #include "program/hash_table.h"
>  #include "ir_uniform.h"
>
> -extern "C" {
>  #include "main/compiler.h"
>  #include "main/mtypes.h"
>  #include "program/prog_parameter.h"
>  #include "program/program.h"
> -}
>
>  /* Calculate the sampler index based on array indicies and also
>   * calculate the base uniform location for struct members.
> @@ -78,7 +76,7 @@ calc_sampler_offsets(nir_deref *tail, nir_tex_instr *instr,
>
>     case nir_deref_type_struct: {
>        nir_deref_struct *deref_struct = nir_deref_as_struct(tail->child);
> -      *location += tail->type->record_location_offset(deref_struct->index);
> +      *location += glsl_get_record_location_offset(tail->type, deref_struct->index);
>        calc_sampler_offsets(tail->child, instr, array_elements,
>                             indirect, b, location);
>        break;
> @@ -179,7 +177,7 @@ lower_impl(nir_function_impl *impl, const struct gl_shader_program *shader_progr
>     nir_foreach_block(impl, lower_block_cb, &state);
>  }
>
> -extern "C" void
> +void
>  nir_lower_samplers(nir_shader *shader,
>                     const struct gl_shader_program *shader_program)
>  {
> --
> 2.5.0
>


More information about the mesa-dev mailing list