Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adjacent triangles sometimes write to the same pixel #17

@nical

Description

@nical

Hi,

I'm hoping to use euc in lyon's testing infrastructure. Lyon takes vector graphcs shapes in 2D and tessellates them into triangle meshes that approximates the original shapes. One thing that I am particularly interested in is to check that the generated tessellations don't have contain triangles that overlap.

I've put together a prototype of the overlap check in lyon's fuzzer using euc here: https://github.com/nical/lyon/blob/overlap-test/cli/src/fuzzing.rs#L35

The vertex stage basically forwards the input vertices, and the fragment stage writes 1. The destination target is overloaded so that it does a somewhat hacky additive blend (adding the shaded value to the destination pixel instead of overwriting it).

I then count the number of times a pixel was written to more than once to detect overlaps.

I see that on a lot of simple shapes (two adjacent triangles) euc's rasterizer writes the same pixel twice (which creates false positives on the test I'm looking to make). I checked that the cases my test detect are not in fact bugs in lyon (so far).

I'll come back with a more convenient test case but this mesh for example triggered the issue:

[[0.07318455, 0.33821934], [0.2277621, 0.6909972], [0.65824705, 0.83747554], [0.2277621, 0.6909972], [0.07318455, 0.33821934], [0.023455322, 0.97718465]]

It is rendered on a 1000x1000 target.

The image below shows for this test case which pixels was written multiple times from adjacent trianges (the dark red pixel highlighted by a light blue square to make it easier to find):

tmp

All GPU APIs guarantee that this type of overlap never happens (it is important to properly render geometry with blending), I'm hoping that euc is not far from being able to guarantee this as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions