mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 13:58:04 +02:00
tu: Clamp sample locations
This was missed in the initial implementation and fixes extreme sample locations like (1.0, 1.0). Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18912>
This commit is contained in:
parent
e63c8b3bf1
commit
d99e5ffee7
3 changed files with 19 additions and 4 deletions
|
|
@ -94,6 +94,9 @@
|
|||
(MAX_DYNAMIC_UNIFORM_BUFFERS + 2 * MAX_DYNAMIC_STORAGE_BUFFERS) * \
|
||||
A6XX_TEX_CONST_DWORDS
|
||||
|
||||
#define SAMPLE_LOCATION_MIN 0.f
|
||||
#define SAMPLE_LOCATION_MAX 0.9375f
|
||||
|
||||
#define TU_MAX_DRM_DEVICES 8
|
||||
#define MAX_VIEWS 16
|
||||
#define MAX_BIND_POINTS 2 /* compute + graphics */
|
||||
|
|
|
|||
|
|
@ -1344,8 +1344,8 @@ tu_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
|
|||
VK_SAMPLE_COUNT_1_BIT | VK_SAMPLE_COUNT_2_BIT | VK_SAMPLE_COUNT_4_BIT;
|
||||
}
|
||||
properties->maxSampleLocationGridSize = (VkExtent2D) { 1 , 1 };
|
||||
properties->sampleLocationCoordinateRange[0] = 0.0f;
|
||||
properties->sampleLocationCoordinateRange[1] = 0.9375f;
|
||||
properties->sampleLocationCoordinateRange[0] = SAMPLE_LOCATION_MIN;
|
||||
properties->sampleLocationCoordinateRange[1] = SAMPLE_LOCATION_MAX;
|
||||
properties->sampleLocationSubPixelBits = 4;
|
||||
properties->variableSampleLocations = true;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -2161,9 +2161,21 @@ tu6_emit_sample_locations(struct tu_cs *cs, const VkSampleLocationsInfoEXT *samp
|
|||
A6XX_RB_SAMPLE_CONFIG_LOCATION_ENABLE;
|
||||
uint32_t sample_locations = 0;
|
||||
for (uint32_t i = 0; i < samp_loc->sampleLocationsCount; i++) {
|
||||
/* From VkSampleLocationEXT:
|
||||
*
|
||||
* The values specified in a VkSampleLocationEXT structure are always
|
||||
* clamped to the implementation-dependent sample location coordinate
|
||||
* range
|
||||
* [sampleLocationCoordinateRange[0],sampleLocationCoordinateRange[1]]
|
||||
*/
|
||||
float x = CLAMP(samp_loc->pSampleLocations[i].x, SAMPLE_LOCATION_MIN,
|
||||
SAMPLE_LOCATION_MAX);
|
||||
float y = CLAMP(samp_loc->pSampleLocations[i].y, SAMPLE_LOCATION_MIN,
|
||||
SAMPLE_LOCATION_MAX);
|
||||
|
||||
sample_locations |=
|
||||
(A6XX_RB_SAMPLE_LOCATION_0_SAMPLE_0_X(samp_loc->pSampleLocations[i].x) |
|
||||
A6XX_RB_SAMPLE_LOCATION_0_SAMPLE_0_Y(samp_loc->pSampleLocations[i].y)) << i*8;
|
||||
(A6XX_RB_SAMPLE_LOCATION_0_SAMPLE_0_X(x) |
|
||||
A6XX_RB_SAMPLE_LOCATION_0_SAMPLE_0_Y(y)) << i*8;
|
||||
}
|
||||
|
||||
tu_cs_emit_pkt4(cs, REG_A6XX_GRAS_SAMPLE_CONFIG, 2);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue