nir/edgeflags: Add a flag to indicate the edge flag input is needed
Most modern hardware needs the edge flag added as a hidden vertex input and needs code added to the vertex shader to copy the input to an output. Intel hardware is a little different. Gfx4 and Gfx5 hardware works in the previously described mannter. Gfx6+ hardware needs the edge flag as a specific vertex shader input, and that input is magically processed by fixed-function hardware without need for extra shader code. This flag signals only that the vertex shader input is needed. It would be nice if we could decouple adding the vertex shader input from generating the copy-to-output code, but that has proven to be challenging. Not having that code causes other passes to want to eliminate that shader input. v2: Convert conditional to assertion. This pass is only called for vertex shaders. Suggested by Ken. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12858>
This commit is contained in:
parent
3281ccf4b1
commit
d7ba52cce9
|
@ -96,5 +96,9 @@ lower_impl(nir_function_impl *impl)
|
|||
|
||||
void nir_lower_passthrough_edgeflags(nir_shader *shader)
|
||||
{
|
||||
assert(shader->info.stage == MESA_SHADER_VERTEX);
|
||||
|
||||
shader->info.vs.needs_edge_flag = true;
|
||||
|
||||
lower_impl(nir_shader_get_entrypoint(shader));
|
||||
}
|
||||
|
|
|
@ -297,6 +297,9 @@ typedef struct shader_info {
|
|||
|
||||
/* True if the shader writes position in window space coordinates pre-transform */
|
||||
bool window_space_position:1;
|
||||
|
||||
/** Is an edge flag input needed? */
|
||||
bool needs_edge_flag:1;
|
||||
} vs;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -2441,6 +2441,7 @@ iris_create_uncompiled_shader(struct iris_screen *screen,
|
|||
simple_mtx_init(&ish->lock, mtx_plain);
|
||||
|
||||
NIR_PASS(ish->needs_edge_flag, nir, iris_fix_edge_flags);
|
||||
assert(ish->needs_edge_flag == nir->info.vs.needs_edge_flag);
|
||||
|
||||
brw_preprocess_nir(screen->compiler, nir, NULL);
|
||||
|
||||
|
|
Loading…
Reference in New Issue