Minor fixes
This commit is contained in:
parent
0dbb77de10
commit
32c204e95f
|
|
@ -781,7 +781,7 @@ namespace Nz
|
||||||
#ifdef NAZARA_DEBUG
|
#ifdef NAZARA_DEBUG
|
||||||
if (interpolation < T(0.0) || interpolation > T(1.0))
|
if (interpolation < T(0.0) || interpolation > T(1.0))
|
||||||
{
|
{
|
||||||
NazaraError("Interpolation must be in range [0..1] (Got " + NumberToString(interpolation) + ')');
|
NazaraError("Interpolation must be in range [0..1] (Got " + std::to_string(interpolation) + ')');
|
||||||
return Zero();
|
return Zero();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -249,6 +249,9 @@ namespace Nz
|
||||||
{
|
{
|
||||||
switch (pixelFormat)
|
switch (pixelFormat)
|
||||||
{
|
{
|
||||||
|
// TODO: Fill this switch
|
||||||
|
case PixelFormat::BGR8: return VK_FORMAT_B8G8R8_UNORM;
|
||||||
|
case PixelFormat::BGR8_SRGB: return VK_FORMAT_B8G8R8_SRGB;
|
||||||
case PixelFormat::BGRA8: return VK_FORMAT_B8G8R8A8_UNORM;
|
case PixelFormat::BGRA8: return VK_FORMAT_B8G8R8A8_UNORM;
|
||||||
case PixelFormat::BGRA8_SRGB: return VK_FORMAT_B8G8R8A8_SRGB;
|
case PixelFormat::BGRA8_SRGB: return VK_FORMAT_B8G8R8A8_SRGB;
|
||||||
case PixelFormat::Depth16: return VK_FORMAT_D16_UNORM;
|
case PixelFormat::Depth16: return VK_FORMAT_D16_UNORM;
|
||||||
|
|
@ -256,6 +259,8 @@ namespace Nz
|
||||||
case PixelFormat::Depth24Stencil8: return VK_FORMAT_D24_UNORM_S8_UINT;
|
case PixelFormat::Depth24Stencil8: return VK_FORMAT_D24_UNORM_S8_UINT;
|
||||||
case PixelFormat::Depth32F: return VK_FORMAT_D32_SFLOAT;
|
case PixelFormat::Depth32F: return VK_FORMAT_D32_SFLOAT;
|
||||||
case PixelFormat::Depth32FStencil8: return VK_FORMAT_D32_SFLOAT_S8_UINT;
|
case PixelFormat::Depth32FStencil8: return VK_FORMAT_D32_SFLOAT_S8_UINT;
|
||||||
|
case PixelFormat::RGB8: return VK_FORMAT_R8G8B8_UNORM;
|
||||||
|
case PixelFormat::RGB8_SRGB: return VK_FORMAT_R8G8B8_SRGB;
|
||||||
case PixelFormat::RGBA8: return VK_FORMAT_R8G8B8A8_UNORM;
|
case PixelFormat::RGBA8: return VK_FORMAT_R8G8B8A8_UNORM;
|
||||||
case PixelFormat::RGBA8_SRGB: return VK_FORMAT_R8G8B8A8_SRGB;
|
case PixelFormat::RGBA8_SRGB: return VK_FORMAT_R8G8B8A8_SRGB;
|
||||||
case PixelFormat::RGBA32F: return VK_FORMAT_R32G32B32A32_SFLOAT;
|
case PixelFormat::RGBA32F: return VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,8 @@ namespace Nz
|
||||||
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, UInt32 width, UInt32 height, UInt32 depth = 1);
|
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, UInt32 width, UInt32 height, UInt32 depth = 1);
|
||||||
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, Int32 x, Int32 y, Int32 z, UInt32 width, UInt32 height, UInt32 depth);
|
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, Int32 x, Int32 y, Int32 z, UInt32 width, UInt32 height, UInt32 depth);
|
||||||
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, UInt32 width, UInt32 height, UInt32 depth = 1);
|
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, UInt32 width, UInt32 height, UInt32 depth = 1);
|
||||||
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, const VkBufferImageCopy& region);
|
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkBufferImageCopy& region);
|
||||||
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, UInt32 regionCount, const VkBufferImageCopy* regions);
|
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, UInt32 regionCount, const VkBufferImageCopy* regions);
|
||||||
inline void CopyImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, const VkImageCopy& region);
|
inline void CopyImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, const VkImageCopy& region);
|
||||||
inline void CopyImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, UInt32 regionCount, const VkImageCopy* regions);
|
inline void CopyImage(VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, UInt32 regionCount, const VkImageCopy* regions);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -251,7 +251,7 @@ namespace Nz
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return CopyBufferToImage(source, target, targetLayout, subresourceLayers, region);
|
return CopyBufferToImage(source, target, targetLayout, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CommandBuffer::CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, UInt32 width, UInt32 height, UInt32 depth)
|
inline void CommandBuffer::CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, UInt32 width, UInt32 height, UInt32 depth)
|
||||||
|
|
@ -269,15 +269,15 @@ namespace Nz
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return CopyBufferToImage(source, target, targetLayout, subresourceLayers, region);
|
return CopyBufferToImage(source, target, targetLayout, region);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CommandBuffer::CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, const VkBufferImageCopy& region)
|
inline void CommandBuffer::CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkBufferImageCopy& region)
|
||||||
{
|
{
|
||||||
return CopyBufferToImage(source, target, targetLayout, subresourceLayers, 1, ®ion);
|
return CopyBufferToImage(source, target, targetLayout, 1, ®ion);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CommandBuffer::CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, const VkImageSubresourceLayers& subresourceLayers, UInt32 regionCount, const VkBufferImageCopy* regions)
|
inline void CommandBuffer::CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, UInt32 regionCount, const VkBufferImageCopy* regions)
|
||||||
{
|
{
|
||||||
return m_pool->GetDevice()->vkCmdCopyBufferToImage(m_handle, source, target, targetLayout, regionCount, regions);
|
return m_pool->GetDevice()->vkCmdCopyBufferToImage(m_handle, source, target, targetLayout, regionCount, regions);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,8 +49,6 @@ namespace Nz
|
||||||
|
|
||||||
m_deviceInfo.type = RenderDeviceType::Unknown;
|
m_deviceInfo.type = RenderDeviceType::Unknown;
|
||||||
|
|
||||||
const GL::ContextParams& params = m_referenceContext->GetParams();
|
|
||||||
|
|
||||||
// Features
|
// Features
|
||||||
if (m_referenceContext->IsExtensionSupported(GL::Extension::TextureFilterAnisotropic))
|
if (m_referenceContext->IsExtensionSupported(GL::Extension::TextureFilterAnisotropic))
|
||||||
m_deviceInfo.features.anisotropicFiltering = true;
|
m_deviceInfo.features.anisotropicFiltering = true;
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ namespace Nz
|
||||||
std::shared_ptr<Image> image = std::make_shared<Image>(type, format, width, height, depth, levelCount);
|
std::shared_ptr<Image> image = std::make_shared<Image>(type, format, width, height, depth, levelCount);
|
||||||
|
|
||||||
// Read all mipmap levels
|
// Read all mipmap levels
|
||||||
for (unsigned int i = 0; i < image->GetLevelCount(); i++)
|
for (UInt8 i = 0; i < image->GetLevelCount(); i++)
|
||||||
{
|
{
|
||||||
std::size_t byteCount = PixelFormatInfo::ComputeSize(format, width, height, depth);
|
std::size_t byteCount = PixelFormatInfo::ComputeSize(format, width, height, depth);
|
||||||
|
|
||||||
|
|
@ -167,7 +167,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
if (header.format.flags & (DDPF_RGB | DDPF_ALPHA | DDPF_ALPHAPIXELS | DDPF_LUMINANCE))
|
if (header.format.flags & (DDPF_RGB | DDPF_ALPHA | DDPF_ALPHAPIXELS | DDPF_LUMINANCE))
|
||||||
{
|
{
|
||||||
PixelFormatDescription info(PixelFormatContent::ColorRGBA, header.format.bpp, PixelFormatSubType::Unsigned);
|
PixelFormatDescription info(PixelFormatContent::ColorRGBA, SafeCast<UInt8>(header.format.bpp), PixelFormatSubType::Unsigned);
|
||||||
|
|
||||||
if (header.format.flags & DDPF_RGB)
|
if (header.format.flags & DDPF_RGB)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ namespace Nz
|
||||||
}
|
}
|
||||||
|
|
||||||
const MD5AnimParser::Frame* frames = parser.GetFrames();
|
const MD5AnimParser::Frame* frames = parser.GetFrames();
|
||||||
std::size_t frameCount = parser.GetFrameCount();
|
UInt32 frameCount = parser.GetFrameCount();
|
||||||
std::size_t frameRate = parser.GetFrameRate();
|
UInt32 frameRate = parser.GetFrameRate();
|
||||||
const MD5AnimParser::Joint* joints = parser.GetJoints();
|
const MD5AnimParser::Joint* joints = parser.GetJoints();
|
||||||
std::size_t jointCount = parser.GetJointCount();
|
UInt32 jointCount = parser.GetJointCount();
|
||||||
|
|
||||||
// À ce stade, nous sommes censés avoir assez d'informations pour créer l'animation
|
// À ce stade, nous sommes censés avoir assez d'informations pour créer l'animation
|
||||||
std::shared_ptr<Animation> animation = std::make_shared<Animation>();
|
std::shared_ptr<Animation> animation = std::make_shared<Animation>();
|
||||||
|
|
@ -62,10 +62,10 @@ namespace Nz
|
||||||
Quaternionf rotationQuat = Quaternionf::RotationBetween(Vector3f::UnitX(), Vector3f::Forward()) *
|
Quaternionf rotationQuat = Quaternionf::RotationBetween(Vector3f::UnitX(), Vector3f::Forward()) *
|
||||||
Quaternionf::RotationBetween(Vector3f::UnitZ(), Vector3f::Up());
|
Quaternionf::RotationBetween(Vector3f::UnitZ(), Vector3f::Up());
|
||||||
|
|
||||||
for (std::size_t i = 0; i < jointCount; ++i)
|
for (UInt32 i = 0; i < jointCount; ++i)
|
||||||
{
|
{
|
||||||
int parent = joints[i].parent;
|
int parent = joints[i].parent;
|
||||||
for (std::size_t j = 0; j < frameCount; ++j)
|
for (UInt32 j = 0; j < frameCount; ++j)
|
||||||
{
|
{
|
||||||
SequenceJoint& sequenceJoint = sequenceJoints[j*jointCount + i];
|
SequenceJoint& sequenceJoint = sequenceJoints[j*jointCount + i];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@ namespace Nz
|
||||||
|
|
||||||
UInt8* pixels = image->GetPixels();
|
UInt8* pixels = image->GetPixels();
|
||||||
|
|
||||||
int rle_value = 0;
|
UInt8 rleValue = 0;
|
||||||
unsigned int rle_count = 0;
|
UInt8 rleCount = 0;
|
||||||
|
|
||||||
switch (bitCount)
|
switch (bitCount)
|
||||||
{
|
{
|
||||||
|
|
@ -115,20 +115,20 @@ namespace Nz
|
||||||
/* decode line number y */
|
/* decode line number y */
|
||||||
while (bytes--)
|
while (bytes--)
|
||||||
{
|
{
|
||||||
if (rle_count == 0)
|
if (rleCount == 0)
|
||||||
{
|
{
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rle_value < 0xc0)
|
if (rleValue < 0xc0)
|
||||||
rle_count = 1;
|
rleCount = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rle_count = rle_value - 0xc0;
|
rleCount = rleValue - 0xc0;
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -136,11 +136,11 @@ namespace Nz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rle_count--;
|
rleCount--;
|
||||||
|
|
||||||
for (int i = 7; i >= 0; --i)
|
for (int i = 7; i >= 0; --i)
|
||||||
{
|
{
|
||||||
int colorIndex = ((rle_value & (1 << i)) > 0);
|
int colorIndex = ((rleValue & (1 << i)) > 0);
|
||||||
|
|
||||||
*ptr++ = header.palette[colorIndex * 3 + 0];
|
*ptr++ = header.palette[colorIndex * 3 + 0];
|
||||||
*ptr++ = header.palette[colorIndex * 3 + 1];
|
*ptr++ = header.palette[colorIndex * 3 + 1];
|
||||||
|
|
@ -170,20 +170,20 @@ namespace Nz
|
||||||
/* decode line number y */
|
/* decode line number y */
|
||||||
while (bytes--)
|
while (bytes--)
|
||||||
{
|
{
|
||||||
if (rle_count == 0)
|
if (rleCount == 0)
|
||||||
{
|
{
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rle_value < 0xc0)
|
if (rleValue < 0xc0)
|
||||||
rle_count = 1;
|
rleCount = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rle_count = rle_value - 0xc0;
|
rleCount = rleValue - 0xc0;
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -191,8 +191,8 @@ namespace Nz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rle_count--;
|
rleCount--;
|
||||||
*(pLine++) = rle_value;
|
*(pLine++) = rleValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* compute line's color indexes */
|
/* compute line's color indexes */
|
||||||
|
|
@ -254,20 +254,20 @@ namespace Nz
|
||||||
/* decode line number y */
|
/* decode line number y */
|
||||||
while (bytes--)
|
while (bytes--)
|
||||||
{
|
{
|
||||||
if (rle_count == 0)
|
if (rleCount == 0)
|
||||||
{
|
{
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rle_value < 0xc0)
|
if (rleValue < 0xc0)
|
||||||
rle_count = 1;
|
rleCount = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rle_count = rle_value - 0xc0;
|
rleCount = rleValue - 0xc0;
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -275,11 +275,11 @@ namespace Nz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rle_count--;
|
rleCount--;
|
||||||
|
|
||||||
*ptr++ = palette[rle_value * 3 + 0];
|
*ptr++ = palette[rleValue * 3 + 0];
|
||||||
*ptr++ = palette[rle_value * 3 + 1];
|
*ptr++ = palette[rleValue * 3 + 1];
|
||||||
*ptr++ = palette[rle_value * 3 + 2];
|
*ptr++ = palette[rleValue * 3 + 2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -298,20 +298,20 @@ namespace Nz
|
||||||
/* decode line number y */
|
/* decode line number y */
|
||||||
while (bytes--)
|
while (bytes--)
|
||||||
{
|
{
|
||||||
if (rle_count == 0)
|
if (rleCount == 0)
|
||||||
{
|
{
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rle_value < 0xc0)
|
if (rleValue < 0xc0)
|
||||||
rle_count = 1;
|
rleCount = 1;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rle_count = rle_value - 0xc0;
|
rleCount = rleValue - 0xc0;
|
||||||
if (!stream.Read(&rle_value, 1))
|
if (!stream.Read(&rleValue, 1))
|
||||||
{
|
{
|
||||||
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
NazaraError("Failed to read stream (byte " + NumberToString(stream.GetCursorPos()) + ')');
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
@ -319,8 +319,8 @@ namespace Nz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rle_count--;
|
rleCount--;
|
||||||
ptr[c] = static_cast<UInt8>(rle_value);
|
ptr[c] = static_cast<UInt8>(rleValue);
|
||||||
ptr += 3;
|
ptr += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
#include <Nazara/Utility/PixelFormat.hpp>
|
#include <Nazara/Utility/PixelFormat.hpp>
|
||||||
|
#include <Nazara/Core/Algorithm.hpp>
|
||||||
#include <Nazara/Core/Endianness.hpp>
|
#include <Nazara/Core/Endianness.hpp>
|
||||||
#include <Nazara/Core/Error.hpp>
|
#include <Nazara/Core/Error.hpp>
|
||||||
#include <Nazara/Utility/Debug.hpp>
|
#include <Nazara/Utility/Debug.hpp>
|
||||||
|
|
@ -635,7 +636,7 @@ namespace Nz
|
||||||
{
|
{
|
||||||
UInt16 l = static_cast<UInt16>(c8to4(start[0]));
|
UInt16 l = static_cast<UInt16>(c8to4(start[0]));
|
||||||
|
|
||||||
*ptr = (l << 12) | (l << 8) | (l << 4) | c8to4(start[1]);
|
*ptr = (l << 12) | (l << 8) | (l << 4) | c8to4(SafeCast<UInt8>(start[1]));
|
||||||
|
|
||||||
#ifdef NAZARA_BIG_ENDIAN
|
#ifdef NAZARA_BIG_ENDIAN
|
||||||
SwapBytes(ptr, sizeof(UInt16));
|
SwapBytes(ptr, sizeof(UInt16));
|
||||||
|
|
@ -676,7 +677,7 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c4to8(pixel & 0x000F);
|
*dst++ = c4to8(SafeCast<UInt8>(pixel & 0x000F));
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -695,9 +696,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c4to8((pixel & 0x00F0) >> 4);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x00F0) >> 4));
|
||||||
*dst++ = c4to8((pixel & 0x0F00) >> 8);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x0F00) >> 8));
|
||||||
*dst++ = c4to8((pixel & 0xF000) >> 12);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0xF000) >> 12));
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -716,10 +717,10 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c4to8((pixel & 0x00F0) >> 4);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x00F0) >> 4));
|
||||||
*dst++ = c4to8((pixel & 0x0F00) >> 8);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x0F00) >> 8));
|
||||||
*dst++ = c4to8((pixel & 0xF000) >> 12);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0xF000) >> 12));
|
||||||
*dst++ = c4to8((pixel & 0x000F) >> 0);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x000F) >> 0));
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -738,9 +739,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt16 r = c4to8((pixel & 0xF000) >> 12);
|
UInt16 r = c4to8(SafeCast<UInt8>((pixel & 0xF000) >> 12));
|
||||||
UInt16 g = c4to8((pixel & 0x0F00) >> 8);
|
UInt16 g = c4to8(SafeCast<UInt8>((pixel & 0x0F00) >> 8));
|
||||||
UInt16 b = c4to8((pixel & 0x00F0) >> 4);
|
UInt16 b = c4to8(SafeCast<UInt8>((pixel & 0x00F0) >> 4));
|
||||||
|
|
||||||
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
||||||
|
|
||||||
|
|
@ -761,9 +762,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt16 r = c4to8((pixel & 0xF000) >> 12);
|
UInt16 r = c4to8(SafeCast<UInt8>((pixel & 0xF000) >> 12));
|
||||||
UInt16 g = c4to8((pixel & 0x0F00) >> 8);
|
UInt16 g = c4to8(SafeCast<UInt8>((pixel & 0x0F00) >> 8));
|
||||||
UInt16 b = c4to8((pixel & 0x00F0) >> 4);
|
UInt16 b = c4to8(SafeCast<UInt8>((pixel & 0x00F0) >> 4));
|
||||||
|
|
||||||
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
||||||
*dst++ = c4to8(pixel & 0x000F);
|
*dst++ = c4to8(pixel & 0x000F);
|
||||||
|
|
@ -786,10 +787,10 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt16 r = c4to5((pixel & 0xF000) >> 12);
|
UInt16 r = c4to5(SafeCast<UInt8>((pixel & 0xF000) >> 12));
|
||||||
UInt16 g = c4to5((pixel & 0x0F00) >> 8);
|
UInt16 g = c4to5(SafeCast<UInt8>((pixel & 0x0F00) >> 8));
|
||||||
UInt16 b = c4to5((pixel & 0x00F0) >> 4);
|
UInt16 b = c4to5(SafeCast<UInt8>((pixel & 0x00F0) >> 4));
|
||||||
UInt16 a = c4to5((pixel & 0x000F) >> 0);
|
UInt16 a = c4to5(SafeCast<UInt8>((pixel & 0x000F) >> 0));
|
||||||
|
|
||||||
*ptr = (r << 11) | (g << 6) | (b << 1) | ((a > 0x3) ? 1 : 0);
|
*ptr = (r << 11) | (g << 6) | (b << 1) | ((a > 0x3) ? 1 : 0);
|
||||||
|
|
||||||
|
|
@ -815,9 +816,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c4to8((pixel & 0xF000) >> 12);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0xF000) >> 12));
|
||||||
*dst++ = c4to8((pixel & 0x0F00) >> 8);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x0F00) >> 8));
|
||||||
*dst++ = c4to8((pixel & 0x00F0) >> 4);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x00F0) >> 4));
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -836,10 +837,10 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c4to8((pixel & 0xF000) >> 12);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0xF000) >> 12));
|
||||||
*dst++ = c4to8((pixel & 0x0F00) >> 8);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x0F00) >> 8));
|
||||||
*dst++ = c4to8((pixel & 0x00F0) >> 4);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x00F0) >> 4));
|
||||||
*dst++ = c4to8((pixel & 0x000F) >> 0);
|
*dst++ = c4to8(SafeCast<UInt8>((pixel & 0x000F) >> 0));
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -859,7 +860,7 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = static_cast<UInt8>((pixel & 0x1)*0xFF);
|
*dst++ = SafeCast<UInt8>((pixel & 0x1) * 0xFF);
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -878,9 +879,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c5to8((pixel & 0x003E) >> 1);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x003E) >> 1));
|
||||||
*dst++ = c5to8((pixel & 0x07C0) >> 6);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x07C0) >> 6));
|
||||||
*dst++ = c5to8((pixel & 0xF800) >> 11);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0xF800) >> 11));
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -899,9 +900,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c5to8((pixel & 0x003E) >> 1);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x003E) >> 1));
|
||||||
*dst++ = c5to8((pixel & 0x07C0) >> 6);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x07C0) >> 6));
|
||||||
*dst++ = c5to8((pixel & 0xF800) >> 11);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0xF800) >> 11));
|
||||||
*dst++ = static_cast<UInt8>((pixel & 0x1)*0xFF);
|
*dst++ = static_cast<UInt8>((pixel & 0x1)*0xFF);
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
|
|
@ -921,9 +922,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt8 r = c5to8((pixel & 0xF800) >> 11);
|
UInt8 r = c5to8(SafeCast<UInt8>((pixel & 0xF800) >> 11));
|
||||||
UInt8 g = c5to8((pixel & 0x07C0) >> 6);
|
UInt8 g = c5to8(SafeCast<UInt8>((pixel & 0x07C0) >> 6));
|
||||||
UInt8 b = c5to8((pixel & 0x003E) >> 1);
|
UInt8 b = c5to8(SafeCast<UInt8>((pixel & 0x003E) >> 1));
|
||||||
|
|
||||||
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
||||||
|
|
||||||
|
|
@ -944,9 +945,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt8 r = c5to8((pixel & 0xF800) >> 11);
|
UInt8 r = c5to8(SafeCast<UInt8>((pixel & 0xF800) >> 11));
|
||||||
UInt8 g = c5to8((pixel & 0x07C0) >> 6);
|
UInt8 g = c5to8(SafeCast<UInt8>((pixel & 0x07C0) >> 6));
|
||||||
UInt8 b = c5to8((pixel & 0x003E) >> 1);
|
UInt8 b = c5to8(SafeCast<UInt8>((pixel & 0x003E) >> 1));
|
||||||
|
|
||||||
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
*dst++ = static_cast<UInt8>(r * 0.3f + g * 0.59f + b * 0.11f);
|
||||||
*dst++ = static_cast<UInt8>((pixel & 0x1)*0xFF);
|
*dst++ = static_cast<UInt8>((pixel & 0x1)*0xFF);
|
||||||
|
|
@ -968,9 +969,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c5to8((pixel & 0xF800) >> 11);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0xF800) >> 11));
|
||||||
*dst++ = c5to8((pixel & 0x07C0) >> 6);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x07C0) >> 6));
|
||||||
*dst++ = c5to8((pixel & 0x003E) >> 1);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x003E) >> 1));
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
@ -990,9 +991,9 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UInt8 r = c5to4((pixel & 0xF800) >> 11);
|
UInt8 r = c5to4(SafeCast<UInt8>((pixel & 0xF800) >> 11));
|
||||||
UInt8 g = c5to4((pixel & 0x07C0) >> 6);
|
UInt8 g = c5to4(SafeCast<UInt8>((pixel & 0x07C0) >> 6));
|
||||||
UInt8 b = c5to4((pixel & 0x003E) >> 1);
|
UInt8 b = c5to4(SafeCast<UInt8>((pixel & 0x003E) >> 1));
|
||||||
|
|
||||||
*ptr = (r << 12) | (g << 8) | (b << 4) | ((pixel & 0x1)*0x0F);
|
*ptr = (r << 12) | (g << 8) | (b << 4) | ((pixel & 0x1)*0x0F);
|
||||||
|
|
||||||
|
|
@ -1018,10 +1019,10 @@ namespace Nz
|
||||||
SwapBytes(&pixel, sizeof(UInt16));
|
SwapBytes(&pixel, sizeof(UInt16));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
*dst++ = c5to8((pixel & 0xF800) >> 11);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0xF800) >> 11));
|
||||||
*dst++ = c5to8((pixel & 0x07C0) >> 6);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x07C0) >> 6));
|
||||||
*dst++ = c5to8((pixel & 0x003E) >> 1);
|
*dst++ = c5to8(SafeCast<UInt8>((pixel & 0x003E) >> 1));
|
||||||
*dst++ = static_cast<UInt8>((pixel & 0x1)*0xFF);
|
*dst++ = SafeCast<UInt8>((pixel & 0x1) * 0xFF);
|
||||||
|
|
||||||
start += 2;
|
start += 2;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ namespace Nz
|
||||||
0,
|
0,
|
||||||
subresourceLayers,
|
subresourceLayers,
|
||||||
{ // imageOffset
|
{ // imageOffset
|
||||||
box.x, box.y, box.z
|
SafeCast<Int32>(box.x), SafeCast<Int32>(box.y), SafeCast<Int32>(box.z)
|
||||||
},
|
},
|
||||||
{ // imageExtent
|
{ // imageExtent
|
||||||
box.width, box.height, box.depth
|
box.width, box.height, box.depth
|
||||||
|
|
@ -322,7 +322,7 @@ namespace Nz
|
||||||
|
|
||||||
copyCommandBuffer->SetImageLayout(m_image, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresourceRange);
|
copyCommandBuffer->SetImageLayout(m_image, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresourceRange);
|
||||||
|
|
||||||
copyCommandBuffer->CopyBufferToImage(stagingBuffer, m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresourceLayers, region);
|
copyCommandBuffer->CopyBufferToImage(stagingBuffer, m_image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, region);
|
||||||
|
|
||||||
copyCommandBuffer->SetImageLayout(m_image, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, subresourceRange);
|
copyCommandBuffer->SetImageLayout(m_image, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, subresourceRange);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue