"description": "zink: fix pointcoord y inversion",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
glx@glx_ext_import_context@make current- multi process,Fail
glx@glx_ext_import_context@make current- single process,Fail
glx@glx_ext_import_context@query context info,Fail
-shaders@glsl-fs-pointcoord,Fail
shaders@point-vertex-id divisor,Fail
shaders@point-vertex-id gl_instanceid,Fail
shaders@point-vertex-id gl_instanceid divisor,Fail
spec@!opengl 2.1@pbo,Fail
spec@!opengl 2.1@pbo@test_polygon_stip,Fail
spec@!opengl 2.1@polygon-stipple-fs,Fail
-spec@!opengl es 2.0@glsl-fs-pointcoord,Fail
spec@arb_depth_texture@depth-tex-modes,Fail
-spec@arb_framebuffer_object@fbo-gl_pointcoord,Fail
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_pipeline_statistics_query@arb_pipeline_statistics_query-frag,Fail
spec@arb_point_sprite@arb_point_sprite-checkerboard,Fail
spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
-shaders@glsl-fs-pointcoord,Fail
shaders@point-vertex-id divisor,Fail
shaders@point-vertex-id gl_instanceid divisor,Fail
shaders@point-vertex-id gl_instanceid,Fail
spec@arb_fragment_program_shadow@txp-shadow2drect,Fail
spec@arb_framebuffer_no_attachments@arb_framebuffer_no_attachments-query,Fail
spec@arb_framebuffer_no_attachments@arb_framebuffer_no_attachments-query@MS8,Fail
-spec@arb_framebuffer_object@fbo-gl_pointcoord,Fail
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-tf-separate,Fail
spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2-mat2,Fail
spec@arb_gpu_shader_fp64@execution@conversion@frag-conversion-explicit-dmat2x3-mat2x3,Fail
spec@!opengl 2.1@pbo@test_polygon_stip,Fail
spec@!opengl 2.1@polygon-stipple-fs,Fail
spec@!opengl 3.0@clearbuffer-depth-cs-probe,Fail
-spec@!opengl es 2.0@glsl-fs-pointcoord,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_gs_linked,Fail
spec@!opengl 1.0@rasterpos@glsl_vs_tes_linked,Fail
}
}
+static bool
+invert_point_coord_instr(nir_builder *b, nir_instr *instr, void *data)
+{
+ if (instr->type != nir_instr_type_intrinsic)
+ return false;
+ nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
+ if (intr->intrinsic != nir_intrinsic_load_deref)
+ return false;
+ nir_variable *deref_var = nir_intrinsic_get_var(intr, 0);
+ if (deref_var->data.location != VARYING_SLOT_PNTC)
+ return false;
+ b->cursor = nir_after_instr(instr);
+ nir_ssa_def *def = nir_vec2(b, nir_channel(b, &intr->dest.ssa, 0),
+ nir_fsub(b, nir_imm_float(b, 1.0), nir_channel(b, &intr->dest.ssa, 1)));
+ nir_ssa_def_rewrite_uses_after(&intr->dest.ssa, def, def->parent_instr);
+ return true;
+}
+
+static bool
+invert_point_coord(nir_shader *nir)
+{
+ if (!(nir->info.inputs_read & BITFIELD64_BIT(VARYING_SLOT_PNTC)))
+ return false;
+ return nir_shader_instructions_pass(nir, invert_point_coord_instr, nir_metadata_dominance, NULL);
+}
+
VkShaderModule
zink_shader_compile(struct zink_screen *screen, struct zink_shader *zs, nir_shader *base_nir, const struct zink_shader_key *key)
{
if (zink_fs_key(key)->force_dual_color_blend && nir->info.outputs_written & BITFIELD64_BIT(FRAG_RESULT_DATA1)) {
NIR_PASS_V(nir, lower_dual_blend);
}
- if (zink_fs_key(key)->coord_replace_bits) {
- NIR_PASS_V(nir, nir_lower_texcoord_replace, zink_fs_key(key)->coord_replace_bits,
- false, zink_fs_key(key)->coord_replace_yinvert);
- }
+ if (zink_fs_key(key)->coord_replace_bits)
+ NIR_PASS_V(nir, nir_lower_texcoord_replace, zink_fs_key(key)->coord_replace_bits, false, false);
+ if (zink_fs_key(key)->point_coord_yinvert)
+ NIR_PASS_V(nir, invert_point_coord);
if (zink_fs_key(key)->force_persample_interp || zink_fs_key(key)->fbfetch_ms) {
nir_foreach_shader_in_variable(var, nir)
var->data.sample = true;
zink_set_fs_point_coord_key(struct zink_context *ctx)
{
const struct zink_fs_key *fs = zink_get_fs_key(ctx);
- bool disable = ctx->gfx_pipeline_state.rast_prim != PIPE_PRIM_POINTS || !ctx->rast_state->base.sprite_coord_enable;
+ bool disable = ctx->gfx_pipeline_state.rast_prim != PIPE_PRIM_POINTS;
uint8_t coord_replace_bits = disable ? 0 : ctx->rast_state->base.sprite_coord_enable;
- bool coord_replace_yinvert = disable ? false : !!ctx->rast_state->base.sprite_coord_mode;
- if (fs->coord_replace_bits != coord_replace_bits || fs->coord_replace_yinvert != coord_replace_yinvert) {
+ bool point_coord_yinvert = disable ? false : !!ctx->rast_state->base.sprite_coord_mode;
+ if (fs->coord_replace_bits != coord_replace_bits || fs->point_coord_yinvert != point_coord_yinvert) {
zink_set_fs_key(ctx)->coord_replace_bits = coord_replace_bits;
- zink_set_fs_key(ctx)->coord_replace_yinvert = coord_replace_yinvert;
+ zink_set_fs_key(ctx)->point_coord_yinvert = point_coord_yinvert;
}
}
};
struct zink_fs_key {
- bool coord_replace_yinvert : 1;
+ bool point_coord_yinvert : 1;
bool samples : 1;
bool force_dual_color_blend : 1;
bool force_persample_interp : 1;