mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
i965: Compute the maximum SF source attribute.
The maximum SF source attribute is necessary to compute the Vertex URB
read length properly, which will be done in the next commit.
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Tested-by: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit 5e9bc7bd12)
This commit is contained in:
parent
d47020b6d4
commit
2de8874ec3
3 changed files with 12 additions and 4 deletions
|
|
@ -232,7 +232,7 @@ void upload_default_color(struct brw_context *brw,
|
||||||
/* gen6_sf_state.c */
|
/* gen6_sf_state.c */
|
||||||
uint32_t
|
uint32_t
|
||||||
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
|
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
|
||||||
int fs_attr, bool two_side_color);
|
int fs_attr, bool two_side_color, uint32_t *max_source_attr);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
*/
|
*/
|
||||||
uint32_t
|
uint32_t
|
||||||
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
|
get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
|
||||||
int fs_attr, bool two_side_color)
|
int fs_attr, bool two_side_color, uint32_t *max_source_attr)
|
||||||
{
|
{
|
||||||
int vs_attr = _mesa_frag_attrib_to_vert_result(fs_attr);
|
int vs_attr = _mesa_frag_attrib_to_vert_result(fs_attr);
|
||||||
if (vs_attr < 0 || vs_attr == VERT_RESULT_HPOS) {
|
if (vs_attr < 0 || vs_attr == VERT_RESULT_HPOS) {
|
||||||
|
|
@ -101,6 +101,10 @@ get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset,
|
||||||
(vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL1 &&
|
(vue_map->slot_to_vert_result[slot] == VERT_RESULT_COL1 &&
|
||||||
vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC1));
|
vue_map->slot_to_vert_result[slot+1] == VERT_RESULT_BFC1));
|
||||||
|
|
||||||
|
/* Update max_source_attr. If swizzling, the SF will read this slot + 1. */
|
||||||
|
if (*max_source_attr < source_attr + swizzling)
|
||||||
|
*max_source_attr = source_attr + swizzling;
|
||||||
|
|
||||||
if (swizzling) {
|
if (swizzling) {
|
||||||
return source_attr |
|
return source_attr |
|
||||||
(ATTRIBUTE_SWIZZLE_INPUTATTR_FACING << ATTRIBUTE_SWIZZLE_SHIFT);
|
(ATTRIBUTE_SWIZZLE_INPUTATTR_FACING << ATTRIBUTE_SWIZZLE_SHIFT);
|
||||||
|
|
@ -281,6 +285,7 @@ upload_sf_state(struct brw_context *brw)
|
||||||
/* Create the mapping from the FS inputs we produce to the VS outputs
|
/* Create the mapping from the FS inputs we produce to the VS outputs
|
||||||
* they source from.
|
* they source from.
|
||||||
*/
|
*/
|
||||||
|
uint32_t max_source_attr = 0;
|
||||||
for (; attr < FRAG_ATTRIB_MAX; attr++) {
|
for (; attr < FRAG_ATTRIB_MAX; attr++) {
|
||||||
enum glsl_interp_qualifier interp_qualifier =
|
enum glsl_interp_qualifier interp_qualifier =
|
||||||
brw->fragment_program->InterpQualifier[attr];
|
brw->fragment_program->InterpQualifier[attr];
|
||||||
|
|
@ -316,7 +321,8 @@ upload_sf_state(struct brw_context *brw)
|
||||||
attr_overrides[input_index++] =
|
attr_overrides[input_index++] =
|
||||||
get_attr_override(&brw->vs.prog_data->vue_map,
|
get_attr_override(&brw->vs.prog_data->vue_map,
|
||||||
urb_entry_read_offset, attr,
|
urb_entry_read_offset, attr,
|
||||||
ctx->VertexProgram._TwoSideEnabled);
|
ctx->VertexProgram._TwoSideEnabled,
|
||||||
|
&max_source_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; input_index < FRAG_ATTRIB_MAX; input_index++)
|
for (; input_index < FRAG_ATTRIB_MAX; input_index++)
|
||||||
|
|
|
||||||
|
|
@ -84,6 +84,7 @@ upload_sbe_state(struct brw_context *brw)
|
||||||
/* Create the mapping from the FS inputs we produce to the VS outputs
|
/* Create the mapping from the FS inputs we produce to the VS outputs
|
||||||
* they source from.
|
* they source from.
|
||||||
*/
|
*/
|
||||||
|
uint32_t max_source_attr = 0;
|
||||||
for (; attr < FRAG_ATTRIB_MAX; attr++) {
|
for (; attr < FRAG_ATTRIB_MAX; attr++) {
|
||||||
enum glsl_interp_qualifier interp_qualifier =
|
enum glsl_interp_qualifier interp_qualifier =
|
||||||
brw->fragment_program->InterpQualifier[attr];
|
brw->fragment_program->InterpQualifier[attr];
|
||||||
|
|
@ -118,7 +119,8 @@ upload_sbe_state(struct brw_context *brw)
|
||||||
attr_overrides[input_index++] =
|
attr_overrides[input_index++] =
|
||||||
get_attr_override(&brw->vs.prog_data->vue_map,
|
get_attr_override(&brw->vs.prog_data->vue_map,
|
||||||
urb_entry_read_offset, attr,
|
urb_entry_read_offset, attr,
|
||||||
ctx->VertexProgram._TwoSideEnabled);
|
ctx->VertexProgram._TwoSideEnabled,
|
||||||
|
&max_source_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; input_index < FRAG_ATTRIB_MAX; input_index++)
|
for (; input_index < FRAG_ATTRIB_MAX; input_index++)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue