panfrost: Implement get_sample_position
Easy now that we have the table. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
This commit is contained in:
parent
b01df1f9bf
commit
4086b8980d
|
@ -1340,6 +1340,17 @@ panfrost_set_min_samples(struct pipe_context *pipe,
|
|||
ctx->min_samples = min_samples;
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_get_sample_position(struct pipe_context *context,
|
||||
unsigned sample_count,
|
||||
unsigned sample_index,
|
||||
float *out_value)
|
||||
{
|
||||
panfrost_query_sample_position(
|
||||
panfrost_sample_pattern(sample_count),
|
||||
sample_index,
|
||||
out_value);
|
||||
}
|
||||
|
||||
static void
|
||||
panfrost_set_clip_state(struct pipe_context *pipe,
|
||||
|
@ -1701,6 +1712,7 @@ panfrost_create_context(struct pipe_screen *screen, void *priv, unsigned flags)
|
|||
|
||||
gallium->set_sample_mask = panfrost_set_sample_mask;
|
||||
gallium->set_min_samples = panfrost_set_min_samples;
|
||||
gallium->get_sample_position = panfrost_get_sample_position;
|
||||
|
||||
gallium->set_clip_state = panfrost_set_clip_state;
|
||||
gallium->set_viewport_states = panfrost_set_viewport_states;
|
||||
|
|
|
@ -182,6 +182,11 @@ panfrost_upload_sample_positions(struct panfrost_device *dev);
|
|||
mali_ptr
|
||||
panfrost_sample_positions(struct panfrost_device *dev,
|
||||
enum mali_sample_pattern pattern);
|
||||
void
|
||||
panfrost_query_sample_position(
|
||||
enum mali_sample_pattern pattern,
|
||||
unsigned sample_idx,
|
||||
float *out);
|
||||
|
||||
static inline struct panfrost_bo *
|
||||
pan_lookup_bo(struct panfrost_device *dev, uint32_t gem_handle)
|
||||
|
|
|
@ -144,3 +144,18 @@ panfrost_upload_sample_positions(struct panfrost_device *dev)
|
|||
memcpy(dev->sample_positions->ptr.cpu, sample_position_lut,
|
||||
sizeof(sample_position_lut));
|
||||
}
|
||||
|
||||
/* CPU side LUT query, to implement glGetMultisamplefv */
|
||||
|
||||
void
|
||||
panfrost_query_sample_position(
|
||||
enum mali_sample_pattern pattern,
|
||||
unsigned sample_idx,
|
||||
float *out)
|
||||
{
|
||||
struct mali_sample_position pos =
|
||||
sample_position_lut[pattern].positions[sample_idx];
|
||||
|
||||
out[0] = DECODE_FIXED_16(pos.x);
|
||||
out[1] = DECODE_FIXED_16(pos.y);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue