ac/nir: use new LLVM 8 intrinsics for SSBO atomics except cmpswap
[mesa.git] / src / amd / common / ac_nir_to_llvm.h
index ca06d059a6d0d09fc1c43d15c58e2b64daa3bd88..4782d9fc9d64d70b439d15965aa1845e063a8e6d 100644 (file)
  * IN THE SOFTWARE.
  */
 
-#pragma once
+#ifndef AC_NIR_TO_LLVM_H
+#define AC_NIR_TO_LLVM_H
 
 #include <stdbool.h>
 #include "llvm-c/Core.h"
 #include "llvm-c/TargetMachine.h"
 #include "amd_family.h"
+#include "compiler/shader_enums.h"
 
-struct ac_shader_binary;
-struct ac_shader_config;
 struct nir_shader;
-struct radv_pipeline_layout;
+struct nir_variable;
+struct ac_llvm_context;
+struct ac_shader_abi;
 
+/* Interpolation locations */
+#define INTERP_CENTER 0
+#define INTERP_CENTROID 1
+#define INTERP_SAMPLE 2
 
-struct ac_vs_variant_key {
-       uint32_t instance_rate_inputs;
-};
+static inline unsigned ac_llvm_reg_index_soa(unsigned index, unsigned chan)
+{
+       return (index * 4) + chan;
+}
 
-struct ac_fs_variant_key {
-       uint32_t col_format;
-       uint32_t is_int8;
-};
+void ac_lower_indirect_derefs(struct nir_shader *nir, enum chip_class);
 
-union ac_shader_variant_key {
-       struct ac_vs_variant_key vs;
-       struct ac_fs_variant_key fs;
-};
+bool ac_are_tessfactors_def_in_all_invocs(const struct nir_shader *nir);
 
-struct ac_nir_compiler_options {
-       struct radv_pipeline_layout *layout;
-       union ac_shader_variant_key key;
-       bool unsafe_math;
-       enum radeon_family family;
-       enum chip_class chip_class;
-};
+void ac_nir_translate(struct ac_llvm_context *ac, struct ac_shader_abi *abi,
+                     struct nir_shader *nir);
 
-struct ac_shader_variant_info {
-       unsigned num_user_sgprs;
-       unsigned num_input_sgprs;
-       unsigned num_input_vgprs;
-       union {
-               struct {
-                       unsigned param_exports;
-                       unsigned pos_exports;
-                       unsigned vgpr_comp_cnt;
-                       uint32_t export_mask;
-                       bool writes_pointsize;
-                       uint8_t clip_dist_mask;
-                       uint8_t cull_dist_mask;
-               } vs;
-               struct {
-                       unsigned num_interp;
-                       uint32_t input_mask;
-                       unsigned output_mask;
-                       uint32_t flat_shaded_mask;
-                       bool has_pcoord;
-                       bool can_discard;
-                       bool writes_z;
-                       bool writes_stencil;
-                       bool early_fragment_test;
-                       bool writes_memory;
-               } fs;
-               struct {
-                       unsigned block_size[3];
-               } cs;
-       };
-};
+void
+ac_handle_shader_output_decl(struct ac_llvm_context *ctx,
+                            struct ac_shader_abi *abi,
+                            struct nir_shader *nir,
+                            struct nir_variable *variable,
+                            gl_shader_stage stage);
 
-void ac_compile_nir_shader(LLVMTargetMachineRef tm,
-                           struct ac_shader_binary *binary,
-                           struct ac_shader_config *config,
-                           struct ac_shader_variant_info *shader_info,
-                           struct nir_shader *nir,
-                           const struct ac_nir_compiler_options *options,
-                          bool dump_shader);
-
-/* SHADER ABI defines */
-
-/* offset in dwords */
-#define AC_USERDATA_DESCRIPTOR_SET_0 0
-#define AC_USERDATA_DESCRIPTOR_SET_1 2
-#define AC_USERDATA_DESCRIPTOR_SET_2 4
-#define AC_USERDATA_DESCRIPTOR_SET_3 6
-#define AC_USERDATA_PUSH_CONST_DYN 8
-
-#define AC_USERDATA_VS_VERTEX_BUFFERS 10
-#define AC_USERDATA_VS_BASE_VERTEX 12
-#define AC_USERDATA_VS_START_INSTANCE 13
-
-#define AC_USERDATA_PS_SAMPLE_POS 10
-
-#define AC_USERDATA_CS_GRID_SIZE 10
+void ac_emit_barrier(struct ac_llvm_context *ac, gl_shader_stage stage);
 
+#endif /* AC_NIR_TO_LLVM_H */