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
55 * Maximum control flow nesting
59 #define LP_MAX_TGSI_NESTING 32
62 * Maximum iterations before loop termination
63 * Shared between every loop in a TGSI shader
65 #define LP_MAX_TGSI_LOOP_ITERATIONS 65535
69 * Some of these limits are actually infinite (i.e., only limited by available
70 * memory), however advertising INT_MAX would cause some test problems to
71 * actually try to allocate the maximum and run out of memory and crash. So
72 * stick with something reasonable here.
75 gallivm_get_shader_param(enum pipe_shader_cap param
)
78 case PIPE_SHADER_CAP_MAX_INSTRUCTIONS
:
79 case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS
:
80 case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS
:
81 case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS
:
82 return 1 * 1024 * 1024;
83 case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH
:
84 return LP_MAX_TGSI_NESTING
;
85 case PIPE_SHADER_CAP_MAX_INPUTS
:
86 return PIPE_MAX_SHADER_INPUTS
;
87 case PIPE_SHADER_CAP_MAX_CONSTS
:
89 case PIPE_SHADER_CAP_MAX_CONST_BUFFERS
:
90 return PIPE_MAX_CONSTANT_BUFFERS
;
91 case PIPE_SHADER_CAP_MAX_TEMPS
:
92 return LP_MAX_TGSI_TEMPS
;
93 case PIPE_SHADER_CAP_MAX_ADDRS
:
94 return LP_MAX_TGSI_ADDRS
;
95 case PIPE_SHADER_CAP_MAX_PREDS
:
96 return LP_MAX_TGSI_PREDS
;
97 case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED
:
99 case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR
:
100 case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR
:
101 case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR
:
102 case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR
:
104 case PIPE_SHADER_CAP_SUBROUTINES
:
106 case PIPE_SHADER_CAP_INTEGERS
:
108 case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS
:
109 return PIPE_MAX_SAMPLERS
;
116 #endif /* LP_BLD_LIMITS_H_ */