Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/imagination/g5p/pco_g5p_general.c
Original file line number Diff line number Diff line change
Expand Up @@ -4782,6 +4782,9 @@ static void stage_ssbo_store(struct gctx *c,nir_intrinsic_instr *in)
for(unsigned i=0;i<c->nssbo;i++)if(c->ssbo_set[i]==set && c->ssbo_binding[i]==binding)base=c->ssbo_common[i];
struct ref offset=resolve_value(c,in->src[2].ssa,0),value=resolve_value(c,in->src[0].ssa,0);
unsigned index=reg_of(c,offset,"store_ssbo byte offset"),data=reg_of(c,value,"store_ssbo value");
/* a bank-0 offset or value is moved to bank 1 first (the witnessed move of a load's offset): the store's
* form is witnessed with every register in bank 1 */
if(c->vs){index=vs_bank1_index(c,index);data=vs_bank1_index(c,data);}
if(c->vs)vs_bank1_only(c,"vertex SSBO store",index,data,-1,-1);
unsigned pair;
for(pair=0;pair+2<=NUM_DWORDS;pair+=2)
Expand Down
13 changes: 11 additions & 2 deletions src/imagination/vulkan/pvr_arch_image.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,19 @@ VkResult PVR_PER_ARCH(CreateImageView)(VkDevice _device,
plane = &image->planes[0];
}

uint32_t array_size = iview->vk.layer_count;
if (image->vk.image_type == VK_IMAGE_TYPE_3D &&
(iview->vk.view_type == VK_IMAGE_VIEW_TYPE_2D_ARRAY ||
iview->vk.view_type == VK_IMAGE_VIEW_TYPE_2D)) {
iview->vk.layer_count = image->vk.extent.depth;
array_size = image->vk.extent.depth;
/* G5P: a 2D (array) view of a 3D image keeps its own slice count. Its
* render path takes a one-slice view as one layer (pvr_arch_g5p.c,
* g5p_job_init(): a view of more layers is refused, which lost every
* draw into a 3D slice, e.g. Zink's blit for glCopyImageSubData), and
* its array state counts the view's slices from base_array_layer
* (pvr_arch_g5p_tex.c). Rogue's texture words keep the whole depth. */
if (!PVR_HAS_FEATURE(&device->pdevice->dev_info, apple_g5p))
iview->vk.layer_count = array_size;
}

