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 <jordan.l.justen@intel.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -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_PARAM_BUILTIN_CLIP_PLANE_0_W,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_1_X,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_1_Y,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_1_Z,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_1_W,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_2_X,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_2_Y,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_2_Z,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_2_W,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_3_X,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_3_Y,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_3_Z,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_3_W,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_4_X,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_4_Y,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_4_Z,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_4_W,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_5_X,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_5_Y,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_5_Z,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_5_W,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_6_X,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_6_Y,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_6_Z,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_6_W,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_7_X,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_7_Y,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_7_Z,
|
||||
BRW_PARAM_BUILTIN_CLIP_PLANE_7_W,
|
||||
|
||||
BRW_PARAM_BUILTIN_TESS_LEVEL_OUTER_X,
|
||||
BRW_PARAM_BUILTIN_TESS_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,
|
||||
|
Reference in New Issue
Block a user