mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
nir: Move nir_tcs_info to separate file.
The nir_tcs_info struct is like nir_xfb_info in the sense that it's very specialized and not often used, so it deserves its own header too. Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33439>
This commit is contained in:
parent
a6247319e7
commit
cccd3aa45c
8 changed files with 86 additions and 38 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "ac_nir.h"
|
||||
#include "ac_nir_helpers.h"
|
||||
#include "nir_builder.h"
|
||||
#include "nir_tcs_info.h"
|
||||
#include "util/u_math.h"
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#include "nir.h"
|
||||
#include "nir_tcs_info.h"
|
||||
#include "radv_constants.h"
|
||||
#include "radv_shader_args.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -295,6 +295,7 @@ files_libnir = files(
|
|||
'nir_split_vars.c',
|
||||
'nir_sweep.c',
|
||||
'nir_to_lcssa.c',
|
||||
'nir_tcs_info.h',
|
||||
'nir_trivialize_registers.c',
|
||||
'nir_use_dominance.c',
|
||||
'nir_validate.c',
|
||||
|
|
|
|||
|
|
@ -5621,44 +5621,6 @@ void nir_gather_types(nir_function_impl *impl,
|
|||
BITSET_WORD *float_types,
|
||||
BITSET_WORD *int_types);
|
||||
|
||||
typedef struct nir_tcs_info {
|
||||
/* Whether all invocations write tess level outputs.
|
||||
*
|
||||
* This is useful when a pass wants to read tess level values at the end
|
||||
* of the shader. If this is true, the pass doesn't have to insert a barrier
|
||||
* and use output loads, it can just use the SSA defs that are being stored
|
||||
* (or phis thereof) to get the tess level output values.
|
||||
*/
|
||||
bool all_invocations_define_tess_levels;
|
||||
|
||||
/* Whether any of the outer tess level components is effectively 0, meaning
|
||||
* that the shader discards the patch. NaNs and negative values are included
|
||||
* in this. If the patch is discarded, inner tess levels have no effect.
|
||||
*/
|
||||
bool all_tess_levels_are_effectively_zero;
|
||||
|
||||
/* Whether all tess levels are effectively 1, meaning that the tessellator
|
||||
* behaves as if they were 1. There is a range of values that lead to that
|
||||
* behavior depending on the tessellation spacing.
|
||||
*/
|
||||
bool all_tess_levels_are_effectively_one;
|
||||
|
||||
/* Whether the shader uses a barrier synchronizing TCS output stores.
|
||||
* For example, passes that write an output at the beginning of the shader
|
||||
* and load it at the end can use this to determine whether they have to
|
||||
* insert a barrier or whether the shader already contains a barrier.
|
||||
*/
|
||||
bool always_executes_barrier;
|
||||
|
||||
/* Whether outer tess levels <= 0 are written anywhere in the shader. */
|
||||
bool discards_patches;
|
||||
} nir_tcs_info;
|
||||
|
||||
void
|
||||
nir_gather_tcs_info(const nir_shader *nir, nir_tcs_info *info,
|
||||
enum tess_primitive_mode prim,
|
||||
enum gl_tess_spacing spacing);
|
||||
|
||||
void nir_assign_var_locations(nir_shader *shader, nir_variable_mode mode,
|
||||
unsigned *size,
|
||||
int (*type_size)(const struct glsl_type *, bool));
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "nir_tcs_info.h"
|
||||
#include "nir.h"
|
||||
#include <math.h>
|
||||
|
||||
|
|
|
|||
80
src/compiler/nir/nir_tcs_info.h
Normal file
80
src/compiler/nir/nir_tcs_info.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Copyright © 2024 Advanced Micro Devices, Inc.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Authors:
|
||||
* Marek Olšák <marek.olsak@amd.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NIR_TCS_INFO_H
|
||||
#define NIR_TCS_INFO_H
|
||||
|
||||
#include "compiler/shader_enums.h"
|
||||
#include "nir_defines.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct nir_tcs_info {
|
||||
/* Whether all invocations write tess level outputs.
|
||||
*
|
||||
* This is useful when a pass wants to read tess level values at the end
|
||||
* of the shader. If this is true, the pass doesn't have to insert a barrier
|
||||
* and use output loads, it can just use the SSA defs that are being stored
|
||||
* (or phis thereof) to get the tess level output values.
|
||||
*/
|
||||
bool all_invocations_define_tess_levels;
|
||||
|
||||
/* Whether any of the outer tess level components is effectively 0, meaning
|
||||
* that the shader discards the patch. NaNs and negative values are included
|
||||
* in this. If the patch is discarded, inner tess levels have no effect.
|
||||
*/
|
||||
bool all_tess_levels_are_effectively_zero;
|
||||
|
||||
/* Whether all tess levels are effectively 1, meaning that the tessellator
|
||||
* behaves as if they were 1. There is a range of values that lead to that
|
||||
* behavior depending on the tessellation spacing.
|
||||
*/
|
||||
bool all_tess_levels_are_effectively_one;
|
||||
|
||||
/* Whether the shader uses a barrier synchronizing TCS output stores.
|
||||
* For example, passes that write an output at the beginning of the shader
|
||||
* and load it at the end can use this to determine whether they have to
|
||||
* insert a barrier or whether the shader already contains a barrier.
|
||||
*/
|
||||
bool always_executes_barrier;
|
||||
|
||||
/* Whether outer tess levels <= 0 are written anywhere in the shader. */
|
||||
bool discards_patches;
|
||||
} nir_tcs_info;
|
||||
|
||||
void
|
||||
nir_gather_tcs_info(const nir_shader *nir, nir_tcs_info *info,
|
||||
enum tess_primitive_mode prim,
|
||||
enum gl_tess_spacing spacing);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* NIR_TCS_INFO_H */
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
#include "nir.h"
|
||||
#include "nir_builder.h"
|
||||
#include "nir_serialize.h"
|
||||
#include "nir_tcs_info.h"
|
||||
#include "nir_xfb_info.h"
|
||||
#include "si_pipe.h"
|
||||
#include "si_shader_internal.h"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "util/mesa-sha1.h"
|
||||
#include "sid.h"
|
||||
#include "nir.h"
|
||||
#include "nir_tcs_info.h"
|
||||
#include "nir_xfb_info.h"
|
||||
#include "aco_interface.h"
|
||||
#include "ac_nir.h"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue