1 /**************************************************************************
3 * Copyright 2010-2012 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
26 **************************************************************************/
29 #ifndef LP_BLD_LIMITS_H_
30 #define LP_BLD_LIMITS_H_
35 #include "pipe/p_state.h"
36 #include "pipe/p_defines.h"
40 * TGSI translation limits.
42 * Some are slightly above SM 3.0 requirements to give some wiggle room to
46 #define LP_MAX_TGSI_TEMPS 256
48 #define LP_MAX_TGSI_ADDRS 16
50 #define LP_MAX_TGSI_IMMEDIATES 256
52 #define LP_MAX_TGSI_PREDS 16
54 #define LP_MAX_TGSI_CONST_BUFFERS 16
58 * Maximum control flow nesting
62 #define LP_MAX_TGSI_NESTING 32
65 * Maximum iterations before loop termination
66 * Shared between every loop in a TGSI shader
68 #define LP_MAX_TGSI_LOOP_ITERATIONS 65535
72 * Some of these limits are actually infinite (i.e., only limited by available
73 * memory), however advertising INT_MAX would cause some test problems to
74 * actually try to allocate the maximum and run out of memory and crash. So
75 * stick with something reasonable here.
78 gallivm_get_shader_param(enum pipe_shader_cap param
)
81 case PIPE_SHADER_CAP_MAX_INSTRUCTIONS
:
82 case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS
:
83 case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS
:
84 case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS
:
85 return 1 * 1024 * 1024;
86 case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH
:
87 return LP_MAX_TGSI_NESTING
;
88 case PIPE_SHADER_CAP_MAX_INPUTS
:
89 return PIPE_MAX_SHADER_INPUTS
;
90 case PIPE_SHADER_CAP_MAX_CONSTS
:
92 case PIPE_SHADER_CAP_MAX_CONST_BUFFERS
:
93 return PIPE_MAX_CONSTANT_BUFFERS
;
94 case PIPE_SHADER_CAP_MAX_TEMPS
:
95 return LP_MAX_TGSI_TEMPS
;
96 case PIPE_SHADER_CAP_MAX_ADDRS
:
97 return LP_MAX_TGSI_ADDRS
;
98 case PIPE_SHADER_CAP_MAX_PREDS
:
99 return LP_MAX_TGSI_PREDS
;
100 case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED
:
102 case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR
:
103 case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR
:
104 case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR
:
105 case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR
:
107 case PIPE_SHADER_CAP_SUBROUTINES
:
109 case PIPE_SHADER_CAP_INTEGERS
:
111 case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS
:
112 return PIPE_MAX_SAMPLERS
;
119 #endif /* LP_BLD_LIMITS_H_ */