Fixed bug texture loading

- During mipmap transfer to GPU, height would sometimes be 0. Fixed it using std::max
This commit is contained in:
Brandon Mak 2023-03-02 16:04:22 +08:00
parent 6b42d78f16
commit 61a877cee1
4 changed files with 3 additions and 3 deletions

View File

@ -37,7 +37,7 @@ layout(location = 1) out uint outEntityID;
void main()
{
fragColor = texture(textures[nonuniformEXT(MatProp.data[In2.materialIndex].textureIndex)], In.uv);
if (fragColor.a < 0.01f)
if (fragColor.a < 0.1f)
{
discard;
}

Binary file not shown.

View File

@ -262,7 +262,7 @@ namespace SHADE
copyRegions[i].imageSubresource.baseArrayLayer = 0; // TODO: Array textures not supported yet
copyRegions[i].imageSubresource.layerCount = layerCount;
copyRegions[i].imageOffset = vk::Offset3D{ 0,0,0 };
copyRegions[i].imageExtent = vk::Extent3D{ width >> i, height >> i, 1 };
copyRegions[i].imageExtent = vk::Extent3D{ std::max (1u, width >> i), std::max (1u, height >> i), 1 };
}
cmdBufferHdl->CopyBufferToImage(stagingBuffer, vkImage, copyRegions);

View File

@ -71,7 +71,7 @@ namespace SHADE
//! of the texture library would mean the recreation of the desc set that also
//! involves the generic data, which is bad bad bad. Solution is to separate the
//! 2 desc sets.
static constexpr uint32_t DEFAULT_MAX_TEXTURES = 2000;
static constexpr uint32_t DEFAULT_MAX_TEXTURES = 1000;
/*-----------------------------------------------------------------------------*/
/* Usage Functions */