#
#asahi-gpu · 2023-04-08 17:30
alyssabut yeah nothing special there
#asahi-gpu · 2023-04-08 17:28
alyssanvm
#asahi-gpu · 2023-04-08 17:28
alyssaoh er wait there
#asahi-gpu · 2023-04-08 17:28
alyssaget_sample_position seems broken on Metal but whatever
#asahi-gpu · 2023-04-08 17:22
alyssahttps://backtick.town/~bloom/0001-wip.patch
#asahi-gpu · 2023-04-08 17:21
alyssaok, so bary have bary + perspective + fragcoord z + gouraud
#asahi-gpu · 2023-04-08 17:14
alyssaspiciness += 2;
#asahi-gpu · 2023-04-08 17:14
alyssaand a new output select field
#asahi-gpu · 2023-04-08 17:14
alyssaas for the coefficient register setup struct, ooh spicy there's a new unknown bit
#asahi-gpu · 2023-04-08 17:13
alyssaso the coefficient register just gives you the vec2 barys you wanted
#asahi-gpu · 2023-04-08 17:13
alyssa<x, y, 1 - x - y>
#asahi-gpu · 2023-04-08 17:13
alyssathen the barycentric coordinates (the vec3 returned to Metal) are
#asahi-gpu · 2023-04-08 17:12
alyssaiterproj at centre with a special coefficient register produces a vector <x, y>
#asahi-gpu · 2023-04-08 17:12
alyssaThat one is in Metal, fortunately
#asahi-gpu · 2023-04-08 17:11
alyssaRelatedly, how are barycentric coordinates loaded?
#asahi-gpu · 2023-04-08 17:10
alyssaso even though the hardware should be capable we need to infer a lot of these details from how Apple's driver implements other features (namely, interpolateAtOffset)
#asahi-gpu · 2023-04-08 17:10
alyssathis is extra annoying because Metal does not support this feature (though Vulkan does with an extension, as does Direct3D)
#asahi-gpu · 2023-04-08 17:09
alyssaPerspective would be hopefully similar but I haven't thought in enough detail. Worst case you can emulate perspective because at this point we can do our own interpolation
#asahi-gpu · 2023-04-08 17:09
alyssaFor linear interpolation, you should be able to (roughly) interpolate at the current pixel and then subtract an appropriate delta vector based on the barycentric coordinate of the current pixel
#asahi-gpu · 2023-04-08 17:08
alyssabut I haven't worked out the math yet
#asahi-gpu · 2023-04-08 17:07
alyssaI suspect the answer is yes
#asahi-gpu · 2023-04-08 17:07
alyssa(Equivalently, can we interpolate with user-specified barycentrics?)
#asahi-gpu · 2023-04-08 17:07
alyssaSo then the big question is, setting up the coefficient registers as shaded rather than flat, can we load the values at the individual vertices of the triangle?
#asahi-gpu · 2023-04-08 17:06
alyssa(The provoking vertex is in the coefficient register setup, mind. So you can't get the non-provoking vertex for something flat.)
#asahi-gpu · 2023-04-08 17:05
alyssaFor the special case of flat shading, you just take the third value, since the value at the top left of a tile is also the value everywhere
#asahi-gpu · 2023-04-08 17:04
alyssa(where the third component is linearly interpolated)
#asahi-gpu · 2023-04-08 17:04
alyssaand from that vector you can implement whatever interpolation you want
#asahi-gpu · 2023-04-08 17:04
alyssaSo the hardware writes <x delta, y delta, value at the top left of the tile>
#asahi-gpu · 2023-04-08 17:03
alyssaand the coefficient register store is written by the hardware once for each triangle for each 32x32 tile
#asahi-gpu · 2023-04-08 17:03
alyssaIt's just copying the coefficient registers from the coefficient register store
#asahi-gpu · 2023-04-08 17:02
alyssaI bet ldcf isn't doing any work at all
#asahi-gpu · 2023-04-08 17:02
alyssaooh
#asahi-gpu · 2023-04-08 16:43
alyssahow can this work what
#asahi-gpu · 2023-04-08 16:43
alyssathat would require the provoking vertex colour to be the colour at a tile edge (i.e. interpolated) though so err that doesn't work either
#asahi-gpu · 2023-04-08 16:42
alyssaand since tiles are at most 32x32 that works out
#asahi-gpu · 2023-04-08 16:42
alyssaor I guess ldcf returns something different in those tiles
#asahi-gpu · 2023-04-08 16:41
alyssawhat if the triangle is bigger than 32x32 how can this possibly work
#asahi-gpu · 2023-04-08 16:41
alyssastill doesn't explain the weird 32x32 tile thing
#asahi-gpu · 2023-04-08 16:41
alyssaseemingly
#asahi-gpu · 2023-04-08 16:41
alyssameaning, the third register is the colour at the provoking vertex and the first two registers are the delta vectors
#asahi-gpu · 2023-04-08 16:40
alyssaso ldcf is loading the iid in reverse order from NIR
#asahi-gpu · 2023-04-08 16:19
alyssajust some abstract 32x32 tile used for barycentric calculations, I guess
#asahi-gpu · 2023-04-08 16:19
alyssanope
#asahi-gpu · 2023-04-08 16:16
alyssahold on wat, is this relative to the tile? is that what's happening? oh boy.
#asahi-gpu · 2023-04-08 16:10
alyssawouldn't be the first vendor to do ieee 754 crimes
#asahi-gpu · 2023-04-08 16:10
alyssaunsure what bit 0 of A means, maybe they're passing some sideband info there
#asahi-gpu · 2023-04-08 16:09
alyssa(so we can have just one of them denorm, apparently?)
#asahi-gpu · 2023-04-08 16:09
alyssaok so seemingly it's considered valid if bit 0 of A is clear, or if A and B are not *both* denorm
#asahi-gpu · 2023-04-08 16:08
alyssayeah
#asahi-gpu · 2023-04-08 15:59
alyssapretty sure I blew a sign somewhere

plus ›