17ec681f3Smrg/* 27ec681f3Smrg * Copyright (C) 2018-2019 Alyssa Rosenzweig <alyssa@rosenzweig.io> 37ec681f3Smrg * Copyright (C) 2019-2020 Collabora, Ltd. 47ec681f3Smrg * 57ec681f3Smrg * Permission is hereby granted, free of charge, to any person obtaining a 67ec681f3Smrg * copy of this software and associated documentation files (the "Software"), 77ec681f3Smrg * to deal in the Software without restriction, including without limitation 87ec681f3Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 97ec681f3Smrg * and/or sell copies of the Software, and to permit persons to whom the 107ec681f3Smrg * Software is furnished to do so, subject to the following conditions: 117ec681f3Smrg * 127ec681f3Smrg * The above copyright notice and this permission notice (including the next 137ec681f3Smrg * paragraph) shall be included in all copies or substantial portions of the 147ec681f3Smrg * Software. 157ec681f3Smrg * 167ec681f3Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 177ec681f3Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 187ec681f3Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 197ec681f3Smrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 207ec681f3Smrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 217ec681f3Smrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 227ec681f3Smrg * SOFTWARE. 237ec681f3Smrg */ 247ec681f3Smrg 257ec681f3Smrg#ifndef __MIDGARD_H_ 267ec681f3Smrg#define __MIDGARD_H_ 277ec681f3Smrg 287ec681f3Smrg#include "compiler/nir/nir.h" 297ec681f3Smrg#include "util/u_dynarray.h" 307ec681f3Smrg#include "panfrost/util/pan_ir.h" 317ec681f3Smrg 327ec681f3Smrgvoid 337ec681f3Smrgmidgard_compile_shader_nir(nir_shader *nir, 347ec681f3Smrg const struct panfrost_compile_inputs *inputs, 357ec681f3Smrg struct util_dynarray *binary, 367ec681f3Smrg struct pan_shader_info *info); 377ec681f3Smrg 387ec681f3Smrg/* NIR options are shared between the standalone compiler and the online 397ec681f3Smrg * compiler. Defining it here is the simplest, though maybe not the Right 407ec681f3Smrg * solution. */ 417ec681f3Smrg 427ec681f3Smrgstatic const nir_shader_compiler_options midgard_nir_options = { 437ec681f3Smrg .lower_ffma16 = true, 447ec681f3Smrg .lower_ffma32 = true, 457ec681f3Smrg .lower_ffma64 = true, 467ec681f3Smrg .lower_scmp = true, 477ec681f3Smrg .lower_flrp16 = true, 487ec681f3Smrg .lower_flrp32 = true, 497ec681f3Smrg .lower_flrp64 = true, 507ec681f3Smrg .lower_ffract = true, 517ec681f3Smrg .lower_fmod = true, 527ec681f3Smrg .lower_fdiv = true, 537ec681f3Smrg .lower_isign = true, 547ec681f3Smrg .lower_fpow = true, 557ec681f3Smrg .lower_find_lsb = true, 567ec681f3Smrg .lower_ifind_msb = true, 577ec681f3Smrg .lower_fdph = true, 587ec681f3Smrg 597ec681f3Smrg .lower_wpos_pntc = true, 607ec681f3Smrg 617ec681f3Smrg /* TODO: We have native ops to help here, which we'll want to look into 627ec681f3Smrg * eventually */ 637ec681f3Smrg .lower_fsign = true, 647ec681f3Smrg 657ec681f3Smrg .lower_bit_count = true, 667ec681f3Smrg .lower_bitfield_reverse = true, 677ec681f3Smrg .lower_bitfield_insert_to_shifts = true, 687ec681f3Smrg .lower_bitfield_extract_to_shifts = true, 697ec681f3Smrg .lower_extract_byte = true, 707ec681f3Smrg .lower_extract_word = true, 717ec681f3Smrg .lower_insert_byte = true, 727ec681f3Smrg .lower_insert_word = true, 737ec681f3Smrg .lower_rotate = true, 747ec681f3Smrg 757ec681f3Smrg .lower_pack_half_2x16 = true, 767ec681f3Smrg .lower_pack_unorm_2x16 = true, 777ec681f3Smrg .lower_pack_snorm_2x16 = true, 787ec681f3Smrg .lower_pack_unorm_4x8 = true, 797ec681f3Smrg .lower_pack_snorm_4x8 = true, 807ec681f3Smrg .lower_unpack_half_2x16 = true, 817ec681f3Smrg .lower_unpack_unorm_2x16 = true, 827ec681f3Smrg .lower_unpack_snorm_2x16 = true, 837ec681f3Smrg .lower_unpack_unorm_4x8 = true, 847ec681f3Smrg .lower_unpack_snorm_4x8 = true, 857ec681f3Smrg .lower_pack_split = true, 867ec681f3Smrg 877ec681f3Smrg .lower_doubles_options = nir_lower_dmod, 887ec681f3Smrg 897ec681f3Smrg .lower_bitfield_extract_to_shifts = true, 907ec681f3Smrg .lower_uniforms_to_ubo = true, 917ec681f3Smrg .has_fsub = true, 927ec681f3Smrg .has_isub = true, 937ec681f3Smrg .vectorize_io = true, 947ec681f3Smrg .use_interpolated_input_intrinsics = true, 957ec681f3Smrg 967ec681f3Smrg .vertex_id_zero_based = true, 977ec681f3Smrg .has_cs_global_id = true, 987ec681f3Smrg .lower_cs_local_index_from_id = true, 997ec681f3Smrg .max_unroll_iterations = 32, 1007ec681f3Smrg .force_indirect_unrolling = (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp), 1017ec681f3Smrg}; 1027ec681f3Smrg 1037ec681f3Smrg#endif 104