nir: move GL specific passes to src/compiler/glsl
With this we should have no passes in src/compiler/nir with any dependencies on headers from core GL Mesa. Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
This commit is contained in:
parent
f56e22e496
commit
6487e7a30c
|
@ -25,6 +25,10 @@ LIBGLSL_FILES = \
|
|||
glsl/builtin_types.cpp \
|
||||
glsl/builtin_variables.cpp \
|
||||
glsl/generate_ir.cpp \
|
||||
glsl/gl_nir_lower_atomics.c \
|
||||
glsl/gl_nir_lower_samplers.c \
|
||||
glsl/gl_nir_lower_samplers_as_deref.c \
|
||||
glsl/gl_nir.h \
|
||||
glsl/glsl_parser_extras.cpp \
|
||||
glsl/glsl_parser_extras.h \
|
||||
glsl/glsl_symbol_table.cpp \
|
||||
|
@ -211,7 +215,6 @@ NIR_FILES = \
|
|||
nir/nir_lower_64bit_packing.c \
|
||||
nir/nir_lower_alpha_test.c \
|
||||
nir/nir_lower_alu_to_scalar.c \
|
||||
nir/nir_lower_atomics.c \
|
||||
nir/nir_lower_atomics_to_ssbo.c \
|
||||
nir/nir_lower_bitmap.c \
|
||||
nir/nir_lower_clamp_color_outputs.c \
|
||||
|
@ -237,8 +240,6 @@ NIR_FILES = \
|
|||
nir/nir_lower_phis_to_scalar.c \
|
||||
nir/nir_lower_regs_to_ssa.c \
|
||||
nir/nir_lower_returns.c \
|
||||
nir/nir_lower_samplers.c \
|
||||
nir/nir_lower_samplers_as_deref.c \
|
||||
nir/nir_lower_subgroups.c \
|
||||
nir/nir_lower_system_values.c \
|
||||
nir/nir_lower_tex.c \
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright © 2018 Timothy Arceri
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef GL_NIR_H
|
||||
#define GL_NIR_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct nir_shader;
|
||||
struct gl_shader_program;
|
||||
|
||||
bool gl_nir_lower_atomics(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program,
|
||||
bool use_binding_as_idx);
|
||||
|
||||
bool gl_nir_lower_samplers(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program);
|
||||
bool gl_nir_lower_samplers_as_deref(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GL_NIR_H */
|
|
@ -25,8 +25,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "compiler/glsl/ir_uniform.h"
|
||||
#include "nir.h"
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "gl_nir.h"
|
||||
#include "ir_uniform.h"
|
||||
|
||||
#include "main/config.h"
|
||||
#include "main/mtypes.h"
|
||||
#include <assert.h>
|
||||
|
@ -177,9 +179,9 @@ lower_instr(nir_intrinsic_instr *instr,
|
|||
}
|
||||
|
||||
bool
|
||||
nir_lower_atomics(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program,
|
||||
bool use_binding_as_idx)
|
||||
gl_nir_lower_atomics(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program,
|
||||
bool use_binding_as_idx)
|
||||
{
|
||||
bool progress = false;
|
||||
|
|
@ -23,9 +23,10 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "nir.h"
|
||||
#include "nir_builder.h"
|
||||
#include "compiler/glsl/ir_uniform.h"
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "compiler/nir/nir_builder.h"
|
||||
#include "gl_nir.h"
|
||||
#include "ir_uniform.h"
|
||||
|
||||
#include "main/compiler.h"
|
||||
#include "main/mtypes.h"
|
||||
|
@ -148,8 +149,8 @@ lower_impl(nir_function_impl *impl, const struct gl_shader_program *shader_progr
|
|||
}
|
||||
|
||||
bool
|
||||
nir_lower_samplers(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program)
|
||||
gl_nir_lower_samplers(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program)
|
||||
{
|
||||
bool progress = false;
|
||||
|
|
@ -55,9 +55,10 @@
|
|||
* the opaque uniform mapping.
|
||||
*/
|
||||
|
||||
#include "nir.h"
|
||||
#include "nir_builder.h"
|
||||
#include "compiler/glsl/ir_uniform.h"
|
||||
#include "compiler/nir/nir.h"
|
||||
#include "compiler/nir/nir_builder.h"
|
||||
#include "gl_nir.h"
|
||||
#include "ir_uniform.h"
|
||||
|
||||
#include "main/compiler.h"
|
||||
#include "main/mtypes.h"
|
||||
|
@ -226,8 +227,8 @@ lower_impl(nir_function_impl *impl, struct lower_samplers_as_deref_state *state)
|
|||
}
|
||||
|
||||
bool
|
||||
nir_lower_samplers_as_deref(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program)
|
||||
gl_nir_lower_samplers_as_deref(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program)
|
||||
{
|
||||
bool progress = false;
|
||||
struct lower_samplers_as_deref_state state;
|
|
@ -66,6 +66,10 @@ files_libglsl = files(
|
|||
'builtin_types.cpp',
|
||||
'builtin_variables.cpp',
|
||||
'generate_ir.cpp',
|
||||
'gl_nir_lower_atomics.c',
|
||||
'gl_nir_lower_samplers.c',
|
||||
'gl_nir_lower_samplers_as_deref.c',
|
||||
'gl_nir.h',
|
||||
'glsl_parser_extras.cpp',
|
||||
'glsl_parser_extras.h',
|
||||
'glsl_symbol_table.cpp',
|
||||
|
|
|
@ -106,7 +106,6 @@ files_libnir = files(
|
|||
'nir_lower_64bit_packing.c',
|
||||
'nir_lower_alu_to_scalar.c',
|
||||
'nir_lower_alpha_test.c',
|
||||
'nir_lower_atomics.c',
|
||||
'nir_lower_atomics_to_ssbo.c',
|
||||
'nir_lower_bitmap.c',
|
||||
'nir_lower_clamp_color_outputs.c',
|
||||
|
@ -132,8 +131,6 @@ files_libnir = files(
|
|||
'nir_lower_phis_to_scalar.c',
|
||||
'nir_lower_regs_to_ssa.c',
|
||||
'nir_lower_returns.c',
|
||||
'nir_lower_samplers.c',
|
||||
'nir_lower_samplers_as_deref.c',
|
||||
'nir_lower_subgroups.c',
|
||||
'nir_lower_system_values.c',
|
||||
'nir_lower_tex.c',
|
||||
|
|
|
@ -55,9 +55,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct gl_program;
|
||||
struct gl_shader_program;
|
||||
|
||||
#define NIR_FALSE 0u
|
||||
#define NIR_TRUE (~0u)
|
||||
|
||||
|
@ -2596,11 +2593,6 @@ void nir_lower_io_arrays_to_elements_no_indirects(nir_shader *shader,
|
|||
void nir_lower_io_to_scalar(nir_shader *shader, nir_variable_mode mask);
|
||||
void nir_lower_io_to_scalar_early(nir_shader *shader, nir_variable_mode mask);
|
||||
|
||||
bool nir_lower_samplers(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program);
|
||||
bool nir_lower_samplers_as_deref(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program);
|
||||
|
||||
typedef struct nir_lower_subgroups_options {
|
||||
uint8_t subgroup_size;
|
||||
uint8_t ballot_bit_size;
|
||||
|
@ -2755,9 +2747,6 @@ typedef struct nir_lower_bitmap_options {
|
|||
|
||||
void nir_lower_bitmap(nir_shader *shader, const nir_lower_bitmap_options *options);
|
||||
|
||||
bool nir_lower_atomics(nir_shader *shader,
|
||||
const struct gl_shader_program *shader_program,
|
||||
bool use_binding_as_idx);
|
||||
bool nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset);
|
||||
bool nir_lower_to_source_mods(nir_shader *shader);
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage)
|
|||
|
||||
NIR_PASS_V(nir, nir_lower_system_values);
|
||||
NIR_PASS_V(nir, nir_lower_io, nir_var_all, ir3_glsl_type_size, 0);
|
||||
NIR_PASS_V(nir, nir_lower_samplers, prog);
|
||||
NIR_PASS_V(nir, gl_nir_lower_samplers, prog);
|
||||
|
||||
return nir;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "brw_context.h"
|
||||
#include "compiler/brw_nir.h"
|
||||
#include "brw_program.h"
|
||||
#include "compiler/glsl/gl_nir.h"
|
||||
#include "compiler/glsl/ir.h"
|
||||
#include "compiler/glsl/ir_optimization.h"
|
||||
#include "compiler/glsl/program.h"
|
||||
|
@ -299,8 +300,8 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg)
|
|||
struct gl_program *prog = shader->Program;
|
||||
brw_shader_gather_info(prog->nir, prog);
|
||||
|
||||
NIR_PASS_V(prog->nir, nir_lower_samplers, shProg);
|
||||
NIR_PASS_V(prog->nir, nir_lower_atomics, shProg, false);
|
||||
NIR_PASS_V(prog->nir, gl_nir_lower_samplers, shProg);
|
||||
NIR_PASS_V(prog->nir, gl_nir_lower_atomics, shProg, false);
|
||||
NIR_PASS_V(prog->nir, nir_lower_atomics_to_ssbo,
|
||||
prog->nir->info.num_abos);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct gl_shader_program;
|
||||
struct gl_context;
|
||||
struct gl_shader;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "compiler/nir/nir.h"
|
||||
#include "compiler/glsl_types.h"
|
||||
#include "compiler/glsl/glsl_to_nir.h"
|
||||
#include "compiler/glsl/gl_nir.h"
|
||||
#include "compiler/glsl/ir.h"
|
||||
#include "compiler/glsl/string_to_uint_map.h"
|
||||
|
||||
|
@ -467,7 +468,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
|
|||
st_set_prog_affected_state_flags(prog);
|
||||
|
||||
NIR_PASS_V(nir, st_nir_lower_builtin);
|
||||
NIR_PASS_V(nir, nir_lower_atomics, shader_program, true);
|
||||
NIR_PASS_V(nir, gl_nir_lower_atomics, shader_program, true);
|
||||
|
||||
if (st->ctx->_Shader->Flags & GLSL_DUMP) {
|
||||
_mesa_log("\n");
|
||||
|
@ -813,9 +814,9 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
|
|||
}
|
||||
|
||||
if (screen->get_param(screen, PIPE_CAP_NIR_SAMPLERS_AS_DEREF))
|
||||
NIR_PASS_V(nir, nir_lower_samplers_as_deref, shader_program);
|
||||
NIR_PASS_V(nir, gl_nir_lower_samplers_as_deref, shader_program);
|
||||
else
|
||||
NIR_PASS_V(nir, nir_lower_samplers, shader_program);
|
||||
NIR_PASS_V(nir, gl_nir_lower_samplers, shader_program);
|
||||
}
|
||||
|
||||
} /* extern "C" */
|
||||
|
|
Loading…
Reference in New Issue