summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2018-04-30 20:39:43 +1000
committerTimothy Arceri <[email protected]>2018-05-01 12:39:33 +1000
commit6487e7a30c9e4c2a417ddfe632d5f68e065e21eb (patch)
tree561df9b47ea4efa99c89dd80dfd22a1a1e122ae8 /src/compiler
parentf56e22e49673e8234a7fe0c241b4c3eae4752f34 (diff)
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 <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/Makefile.sources7
-rw-r--r--src/compiler/glsl/gl_nir.h47
-rw-r--r--src/compiler/glsl/gl_nir_lower_atomics.c (renamed from src/compiler/nir/nir_lower_atomics.c)12
-rw-r--r--src/compiler/glsl/gl_nir_lower_samplers.c (renamed from src/compiler/nir/nir_lower_samplers.c)11
-rw-r--r--src/compiler/glsl/gl_nir_lower_samplers_as_deref.c (renamed from src/compiler/nir/nir_lower_samplers_as_deref.c)11
-rw-r--r--src/compiler/glsl/meson.build4
-rw-r--r--src/compiler/nir/meson.build3
-rw-r--r--src/compiler/nir/nir.h11
8 files changed, 74 insertions, 32 deletions
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index aca9dab476e..b98ea673705 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -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 \
diff --git a/src/compiler/glsl/gl_nir.h b/src/compiler/glsl/gl_nir.h
new file mode 100644
index 00000000000..59d5f65e659
--- /dev/null
+++ b/src/compiler/glsl/gl_nir.h
@@ -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 */
diff --git a/src/compiler/nir/nir_lower_atomics.c b/src/compiler/glsl/gl_nir_lower_atomics.c
index 383e3236102..e203b390b48 100644
--- a/src/compiler/nir/nir_lower_atomics.c
+++ b/src/compiler/glsl/gl_nir_lower_atomics.c
@@ -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;
diff --git a/src/compiler/nir/nir_lower_samplers.c b/src/compiler/glsl/gl_nir_lower_samplers.c
index 7690665de30..a53fabb7e62 100644
--- a/src/compiler/nir/nir_lower_samplers.c
+++ b/src/compiler/glsl/gl_nir_lower_samplers.c
@@ -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;
diff --git a/src/compiler/nir/nir_lower_samplers_as_deref.c b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
index cb0c827182c..47115f943fe 100644
--- a/src/compiler/nir/nir_lower_samplers_as_deref.c
+++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c
@@ -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;
diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
index 26ab4f1c8d3..055a84714c1 100644
--- a/src/compiler/glsl/meson.build
+++ b/src/compiler/glsl/meson.build
@@ -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',
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
index b28a565d0c6..84715a58912 100644
--- a/src/compiler/nir/meson.build
+++ b/src/compiler/nir/meson.build
@@ -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',
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index f3326e6df94..f8e71d54a50 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -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);