mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 00:00:11 +01:00
gallium/util: Add a helper function for point sprite handling.
Many drivers will need to do the same thing here, so consolidate it. Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2952>
This commit is contained in:
parent
622c548967
commit
64cb81a3a4
1 changed files with 19 additions and 0 deletions
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "pipe/p_state.h"
|
||||
#include "c11/threads.h"
|
||||
#include "compiler/shader_enums.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
@ -56,6 +57,24 @@ bool util_upload_index_buffer(struct pipe_context *pipe,
|
|||
struct pipe_resource **out_buffer,
|
||||
unsigned *out_offset, unsigned alignment);
|
||||
|
||||
/* Helper function to determine if the varying should contain the point
|
||||
* coordinates, given the sprite_coord_enable mask. Requires
|
||||
* PIPE_CAP_TGSI_TEXCOORD to be enabled.
|
||||
*/
|
||||
static inline bool
|
||||
util_varying_is_point_coord(gl_varying_slot slot, uint32_t sprite_coord_enable)
|
||||
{
|
||||
if (slot == VARYING_SLOT_PNTC)
|
||||
return true;
|
||||
|
||||
if (slot >= VARYING_SLOT_TEX0 && slot <= VARYING_SLOT_TEX7 &&
|
||||
(sprite_coord_enable & (1 << (slot - VARYING_SLOT_TEX0)))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
util_pin_driver_threads_to_random_L3(struct pipe_context *ctx,
|
||||
thrd_t *upper_thread);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue