llvmpipe: add get_sample_position support (v2)

This just adds the sample values for 4xmsaa, and hooks them
up to the get_sample_position API

v2: move to vulkan standard sample positions

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
This commit is contained in:
Dave Airlie 2020-03-10 13:04:01 +10:00 committed by Marge Bot
parent f6383673c9
commit 0a6150251a
3 changed files with 22 additions and 1 deletions

View file

@ -56,6 +56,10 @@ const struct lp_rast_state *jit_state = NULL;
const struct lp_rasterizer_task *jit_task = NULL;
#endif
const float lp_sample_pos_4x[4][2] = { { 0.375, 0.125 },
{ 0.875, 0.375 },
{ 0.125, 0.625 },
{ 0.625, 0.875 } };
/**
* Begin rasterizing a scene.

View file

@ -72,6 +72,7 @@ struct cmd_bin;
struct lp_rasterizer_task;
extern const float lp_sample_pos_4x[4][2];
/**
* Rasterization state.

View file

@ -33,7 +33,7 @@
#include "lp_surface.h"
#include "lp_texture.h"
#include "lp_query.h"
#include "lp_rast.h"
static void
lp_resource_copy(struct pipe_context *pipe,
@ -225,6 +225,21 @@ llvmpipe_clear_depth_stencil(struct pipe_context *pipe,
dstx, dsty, width, height);
}
static void
llvmpipe_get_sample_position(struct pipe_context *pipe,
unsigned sample_count,
unsigned sample_index,
float *out_value)
{
switch (sample_count) {
case 4:
out_value[0] = lp_sample_pos_4x[sample_index][0];
out_value[1] = lp_sample_pos_4x[sample_index][1];
break;
default:
break;
}
}
void
llvmpipe_init_surface_functions(struct llvmpipe_context *lp)
@ -238,4 +253,5 @@ llvmpipe_init_surface_functions(struct llvmpipe_context *lp)
lp->pipe.resource_copy_region = lp_resource_copy;
lp->pipe.blit = lp_blit;
lp->pipe.flush_resource = lp_flush_resource;
lp->pipe.get_sample_position = llvmpipe_get_sample_position;
}