Renderer: Fix A8, L8 and LA8 support for both OpenGL and Vulkan
This commit is contained in:
@@ -78,6 +78,18 @@ namespace Nz
|
||||
auto format = DescribeTextureFormat(m_params.pixelFormat);
|
||||
assert(format);
|
||||
|
||||
const GL::Context& context = m_texture.EnsureDeviceContext();
|
||||
|
||||
UInt8 bpp = PixelFormatInfo::GetBytesPerPixel(m_params.pixelFormat);
|
||||
if (bpp % 8 == 0)
|
||||
context.glPixelStorei(GL_UNPACK_ALIGNMENT, 8);
|
||||
else if (bpp % 4 == 0)
|
||||
context.glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
else if (bpp % 2 == 0)
|
||||
context.glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
else
|
||||
context.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
switch (m_params.type)
|
||||
{
|
||||
case ImageType::E1D:
|
||||
|
||||
@@ -249,6 +249,19 @@ namespace Nz
|
||||
// TODO: Fill this switch
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case PixelFormat::A8:
|
||||
{
|
||||
createImage.format = VK_FORMAT_R8_UNORM;
|
||||
createImageView.format = createImage.format;
|
||||
createImageView.components = {
|
||||
VK_COMPONENT_SWIZZLE_ONE,
|
||||
VK_COMPONENT_SWIZZLE_ONE,
|
||||
VK_COMPONENT_SWIZZLE_ONE,
|
||||
VK_COMPONENT_SWIZZLE_R
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
case PixelFormat::BGR8:
|
||||
case PixelFormat::BGR8_SRGB:
|
||||
case PixelFormat::BGRA8:
|
||||
|
||||
Reference in New Issue
Block a user