mirror of https://github.com/bkaradzic/bgfx
Cleanup.
This commit is contained in:
parent
6921fc3438
commit
84a38eede0
|
@ -1057,7 +1057,7 @@ void mtxFromSrt(float* _outMtx, const Srt& _srt)
|
|||
|
||||
bool isNearZero(float _v)
|
||||
{
|
||||
return equal(_v, 0.0f, 0.00001f);
|
||||
return isEqual(_v, 0.0f, 0.00001f);
|
||||
}
|
||||
|
||||
bool isNearZero(const Vec3& _v)
|
||||
|
|
|
@ -4922,7 +4922,7 @@ namespace bgfx
|
|||
|
||||
BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) )
|
||||
{
|
||||
BX_ASSERT(bx::equal(_depth, bx::clamp(_depth, 0.0f, 1.0f), 0.0001f)
|
||||
BX_ASSERT(bx::isEqual(_depth, bx::clamp(_depth, 0.0f, 1.0f), 0.0001f)
|
||||
, "Clear depth value must be between 0.0 and 1.0 (_depth %f)."
|
||||
, _depth
|
||||
);
|
||||
|
@ -4932,7 +4932,7 @@ namespace bgfx
|
|||
|
||||
BGFX_API_FUNC(void setViewClear(ViewId _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _0, uint8_t _1, uint8_t _2, uint8_t _3, uint8_t _4, uint8_t _5, uint8_t _6, uint8_t _7) )
|
||||
{
|
||||
BX_ASSERT(bx::equal(_depth, bx::clamp(_depth, 0.0f, 1.0f), 0.0001f)
|
||||
BX_ASSERT(bx::isEqual(_depth, bx::clamp(_depth, 0.0f, 1.0f), 0.0001f)
|
||||
, "Clear depth value must be between 0.0 and 1.0 (_depth %f)."
|
||||
, _depth
|
||||
);
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include "bgfx_p.h"
|
||||
|
||||
#if BGFX_CONFIG_RENDERER_VULKAN
|
||||
# include <bx/pixelformat.h>
|
||||
# include "renderer_vk.h"
|
||||
# include "shader_spirv.h"
|
||||
# include <bx/pixelformat.h>
|
||||
|
||||
#if BX_PLATFORM_OSX
|
||||
# import <Cocoa/Cocoa.h>
|
||||
|
@ -1477,7 +1477,7 @@ VK_IMPORT_INSTANCE
|
|||
vkGetPhysicalDeviceFeatures(m_physicalDevice, &supportedFeatures);
|
||||
}
|
||||
|
||||
memset(&m_deviceFeatures, 0, sizeof(m_deviceFeatures) );
|
||||
bx::memSet(&m_deviceFeatures, 0, sizeof(m_deviceFeatures) );
|
||||
|
||||
m_deviceFeatures.fullDrawIndexUint32 = supportedFeatures.fullDrawIndexUint32;
|
||||
m_deviceFeatures.imageCubeArray = supportedFeatures.imageCubeArray && (_init.capabilities & BGFX_CAPS_TEXTURE_CUBE_ARRAY);
|
||||
|
|
|
@ -631,15 +631,7 @@ namespace bgfx
|
|||
|
||||
struct ConvertOp
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
Set,
|
||||
Copy,
|
||||
Convert,
|
||||
};
|
||||
|
||||
Attrib::Enum attr;
|
||||
Enum op;
|
||||
uint32_t src;
|
||||
uint32_t dest;
|
||||
uint32_t size;
|
||||
|
@ -648,6 +640,12 @@ namespace bgfx
|
|||
ConvertOp convertOp[Attrib::Count];
|
||||
uint32_t numOps = 0;
|
||||
|
||||
const uint8_t* src = (const uint8_t*)_srcData;
|
||||
uint32_t srcStride = _srcLayout.getStride();
|
||||
|
||||
uint8_t* dest = (uint8_t*)_destData;
|
||||
uint32_t destStride = _destLayout.getStride();
|
||||
|
||||
for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
|
||||
{
|
||||
Attrib::Enum attr = (Attrib::Enum)ii;
|
||||
|
@ -668,25 +666,25 @@ namespace bgfx
|
|||
if (_srcLayout.has(attr) )
|
||||
{
|
||||
cop.src = _srcLayout.getOffset(attr);
|
||||
cop.op = _destLayout.m_attributes[attr] == _srcLayout.m_attributes[attr] ? ConvertOp::Copy : ConvertOp::Convert;
|
||||
|
||||
if (_destLayout.m_attributes[attr] == _srcLayout.m_attributes[attr])
|
||||
{
|
||||
bx::memCopy(dest + cop.dest, destStride, src + cop.src, srcStride, cop.size, _num);
|
||||
}
|
||||
else
|
||||
{
|
||||
++numOps;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cop.op = ConvertOp::Set;
|
||||
bx::memSet(dest + cop.dest, destStride, 0, cop.size, _num);
|
||||
}
|
||||
|
||||
++numOps;
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < numOps)
|
||||
{
|
||||
const uint8_t* src = (const uint8_t*)_srcData;
|
||||
uint32_t srcStride = _srcLayout.getStride();
|
||||
|
||||
uint8_t* dest = (uint8_t*)_destData;
|
||||
uint32_t destStride = _destLayout.getStride();
|
||||
|
||||
float unpacked[4];
|
||||
|
||||
for (uint32_t ii = 0; ii < _num; ++ii)
|
||||
|
@ -694,25 +692,11 @@ namespace bgfx
|
|||
for (uint32_t jj = 0; jj < numOps; ++jj)
|
||||
{
|
||||
const ConvertOp& cop = convertOp[jj];
|
||||
|
||||
switch (cop.op)
|
||||
{
|
||||
case ConvertOp::Set:
|
||||
bx::memSet(dest + cop.dest, 0, cop.size);
|
||||
break;
|
||||
|
||||
case ConvertOp::Copy:
|
||||
bx::memCopy(dest + cop.dest, src + cop.src, cop.size);
|
||||
break;
|
||||
|
||||
case ConvertOp::Convert:
|
||||
vertexUnpack(unpacked, cop.attr, _srcLayout, src);
|
||||
vertexPack(unpacked, true, cop.attr, _destLayout, dest);
|
||||
break;
|
||||
}
|
||||
vertexUnpack(unpacked, cop.attr, _srcLayout, src);
|
||||
vertexPack(unpacked, true, cop.attr, _destLayout, dest);
|
||||
}
|
||||
|
||||
src += srcStride;
|
||||
src += srcStride;
|
||||
dest += destStride;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue