summaryrefslogtreecommitdiffstats
path: root/src/intel/compiler/brw_compiler.h
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-28 16:25:31 -0700
committerJason Ekstrand <[email protected]>2017-10-12 22:39:29 -0700
commit2975e4c56a7aeade5a324aa4d446f18cc176fa06 (patch)
treef08787f03d0781b1d7823095acabf3e86d5522ec /src/intel/compiler/brw_compiler.h
parentfaad828b16448c1008a1b15ac8d8a72b13005c09 (diff)
intel: Rewrite the world of push/pull params
This moves us away to the array of pointers model and onto a model where each param is represented by a generic uint32_t handle. We reserve 2^16 of these handles for builtins that get generated by somewhere inside the compiler and have well-defined meanings. Generic params have handles whose meanings are defined by the driver. The primary downside to this new approach is that it moves a little bit of the work that we would normally do at compile time to draw time. On my laptop this hurts OglBatch6 by no more than 1% and doesn't seem to have any measurable affect on OglBatch7. So, while this may come back to bite us, it doesn't look too bad. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/intel/compiler/brw_compiler.h')
-rw-r--r--src/intel/compiler/brw_compiler.h73
1 files changed, 67 insertions, 6 deletions
diff --git a/src/intel/compiler/brw_compiler.h b/src/intel/compiler/brw_compiler.h
index 038f3f95512..f2f9be750a0 100644
--- a/src/intel/compiler/brw_compiler.h
+++ b/src/intel/compiler/brw_compiler.h
@@ -36,7 +36,6 @@ extern "C" {
struct ra_regs;
struct nir_shader;
struct brw_program;
-union gl_constant_value;
struct brw_compiler {
const struct gen_device_info *devinfo;
@@ -491,6 +490,66 @@ struct brw_ubo_range
uint8_t length;
};
+/* We reserve the first 2^16 values for builtins */
+#define BRW_PARAM_IS_BUILTIN(param) (((param) & 0xffff0000) == 0)
+
+enum brw_param_builtin {
+ BRW_PARAM_BUILTIN_ZERO,
+
+ BRW_PARAM_BUILTIN_CLIP_PLANE_0_X,
+ BRW_PARAM_BUILTIN_CLIP_PLANE_0_Y,
+ BRW_PARAM_BUILTIN_CLIP_PLANE_0_Z,
+ BRW_P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LEVEL_OUTER_Y,
+ BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_Z,
+ BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_W,
+ BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_X,
+ BRW_PARAM_BUILTIN_TESS_LEVEL_INNER_Y,
+};
+
+#define BRW_PARAM_BUILTIN_CLIP_PLANE(idx, comp) \
+ (BRW_PARAM_BUILTIN_CLIP_PLANE_0_X + ((idx) << 2) + (comp))
+
+#define BRW_PARAM_BUILTIN_IS_CLIP_PLANE(param) \
+ ((param) >= BRW_PARAM_BUILTIN_CLIP_PLANE_0_X && \
+ (param) <= BRW_PARAM_BUILTIN_CLIP_PLANE_7_W)
+
+#define BRW_PARAM_BUILTIN_CLIP_PLANE_IDX(param) \
+ (((param) - BRW_PARAM_BUILTIN_CLIP_PLANE_0_X) >> 2)
+
+#define BRW_PARAM_BUILTIN_CLIP_PLANE_COMP(param) \
+ (((param) - BRW_PARAM_BUILTIN_CLIP_PLANE_0_X) & 0x3)
+
struct brw_stage_prog_data {
struct {
/** size of our binding table. */
@@ -529,11 +588,14 @@ struct brw_stage_prog_data {
bool use_alt_mode; /**< Use ALT floating point mode? Otherwise, IEEE. */
- /* Pointers to tracked values (only valid once
- * _mesa_load_state_parameters has been called at runtime).
+ /* 32-bit identifiers for all push/pull parameters. These can be anything
+ * the driver wishes them to be; the core of the back-end compiler simply
+ * re-arranges them. The one restriction is that the bottom 2^16 values
+ * are reserved for builtins defined in the brw_param_builtin enum defined
+ * above.
*/
- const union gl_constant_value **param;
- const union gl_constant_value **pull_param;
+ uint32_t *param;
+ uint32_t *pull_param;
/** Image metadata passed to the shader as uniforms. */
struct brw_image_param *image_param;
@@ -1020,7 +1082,6 @@ brw_compile_vs(const struct brw_compiler *compiler, void *log_data,
const struct brw_vs_prog_key *key,
struct brw_vs_prog_data *prog_data,
const struct nir_shader *shader,
- gl_clip_plane *clip_planes,
bool use_legacy_snorm_formula,
int shader_time_index,
unsigned *final_assembly_size,