mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2025-02-21 18:54:18 +01:00
bunch of more fixes trying to get mipmapping working
This commit is contained in:
parent
00672cfe92
commit
261ded8fd6
@ -1031,7 +1031,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBlitImage(
|
||||
samplerCI.mipLodBias = srcMipLevel;
|
||||
samplerCI.compareOp = VK_COMPARE_OP_NEVER;
|
||||
samplerCI.minLod = 0.0f;
|
||||
samplerCI.maxLod = 0.0f;
|
||||
samplerCI.maxLod = 999.0f;
|
||||
samplerCI.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||
rpi_vkCreateSampler(device, &samplerCI, 0, &mipSampler);
|
||||
_sampler* s = mipSampler;
|
||||
@ -1045,7 +1045,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkCmdBlitImage(
|
||||
view.subresourceRange.baseMipLevel = srcMipLevel;
|
||||
view.subresourceRange.baseArrayLayer = 0;
|
||||
view.subresourceRange.layerCount = 1;
|
||||
view.subresourceRange.levelCount = 1;
|
||||
view.subresourceRange.levelCount = srcMipLevel + 1;
|
||||
view.image = srcImage;
|
||||
rpi_vkCreateImageView(device, &view, 0, &srcTextureView);
|
||||
|
||||
|
@ -331,6 +331,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
|
||||
//mip levels must be padded to either T or LT format depending on size
|
||||
|
||||
uint32_t prevMipPaddedSize = 0;
|
||||
uint32_t mipSizes[11];
|
||||
|
||||
for(uint32_t c = i->miplevels - 1; c >= 1; --c)
|
||||
{
|
||||
@ -339,12 +340,12 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
|
||||
uint32_t nonPaddedSize = (mipWidth * mipHeight * bpp) >> 3;
|
||||
uint32_t mipPaddedWidth, mipPaddedHeight;
|
||||
|
||||
uint32_t tiling = i->tiling;
|
||||
// uint32_t tiling = i->tiling;
|
||||
|
||||
if(i->tiling == VC4_TILING_FORMAT_T && nonPaddedSize <= 4096)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
}
|
||||
// if(i->tiling == VC4_TILING_FORMAT_T && nonPaddedSize <= 4096)
|
||||
// {
|
||||
// tiling = VC4_TILING_FORMAT_LT;
|
||||
// }
|
||||
|
||||
// switch(tiling)
|
||||
// {
|
||||
@ -373,19 +374,29 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
|
||||
|
||||
mipPaddedWidth = getPow2Pad(mipWidth);
|
||||
mipPaddedHeight = getPow2Pad(mipHeight);
|
||||
uint32_t greater = mipPaddedWidth > mipPaddedHeight ? mipPaddedWidth : mipPaddedHeight;
|
||||
greater = greater < 4 ? 4 : greater;
|
||||
mipPaddedWidth = mipPaddedHeight = greater;
|
||||
|
||||
uint32_t mipPaddedSize = (mipPaddedWidth * mipPaddedHeight * bpp) >> 3;
|
||||
|
||||
mipSizes[c] = mipPaddedSize;
|
||||
i->levelOffsets[c] = prevMipPaddedSize;
|
||||
prevMipPaddedSize += mipPaddedSize;
|
||||
|
||||
// fprintf(stderr, "mipPaddedWidth: %u\n", mipPaddedWidth);
|
||||
// fprintf(stderr, "mipPaddedHeight: %u\n", mipPaddedHeight);
|
||||
// fprintf(stderr, "i->levelOffsets[%u]: %u\n", c, i->levelOffsets[c]);
|
||||
prevMipPaddedSize += mipPaddedSize;
|
||||
}
|
||||
|
||||
//must be a multiple of 4096 bytes
|
||||
i->levelOffsets[0] = getBOAlignedSize(prevMipPaddedSize, 4096);
|
||||
|
||||
for(uint32_t c = 1; c < i->miplevels; c++)
|
||||
{
|
||||
i->levelOffsets[c] = i->levelOffsets[c - 1] - mipSizes[c];
|
||||
}
|
||||
|
||||
i->size = getBOAlignedSize(((i->paddedWidth * i->paddedHeight * bpp) >> 3) + i->levelOffsets[0], ARM_PAGE_SIZE);
|
||||
|
||||
// fprintf(stderr, "i->tiling %u\n", i->tiling);
|
||||
|
Loading…
x
Reference in New Issue
Block a user