pvr, pco: point sampler support
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
committed by
Marge Bot
parent
20a08139ec
commit
b930b13372
@@ -20,6 +20,8 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define PCO_POINT_SAMPLER 0xffff
|
||||
|
||||
/* Compiler-specific forward-declarations. */
|
||||
typedef struct _pco_shader pco_shader;
|
||||
|
||||
@@ -144,6 +146,8 @@ typedef struct _pco_common_data {
|
||||
/** Push constant data. */
|
||||
pco_push_const_data push_consts;
|
||||
|
||||
pco_range point_sampler;
|
||||
|
||||
unsigned temps; /** Number of allocated temp registers. */
|
||||
unsigned vtxins; /** Number of allocated vertex input registers. */
|
||||
unsigned interns; /** Number of allocated internal registers. */
|
||||
@@ -158,6 +162,7 @@ typedef struct _pco_common_data {
|
||||
bool barriers; /** Whether the shader uses barriers. */
|
||||
bool side_effects; /** Whether the shader has side effects. */
|
||||
bool empty; /** Whether the shader is empty. */
|
||||
bool point_sampler; /** Whether the shader uses a point sampler. */
|
||||
} uses;
|
||||
} pco_common_data;
|
||||
|
||||
|
||||
@@ -892,6 +892,7 @@ struct pvr_pds_descriptor_set {
|
||||
#define PVR_BUFFER_TYPE_BUFFER_LENGTHS (4)
|
||||
#define PVR_BUFFER_TYPE_DYNAMIC (5)
|
||||
#define PVR_BUFFER_TYPE_UBO_ZEROING (6)
|
||||
#define PVR_BUFFER_TYPE_POINT_SAMPLER (7)
|
||||
#define PVR_BUFFER_TYPE_INVALID (~0)
|
||||
|
||||
struct pvr_pds_buffer {
|
||||
|
||||
@@ -1575,7 +1575,8 @@ void pvr_pds_generate_descriptor_upload_program(
|
||||
|
||||
switch (buffer->type) {
|
||||
case PVR_BUFFER_TYPE_PUSH_CONSTS:
|
||||
case PVR_BUFFER_TYPE_BLEND_CONSTS: {
|
||||
case PVR_BUFFER_TYPE_BLEND_CONSTS:
|
||||
case PVR_BUFFER_TYPE_POINT_SAMPLER: {
|
||||
struct pvr_const_map_entry_special_buffer *special_buffer_entry;
|
||||
|
||||
special_buffer_entry =
|
||||
|
||||
@@ -3660,6 +3660,42 @@ static VkResult pvr_setup_descriptor_mappings(
|
||||
break;
|
||||
}
|
||||
|
||||
case PVR_BUFFER_TYPE_POINT_SAMPLER: {
|
||||
uint64_t point_sampler_words[ROGUE_NUM_TEXSTATE_SAMPLER_WORDS];
|
||||
pvr_csb_pack (&point_sampler_words[0],
|
||||
TEXSTATE_SAMPLER_WORD0,
|
||||
sampler) {
|
||||
sampler.addrmode_u = ROGUE_TEXSTATE_ADDRMODE_CLAMP_TO_BORDER;
|
||||
sampler.addrmode_v = ROGUE_TEXSTATE_ADDRMODE_CLAMP_TO_BORDER;
|
||||
sampler.addrmode_w = ROGUE_TEXSTATE_ADDRMODE_CLAMP_TO_BORDER;
|
||||
sampler.dadjust = ROGUE_TEXSTATE_DADJUST_ZERO_UINT;
|
||||
sampler.minfilter = ROGUE_TEXSTATE_FILTER_POINT;
|
||||
sampler.magfilter = ROGUE_TEXSTATE_FILTER_POINT;
|
||||
sampler.maxlod = ROGUE_TEXSTATE_CLAMP_MAX;
|
||||
sampler.anisoctl = ROGUE_TEXSTATE_ANISOCTL_DISABLED;
|
||||
}
|
||||
|
||||
pvr_csb_pack (&point_sampler_words[1],
|
||||
TEXSTATE_SAMPLER_WORD1,
|
||||
sampler) {
|
||||
}
|
||||
|
||||
struct pvr_suballoc_bo *point_sampler_bo;
|
||||
result = pvr_cmd_buffer_upload_general(cmd_buffer,
|
||||
point_sampler_words,
|
||||
sizeof(point_sampler_words),
|
||||
&point_sampler_bo);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
PVR_WRITE(qword_buffer,
|
||||
point_sampler_bo->dev_addr.addr,
|
||||
special_buff_entry->const_offset,
|
||||
pds_info->data_size_in_dwords);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
UNREACHABLE("Unsupported special buffer type.");
|
||||
}
|
||||
|
||||
@@ -598,6 +598,14 @@ static VkResult pvr_pds_descriptor_program_create_and_upload(
|
||||
};
|
||||
}
|
||||
|
||||
if (data->common.point_sampler.count > 0) {
|
||||
program.buffers[program.buffer_count++] = (struct pvr_pds_buffer){
|
||||
.type = PVR_BUFFER_TYPE_POINT_SAMPLER,
|
||||
.size_in_dwords = data->common.point_sampler.count,
|
||||
.destination = data->common.point_sampler.start,
|
||||
};
|
||||
}
|
||||
|
||||
pds_info->entries_size_in_bytes = const_entries_size_in_bytes;
|
||||
|
||||
pvr_pds_generate_descriptor_upload_program(&program, NULL, pds_info);
|
||||
@@ -2078,6 +2086,15 @@ static void pvr_setup_descriptors(pco_data *data,
|
||||
data->common.shareds += count;
|
||||
}
|
||||
|
||||
if (data->common.uses.point_sampler) {
|
||||
data->common.point_sampler = (pco_range){
|
||||
.start = data->common.shareds,
|
||||
.count = ROGUE_NUM_TEXSTATE_DWORDS,
|
||||
};
|
||||
|
||||
data->common.shareds += ROGUE_NUM_TEXSTATE_DWORDS;
|
||||
}
|
||||
|
||||
assert(data->common.shareds < 256);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user