mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 03:30:36 +02:00
freedreno: implements get_sample_position
Since 1285f71d3e landed, it needs to provide apps with proper sample
position for MSAA.
Currently no way to query this to hw, these are taken from blob driver.
Fixes: dEQP-GLES31.functional.texture.multisample.samples_#.sample_position
Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
parent
5973a4d0b7
commit
76945e4140
1 changed files with 45 additions and 0 deletions
|
|
@ -1194,6 +1194,50 @@ fd_resource_screen_init(struct pipe_screen *pscreen)
|
|||
screen->setup_slices = fd_setup_slices;
|
||||
}
|
||||
|
||||
static void
|
||||
fd_get_sample_position(struct pipe_context *context,
|
||||
unsigned sample_count, unsigned sample_index,
|
||||
float *pos_out)
|
||||
{
|
||||
/* The following is copied from nouveau/nv50 except for position
|
||||
* values, which are taken from blob driver */
|
||||
static const uint8_t pos1[1][2] = { { 0x8, 0x8 } };
|
||||
static const uint8_t pos2[2][2] = {
|
||||
{ 0xc, 0xc }, { 0x4, 0x4 } };
|
||||
static const uint8_t pos4[4][2] = {
|
||||
{ 0x6, 0x2 }, { 0xe, 0x6 },
|
||||
{ 0x2, 0xa }, { 0xa, 0xe } };
|
||||
/* TODO needs to be verified on supported hw */
|
||||
static const uint8_t pos8[8][2] = {
|
||||
{ 0x9, 0x5 }, { 0x7, 0xb },
|
||||
{ 0xd, 0x9 }, { 0x5, 0x3 },
|
||||
{ 0x3, 0xd }, { 0x1, 0x7 },
|
||||
{ 0xb, 0xf }, { 0xf, 0x1 } };
|
||||
|
||||
const uint8_t (*ptr)[2];
|
||||
|
||||
switch (sample_count) {
|
||||
case 1:
|
||||
ptr = pos1;
|
||||
break;
|
||||
case 2:
|
||||
ptr = pos2;
|
||||
break;
|
||||
case 4:
|
||||
ptr = pos4;
|
||||
break;
|
||||
case 8:
|
||||
ptr = pos8;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
|
||||
pos_out[0] = ptr[sample_index][0] / 16.0f;
|
||||
pos_out[1] = ptr[sample_index][1] / 16.0f;
|
||||
}
|
||||
|
||||
void
|
||||
fd_resource_context_init(struct pipe_context *pctx)
|
||||
{
|
||||
|
|
@ -1208,4 +1252,5 @@ fd_resource_context_init(struct pipe_context *pctx)
|
|||
pctx->blit = fd_blit;
|
||||
pctx->flush_resource = fd_flush_resource;
|
||||
pctx->invalidate_resource = fd_invalidate_resource;
|
||||
pctx->get_sample_position = fd_get_sample_position;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue