mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2025-02-18 15:54:21 +01:00
fixed handling offsets for render targets and textures, fixed LT formats
This commit is contained in:
parent
68a9a4ee2c
commit
637bec7672
@ -360,13 +360,13 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
|
||||
uint32_t tiling = writeImage->tiling;
|
||||
|
||||
if(writeImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize <= 4096)
|
||||
if(writeImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize < 4096)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
}
|
||||
|
||||
submitCl.color_write.hindex = writeImageIdx;
|
||||
submitCl.color_write.offset = marker->writeImageOffset;
|
||||
submitCl.color_write.offset = marker->writeImageOffset + writeImage->boundOffset;
|
||||
submitCl.color_write.flags = 0;
|
||||
submitCl.color_write.bits =
|
||||
VC4_SET_FIELD(getRenderTargetFormatVC4(writeImage->format), VC4_RENDER_CONFIG_FORMAT) |
|
||||
@ -381,7 +381,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
if(writeMSAAimage)
|
||||
{
|
||||
submitCl.msaa_color_write.hindex = writeMSAAimageIdx;
|
||||
submitCl.msaa_color_write.offset = marker->writeMSAAimageOffset;
|
||||
submitCl.msaa_color_write.offset = marker->writeMSAAimageOffset + writeMSAAimage->boundOffset;
|
||||
submitCl.msaa_color_write.flags = 0;
|
||||
submitCl.msaa_color_write.bits = VC4_RENDER_CONFIG_MS_MODE_4X;
|
||||
}
|
||||
@ -392,13 +392,13 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
|
||||
uint32_t tiling = readImage->tiling;
|
||||
|
||||
if(readImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize <= 4096)
|
||||
if(readImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize < 4096)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
}
|
||||
|
||||
submitCl.color_read.hindex = readImageIdx;
|
||||
submitCl.color_read.offset = marker->readImageOffset;
|
||||
submitCl.color_read.offset = marker->readImageOffset + readImage->boundOffset;
|
||||
submitCl.color_read.flags = readMSAAimage ? VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES : 0;
|
||||
submitCl.color_read.bits = VC4_SET_FIELD(getRenderTargetFormatVC4(readImage->format), VC4_RENDER_CONFIG_FORMAT) |
|
||||
VC4_SET_FIELD(tiling, VC4_RENDER_CONFIG_MEMORY_FORMAT);
|
||||
@ -410,13 +410,13 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
|
||||
uint32_t tiling = writeDepthStencilImage->tiling;
|
||||
|
||||
if(writeDepthStencilImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize <= 4096)
|
||||
if(writeDepthStencilImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize < 4096)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
}
|
||||
|
||||
submitCl.zs_write.hindex = writeDepthStencilImageIdx;
|
||||
submitCl.zs_write.offset = marker->writeDepthStencilImageOffset;
|
||||
submitCl.zs_write.offset = marker->writeDepthStencilImageOffset + writeDepthStencilImage->boundOffset;
|
||||
submitCl.zs_write.flags = 0;
|
||||
submitCl.zs_write.bits = VC4_SET_FIELD(VC4_LOADSTORE_TILE_BUFFER_ZS, VC4_LOADSTORE_TILE_BUFFER_BUFFER) |
|
||||
VC4_SET_FIELD(tiling, VC4_LOADSTORE_TILE_BUFFER_TILING);
|
||||
@ -425,7 +425,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
if(writeMSAAdepthStencilImage)
|
||||
{
|
||||
submitCl.msaa_zs_write.hindex = writeMSAAdepthStencilImageIdx;
|
||||
submitCl.msaa_zs_write.offset = marker->writeMSAAdepthStencilImageOffset;
|
||||
submitCl.msaa_zs_write.offset = marker->writeMSAAdepthStencilImageOffset + writeMSAAdepthStencilImage->boundOffset;
|
||||
submitCl.msaa_zs_write.flags = 0;
|
||||
submitCl.msaa_zs_write.bits = VC4_RENDER_CONFIG_MS_MODE_4X;
|
||||
}
|
||||
@ -436,13 +436,13 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
|
||||
uint32_t tiling = readDepthStencilImage->tiling;
|
||||
|
||||
if(readDepthStencilImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize <= 4096)
|
||||
if(readDepthStencilImage->tiling == VC4_TILING_FORMAT_T && nonPaddedSize < 4096)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
}
|
||||
|
||||
submitCl.zs_read.hindex = readDepthStencilImageIdx;
|
||||
submitCl.zs_read.offset = marker->readDepthStencilImageOffset;
|
||||
submitCl.zs_read.offset = marker->readDepthStencilImageOffset + readDepthStencilImage->boundOffset;
|
||||
submitCl.zs_read.flags = readMSAAdepthStencilImage ? VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES : 0; //TODO is this valid?
|
||||
submitCl.zs_read.bits = VC4_SET_FIELD(getRenderTargetFormatVC4(readDepthStencilImage->format), VC4_RENDER_CONFIG_FORMAT) |
|
||||
VC4_SET_FIELD(tiling, VC4_RENDER_CONFIG_MEMORY_FORMAT);
|
||||
|
@ -1058,7 +1058,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdCopyBufferToImage(
|
||||
fragConstants[0] = *(uint32_t*)&w;
|
||||
fragConstants[1] = *(uint32_t*)&bppfloat;
|
||||
fragConstants[2] = size;
|
||||
fragConstants[3] = pRegions[c].bufferOffset;
|
||||
fragConstants[3] = pRegions[c].bufferOffset + buf->boundOffset;
|
||||
|
||||
rpi_vkCmdPushConstants(commandBuffer, blitPipelineLayout, VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(fragConstants), &fragConstants);
|
||||
|
||||
@ -1093,6 +1093,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBlitImage(
|
||||
_image* srcImg = srcImage;
|
||||
_image* dstImg = dstImage;
|
||||
|
||||
//TODO handle offsets
|
||||
|
||||
for(uint32_t c = 0; c < regionCount; ++c)
|
||||
{
|
||||
uint32_t srcWidth = pRegions[c].srcOffsets[1].x - pRegions[c].srcOffsets[0].x;
|
||||
|
@ -404,7 +404,7 @@ static uint32_t drawCommon(VkCommandBuffer commandBuffer, int32_t vertexOffset)
|
||||
getTextureDataType(di->imageView->interpretedFormat),
|
||||
di->imageView->viewType == VK_IMAGE_VIEW_TYPE_CUBE,
|
||||
cubemapStride >> 12, //cubemap stride in multiples of 4KB
|
||||
di->imageView->image->levelOffsets[0] >> 12, //Image level 0 offset in multiples of 4KB
|
||||
(di->imageView->image->levelOffsets[0] + di->imageView->image->boundOffset) >> 12, //Image level 0 offset in multiples of 4KB
|
||||
di->imageView->image->height & 2047,
|
||||
di->imageView->image->width & 2047,
|
||||
getMinFilterType(di->sampler->minFilter, di->sampler->mipmapMode),// di->sampler->maxLod),
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "common.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "kernel/vc4_packet.h"
|
||||
|
||||
@ -219,7 +219,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
|
||||
}
|
||||
else
|
||||
{
|
||||
if(nonPaddedSize > 4096)
|
||||
if(nonPaddedSize >= 4096)
|
||||
{
|
||||
i->tiling = VC4_TILING_FORMAT_T;
|
||||
}
|
||||
@ -432,6 +432,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory(
|
||||
assert(memoryOffset % i->alignment == 0);
|
||||
assert(i->size <= m->size - memoryOffset);
|
||||
|
||||
//image memory must be aligned to 4096 bytes
|
||||
assert((memoryOffset % 4096) == 0);
|
||||
|
||||
i->boundMem = m;
|
||||
i->boundOffset = memoryOffset;
|
||||
|
||||
@ -440,7 +443,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkBindImageMemory(
|
||||
{
|
||||
int ret = vc4_bo_set_tiling(controlFd, i->boundMem->bo, DRM_FORMAT_MOD_LINEAR); assert(ret);
|
||||
}
|
||||
else if(i->tiling == VC4_TILING_FORMAT_T)
|
||||
else if(i->tiling == VC4_TILING_FORMAT_T || i->tiling == VC4_TILING_FORMAT_LT)
|
||||
{
|
||||
int ret = vc4_bo_set_tiling(controlFd, i->boundMem->bo, DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED); assert(ret);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user