info.type = iview->vk.view_type;
Expand All @@ -115,7 +124,7 @@ VkResult PVR_PER_ARCH(CreateImageView)(VkDevice _device,
info.aspect_mask = iview->vk.aspects;
info.is_cube = (info.type == VK_IMAGE_VIEW_TYPE_CUBE ||
info.type == VK_IMAGE_VIEW_TYPE_CUBE_ARRAY);
info.array_size = iview->vk.layer_count;
info.array_size = array_size;
info.offset = iview->vk.base_array_layer * plane->layer_size;
info.mipmaps_present = (image->vk.mip_levels > 1) ? true : false;
info.stride = plane->physical_extent.width;
Expand Down
6 changes: 6 additions & 0 deletions src/imagination/vulkan/pvr_g5p.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ static inline bool pvr_g5p_packed_is_signed(VkFormat format)
/* The 32-bit integer colour targets the raw32 output renders (pco_g5p's PCO_G5P_COLOR_UINT32/SINT32: four raw
* output words, no f16 conversion): 1 unsigned, 2 signed, 0 any other format. The PBE stores the target's own
* channels (one, two or four 32-bit words of a pixel) from the first output words. */
extern bool g5p_usc_g4p; /* g5p_usc.h */
static inline unsigned
pvr_g5p_raw32_kind(VkFormat format)
{
Expand All @@ -551,6 +552,11 @@ pvr_g5p_raw32_kind(VkFormat format)
case VK_FORMAT_R32G32_UINT:
case VK_FORMAT_R32G32B32A32_UINT:
return 1;
/* 32-bit float targets: the same raw words, stored as the UINT format's bits (pvr_g5p_format_pbe()) */
case VK_FORMAT_R32_SFLOAT:
case VK_FORMAT_R32G32_SFLOAT:
case VK_FORMAT_R32G32B32A32_SFLOAT:
return g5p_usc_g4p ? 0 : 1; /* the A8 renders R32F as a float pass */
case VK_FORMAT_R32_SINT:
case VK_FORMAT_R32G32_SINT:
case VK_FORMAT_R32G32B32A32_SINT:
Expand Down
6 changes: 3 additions & 3 deletions src/imagination/vulkan/pvr_g5p_format_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ static const struct pvr_g5p_format pvr_g5p_format_table[] = {
G5P_FMT(R16G16_SFLOAT, 4, false, G5P_SF | G5P_RT | PVR_G5P_FMT_STORAGE, G5P1B, 0x223, G5P_SEL_RG01),
G5P_FMT(R16G16B16A16_SFLOAT, 8, false, G5P_SF | G5P_RT | PVR_G5P_FMT_STORAGE, G5P1B, 0x232, G5P_SEL_RGBA),
/* 32-bit float (fmt-r32f, t12-t13): the A9 does not filter 32-bit float */
G5P_FMT(R32_SFLOAT, 4, false, G5P_S | PVR_G5P_FMT_STORAGE, G5P1B, 0x221, G5P_SEL_R001),
G5P_FMT(R32G32_SFLOAT, 8, false, G5P_S, G5P1B, 0x231, G5P_SEL_RG01),
G5P_FMT(R32G32B32A32_SFLOAT, 16, false, G5P_S | PVR_G5P_FMT_STORAGE, G5P1B, 0x238, G5P_SEL_RGBA),
G5P_FMT(R32_SFLOAT, 4, false, G5P_S | PVR_G5P_FMT_STORAGE | PVR_G5P_FMT_RENDER, G5P1B, 0x221, G5P_SEL_R001),
G5P_FMT(R32G32_SFLOAT, 8, false, G5P_S | PVR_G5P_FMT_RENDER, G5P1B, 0x231, G5P_SEL_RG01),
G5P_FMT(R32G32B32A32_SFLOAT, 16, false, G5P_S | PVR_G5P_FMT_STORAGE | PVR_G5P_FMT_RENDER, G5P1B, 0x238, G5P_SEL_RGBA),
/* packed float (t14-t15). Apple packs RG11B10F in a 66-byte program; the
* PBE packs it from the two-word program's f16 too, exactly. */
G5P_FMT(B10G11R11_UFLOAT_PACK32, 4, false, G5P_SF | G5P_RT, G5P1B, 0x225, G5P_SEL_RGB1),
Expand Down
11 changes: 11 additions & 0 deletions src/imagination/vulkan/pvr_g5p_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ pvr_g5p_format_pbe(VkFormat format, uint32_t *key, bool *srgb)
*srgb = f->srgb;
return true;
}
/* a 32-bit float target is stored by the raw pass as the UINT format's bits */
const VkFormat raw = format == VK_FORMAT_R32_SFLOAT ? VK_FORMAT_R32_UINT :
format == VK_FORMAT_R32G32_SFLOAT ? VK_FORMAT_R32G32_UINT :
format == VK_FORMAT_R32G32B32A32_SFLOAT ? VK_FORMAT_R32G32B32A32_UINT : VK_FORMAT_UNDEFINED;
if (raw != VK_FORMAT_UNDEFINED && !g5p_usc_g4p) {
uint32_t k;
bool unused;
if (!pvr_g5p_format_pbe_key(format, row_probe(format), &k, &unused))
return false;
return pvr_g5p_format_pbe_key(raw, true, key, srgb);
}
return pvr_g5p_format_pbe_key(format, row_probe(format), key, srgb);
}

Expand Down
8 changes: 6 additions & 2 deletions src/imagination/vulkan/rogue/pvr_blit.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,12 @@ static void pvr_setup_transfer_surface(struct pvr_device *device,
surface->height = height;
surface->depth = depth;

assert(info.rowPitch % vk_format_get_blocksize(format) == 0);
surface->stride = info.rowPitch / vk_format_get_blocksize(format);
/* One aspect of a combined depth/stencil format: the layout is that aspect's, so is its texel size */
const uint32_t bpp = vk_format_is_depth_or_stencil(format) && util_bitcount(aspect_mask) == 1
? vk_format_get_blocksize(vk_format_get_aspect_format(format, aspect_mask))
: vk_format_get_blocksize(format);
assert(info.rowPitch % bpp == 0);
surface->stride = info.rowPitch / bpp;

surface->vk_format = format;
surface->mem_layout = image->memlayout;
Expand Down
Loading