1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2025-01-19 11:52:16 +01:00

fixed mip sampler

This commit is contained in:
Unknown 2020-03-01 23:50:48 +00:00
parent 7c01c7846f
commit 1934acaf6f
3 changed files with 9 additions and 11 deletions

View File

@ -661,13 +661,13 @@ void encodeTextureUniform(uint32_t* params, //array of 4 uint32_t
assert(params);
params[0] = 0
| numMipLevels & 0xf
| (numMipLevels & 0xf)
| (uint32_t)(textureDataType & 0xf) << 4
| (uint32_t)(isCubeMap ? 1 : 0) << 9
| (uint32_t)(textureBasePtr & 0xfffff) << 12;
params[1] = 0
| wrapS & 0x3
| (wrapS & 0x3)
| (uint32_t)(wrapT & 0x3) << 2
| (uint32_t)(minFilter & 0x7) << 4
| (uint32_t)(magFilter & 0x1) << 7
@ -676,7 +676,7 @@ void encodeTextureUniform(uint32_t* params, //array of 4 uint32_t
| (uint32_t)((textureDataType & 0x10) >> 4) << 31;
params[2] = 0
| noAutoLod & 0x1
| (noAutoLod & 0x1)
| (uint32_t)(cubemapStride & 0x3ffff) << 12
| (uint32_t)(isCubeMap ? 1 : 0) << 30;
@ -731,7 +731,7 @@ void encodeStencilValue(uint32_t *values, uint32_t* numValues, VkStencilOpState
break;
default:
values[1] = 0
| front.writeMask & 0xff
| (front.writeMask & 0xff)
| (front.writeMask & 0xff) << 8;
*numValues = 2;
break;
@ -803,7 +803,7 @@ void encodeStencilValue(uint32_t *values, uint32_t* numValues, VkStencilOpState
else
{
values[2] = 0
| front.writeMask & 0xff
| (front.writeMask & 0xff)
| (back.writeMask & 0xff) << 8;
*numValues = 3;
}
@ -905,6 +905,8 @@ uint8_t getMinFilterType(VkFilter minFilter, VkSamplerMipmapMode mipFilter, floa
return 5;
}
}
return -1;
}
uint8_t getWrapMode(VkSamplerAddressMode mode)

View File

@ -323,8 +323,6 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
i->stride = (i->paddedWidth * bpp) >> 3;
uint32_t mipSize = 0;
//mip levels are laid out in memory the following way:
//0x0.................................................0xffffff
//smallest mip level ... largest mip level - 1, base mip level
@ -383,12 +381,10 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
// fprintf(stderr, "mipPaddedHeight: %u\n", mipPaddedHeight);
// fprintf(stderr, "i->levelOffsets[%u]: %u\n", c, i->levelOffsets[c]);
prevMipPaddedSize += mipPaddedSize;
mipSize += mipPaddedWidth * mipPaddedHeight;
}
//must be a multiple of 4096 bytes
i->levelOffsets[0] = getBOAlignedSize((mipSize * bpp) >> 3, 4096);
i->levelOffsets[0] = getBOAlignedSize(prevMipPaddedSize, 4096);
i->size = getBOAlignedSize(((i->paddedWidth * i->paddedHeight * bpp) >> 3) + i->levelOffsets[0], ARM_PAGE_SIZE);

View File

@ -1555,7 +1555,7 @@ void CreateTexture()
sampler.mipLodBias = 0.0f;
sampler.compareOp = VK_COMPARE_OP_NEVER;
sampler.minLod = 0.0f;
sampler.maxLod = 0.0f;
sampler.maxLod = 999.0f;
sampler.borderColor = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
vkCreateSampler(device, &sampler, 0, &textureSampler);
}