On Wed, 13 Mar 2019 08:16:10 -0500 Jason Ekstrand <ja...@jlekstrand.net> wrote:
> On Mon, Mar 11, 2019 at 10:05 AM Eleni Maria Stea <es...@igalia.com> > wrote: > > > Allowing the user to set custom sample locations non-dynamically, by > > filling the extension structs and chaining them to the pipeline > > structs according to the Vulkan specification section [26.5. Custom > > Sample Locations] [...] > > +void > > +anv_calc_sample_locations(struct anv_sample *samples, > > + uint32_t num_samples, > > + const VkSampleLocationsInfoEXT *info) > > +{ > > + int i; > > + > > + for(i = 0; i < num_samples; i++) { > > + float dx, dy; > > + > > + /* this is because the grid is 1x1, in case that > > + * we support different grid sizes in the future > > + * this must be changed. > > + */ > > + samples[i].offs_x = info->pSampleLocations[i].x; > > + samples[i].offs_y = info->pSampleLocations[i].y; > > + > > + /* distance from the center */ > > + dx = samples[i].offs_x - 0.5; > > + dy = samples[i].offs_y - 0.5; > > + > > + samples[i].radius = dx * dx + dy * dy; > > + } > > + > > + qsort(samples, num_samples, sizeof *samples, compare_samples); > > > > Are we allowed to re-order the samples like this? The spec says: > > The sample location for sample i at the pixel grid location (x,y) is > taken from pSampleLocations[(x + y * sampleLocationGridSize.width) * > sampleLocationsPerPixel + i] > > Which leads me to think that they expect the ordering of samples to be > respected. Yes, I know the HW docs say we're supposed to order them > from nearest to furthest. However, AFAIK, that's only so we get nice > centroids and I don't know that it's actually required. > > --Jason I wasn't sure about this to be honest. I could remove the qsort and explain why we decided to ignore the PRM in a comment for the case that someone decides to put this back in the future. Thanks a lot for reviewing the series, BTW. I am working on the changes for all patches. Eleni _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev