zink: add a special separate shader i/o mode for legacy variables

ARB shaders have no rules restricting i/o interfaces since it's assumed
that they'll match by name. given that mesa marks these all as separate
shaders, a separate path is needed to ensure these variables correctly
match up their i/o even when it's mismatched

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24608>
This commit is contained in:
Mike Blumenkrantz
2023-08-10 07:46:35 -04:00
committed by Marge Bot
parent b24911e5db
commit 0a12cedec9
2 changed files with 20 additions and 28 deletions

View File

@@ -298,26 +298,6 @@ spec@ext_transform_feedback@tessellation quad_strip wireframe,Fail
spec@ext_transform_feedback@tessellation quads wireframe,Fail
# Regressed between 1080ff39717b92b99afcf51283bec3994deae376..ef01a9cf3b465889fe8084732264dad0580270c3
spec@!opengl 1.0@gl-1.0-drawpixels-stencil-test,Fail
spec@!opengl 1.0@gl-1.0-rastercolor,Fail
spec@!opengl 1.1@depthstencil-default_fb-drawpixels-float-and-ushort,Fail
spec@!opengl 1.1@depthstencil-default_fb-drawpixels-float-and-ushort samples=2,Fail
spec@!opengl 1.1@depthstencil-default_fb-drawpixels-float-and-ushort samples=4,Fail
spec@!opengl 1.1@depthstencil-default_fb-drawpixels-float-and-ushort samples=6,Fail
spec@!opengl 1.1@depthstencil-default_fb-drawpixels-float-and-ushort samples=8,Fail
spec@arb_color_buffer_float@gl_rgba16f-render,Fail
spec@arb_color_buffer_float@gl_rgba16f-render-sanity,Fail
spec@arb_color_buffer_float@gl_rgba32f-render,Fail
spec@arb_color_buffer_float@gl_rgba32f-render-sanity,Fail
spec@arb_color_buffer_float@gl_rgba8-render,Fail
spec@arb_color_buffer_float@gl_rgba8-render-sanity,Fail
spec@arb_color_buffer_float@gl_rgba8_snorm-render,Fail
spec@arb_color_buffer_float@gl_rgba8_snorm-render-sanity,Fail
spec@arb_depth_buffer_float@fbo-clear-formats stencil,Fail
spec@arb_depth_buffer_float@fbo-clear-formats stencil@GL_DEPTH32F_STENCIL8,Fail
spec@arb_depth_buffer_float@fbo-depthstencil-gl_depth32f_stencil8-drawpixels-float-and-ushort,Fail
spec@arb_depth_buffer_float@fbo-stencil-gl_depth32f_stencil8-drawpixels,Fail
spec@arb_fragment_program@fdo38145,Fail
spec@arb_sample_shading@samplemask 2,Fail
spec@arb_sample_shading@samplemask 2 all,Fail
spec@arb_sample_shading@samplemask 2 all@0.500000 mask_in_one,Fail
@@ -393,14 +373,6 @@ spec@ext_framebuffer_multisample@interpolation 8 centroid-deriv-disabled,Fail
spec@ext_framebuffer_multisample@interpolation 8 centroid-disabled,Fail
spec@ext_framebuffer_multisample@interpolation 8 non-centroid-deriv-disabled,Fail
spec@ext_framebuffer_multisample@interpolation 8 non-centroid-disabled,Fail
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index1-drawpixels,Fail
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index16-drawpixels,Fail
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index4-drawpixels,Fail
spec@ext_framebuffer_object@fbo-stencil-gl_stencil_index8-drawpixels,Fail
spec@ext_packed_depth_stencil@fbo-clear-formats stencil,Fail
spec@ext_packed_depth_stencil@fbo-clear-formats stencil@GL_DEPTH_STENCIL,Fail
spec@ext_packed_depth_stencil@fbo-depthstencil-gl_depth24_stencil8-drawpixels-float-and-ushort,Fail
spec@ext_packed_depth_stencil@fbo-stencil-gl_depth24_stencil8-drawpixels,Fail
# Polygon smoothing isn't supported in Vulkan.
spec@!opengl 1.0@gl-1.0-polygon-line-aa,Fail

View File

@@ -4755,6 +4755,26 @@ fixup_io_locations(nir_shader *nir)
modes = nir->info.stage == MESA_SHADER_FRAGMENT ? nir_var_shader_in : nir_var_shader_out;
u_foreach_bit(mode, modes) {
nir_variable_mode m = BITFIELD_BIT(mode);
if ((m == nir_var_shader_in && ((nir->info.inputs_read & BITFIELD64_MASK(VARYING_SLOT_VAR1)) == nir->info.inputs_read)) ||
(m == nir_var_shader_out && ((nir->info.outputs_written | nir->info.outputs_read) & BITFIELD64_MASK(VARYING_SLOT_VAR1)) == (nir->info.outputs_written | nir->info.outputs_read))) {
/* this is a special heuristic to catch ARB/fixedfunc shaders which have different rules:
* - i/o interface blocks don't need to match
* - any location can be present or not
* - it just has to work
*
* VAR0 is the only user varying that mesa can produce in this case, so overwrite POS
* since it's a builtin and yolo it with all the other legacy crap
*/
nir_foreach_variable_with_modes(var, nir, m) {
if (nir_slot_is_sysval_output(var->data.location, MESA_SHADER_NONE))
continue;
if (var->data.location == VARYING_SLOT_VAR0)
var->data.driver_location = 0;
else
var->data.driver_location = var->data.location;
}
return true;
}
/* i/o interface blocks are required to be EXACT matches between stages:
* iterate over all locations and set locations incrementally
*/