mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2024-12-01 13:24:20 +01:00
fixed mipmapping
This commit is contained in:
parent
75cf12a07e
commit
cdd209d43a
@ -38,7 +38,7 @@ typedef struct CLMarker
|
||||
uint32_t clearColor[2];
|
||||
uint32_t clearDepth, clearStencil;
|
||||
uint32_t width, height; //render w/h
|
||||
uint32_t renderToMip;
|
||||
uint32_t mipLevel;
|
||||
|
||||
//pointers that point to where all the other CL data is
|
||||
//plus sizes
|
||||
|
@ -360,11 +360,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
{
|
||||
uint32_t tiling = writeImage->tiling;
|
||||
|
||||
uint32_t isLT = isLTformat(getFormatBpp(writeImage->format), marker->width, marker->height);
|
||||
|
||||
if(writeImage->tiling == VC4_TILING_FORMAT_T && isLT)
|
||||
if(marker->mipLevel > 0)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
tiling = writeImage->levelTiling[marker->mipLevel];
|
||||
}
|
||||
|
||||
submitCl.color_write.hindex = writeImageIdx;
|
||||
@ -392,11 +390,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
{
|
||||
uint32_t tiling = readImage->tiling;
|
||||
|
||||
uint32_t isLT = isLTformat(getFormatBpp(readImage->format), marker->width, marker->height);
|
||||
|
||||
if(readImage->tiling == VC4_TILING_FORMAT_T && isLT)
|
||||
if(marker->mipLevel > 0)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
tiling = readImage->levelTiling[marker->mipLevel];
|
||||
}
|
||||
|
||||
submitCl.color_read.hindex = readImageIdx;
|
||||
@ -410,11 +406,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
{
|
||||
uint32_t tiling = writeDepthStencilImage->tiling;
|
||||
|
||||
uint32_t isLT = isLTformat(getFormatBpp(writeDepthStencilImage->format), marker->width, marker->height);
|
||||
|
||||
if(writeDepthStencilImage->tiling == VC4_TILING_FORMAT_T && isLT)
|
||||
if(marker->mipLevel > 0)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
tiling = writeDepthStencilImage->levelTiling[marker->mipLevel];
|
||||
}
|
||||
|
||||
submitCl.zs_write.hindex = writeDepthStencilImageIdx;
|
||||
@ -436,11 +430,9 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
{
|
||||
uint32_t tiling = readDepthStencilImage->tiling;
|
||||
|
||||
uint32_t isLT = isLTformat(getFormatBpp(readDepthStencilImage->format), marker->width, marker->height);
|
||||
|
||||
if(readDepthStencilImage->tiling == VC4_TILING_FORMAT_T && isLT)
|
||||
if(marker->mipLevel > 0)
|
||||
{
|
||||
tiling = VC4_TILING_FORMAT_LT;
|
||||
tiling = readDepthStencilImage->levelTiling[marker->mipLevel];
|
||||
}
|
||||
|
||||
submitCl.zs_read.hindex = readDepthStencilImageIdx;
|
||||
@ -498,7 +490,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
heightInTiles = divRoundUp(height, tileSizeH);
|
||||
|
||||
//pad width if rendering to miplevel
|
||||
if(marker->renderToMip)
|
||||
if(marker->mipLevel > 0)
|
||||
{
|
||||
width = getPow2Pad(width);
|
||||
width = width < 4 ? 4 : width;
|
||||
@ -542,21 +534,21 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkQueueSubmit(
|
||||
submitCl.shader_rec_count = marker->shaderRecCount;
|
||||
submitCl.uniforms_size = marker->uniformsSize;
|
||||
|
||||
/**
|
||||
/**/
|
||||
printf("BCL:\n");
|
||||
clDump(((uint8_t*)marker) + sizeof(CLMarker), marker->size);
|
||||
printf("BO handles: ");
|
||||
for(int d = 0; d < marker->handlesSize / 4; ++d)
|
||||
{
|
||||
printf("%u ", *((uint32_t*)(marker->handlesBuf)+d));
|
||||
printf("%u ", *(((uint32_t*)getCPAptrFromOffset(cmdbuf->handlesCl.CPA, marker->handlesBufOffset))+d));
|
||||
}
|
||||
printf("\nUniforms: ");
|
||||
for(int d = 0; d < marker->uniformsSize / 4; ++d)
|
||||
{
|
||||
printf("%i ", *((uint32_t*)(marker->uniformsBuf)+d));
|
||||
printf("%i ", *(((uint32_t*)getCPAptrFromOffset(cmdbuf->uniformsCl.CPA, marker->uniformsBufOffset))+d));
|
||||
}
|
||||
printf("\nShader recs: ");
|
||||
uint8_t* ptr = marker->shaderRecBuf + (3 + 3) * 4;
|
||||
uint8_t* ptr = getCPAptrFromOffset(cmdbuf->shaderRecCl.CPA, marker->shaderRecBufOffset + (3 + 3) * 4);
|
||||
for(int d = 0; d < marker->shaderRecCount; ++d)
|
||||
{
|
||||
uint8_t flags = *ptr;
|
||||
|
@ -197,6 +197,7 @@ typedef struct VkImage_T
|
||||
uint32_t width, height, depth;
|
||||
uint32_t miplevels, samples;
|
||||
uint32_t levelOffsets[11]; //max 11 mip levels
|
||||
uint32_t levelTiling[11];
|
||||
uint32_t layers; //number of views for multiview/stereo
|
||||
uint32_t size; //overall size including padding and alignment
|
||||
uint32_t stride; //the number of bytes from one row of pixels in memory to the next row of pixels in memory (aka pitch)
|
||||
|
@ -248,11 +248,11 @@ void rpi_vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassB
|
||||
}
|
||||
|
||||
//pad render size if we are rendering to a mip level
|
||||
currMarker->renderToMip = biggestMip > 0;
|
||||
currMarker->mipLevel = biggestMip;
|
||||
|
||||
uint32_t width = currMarker->width;
|
||||
|
||||
if(currMarker->renderToMip)
|
||||
if(currMarker->mipLevel > 0)
|
||||
{
|
||||
width = getPow2Pad(width);
|
||||
width = width < 4 ? 4 : width;
|
||||
|
@ -202,6 +202,7 @@ VKAPI_ATTR VkResult VKAPI_CALL rpi_vkCreateImage(
|
||||
i->depth = pCreateInfo->extent.depth;
|
||||
i->miplevels = pCreateInfo->mipLevels;
|
||||
memset(i->levelOffsets, 0, sizeof(uint32_t) * 11);
|
||||
memset(i->levelTiling, 0, sizeof(uint32_t) * 11);
|
||||
i->samples = pCreateInfo->samples;
|
||||
i->layers = pCreateInfo->arrayLayers;
|
||||
i->size = 0;
|
||||
@ -311,6 +312,8 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
|
||||
|
||||
for(int c = i->miplevels - 1; c >= 0; c--)
|
||||
{
|
||||
i->levelTiling[c] = i->tiling;
|
||||
|
||||
uint32_t mipW, mipH;
|
||||
if(!c)
|
||||
{
|
||||
@ -340,6 +343,7 @@ VKAPI_ATTR void VKAPI_CALL rpi_vkGetImageMemoryRequirements(
|
||||
uint32_t isMipLT = isLTformat(bpp, mipW, mipH);
|
||||
if(isMipLT)
|
||||
{
|
||||
i->levelTiling[c] = VC4_TILING_FORMAT_LT;
|
||||
mipW = roundUp(mipW, utileW);
|
||||
mipH = roundUp(mipH, utileH);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user