Fixed crash on Intel cards with less than 64 uniform block align

- This should fix the crash with Intel cards. Sprite blinking appears to not occur either
This commit is contained in:
Shiny Metagross 2022-09-07 14:47:25 -07:00
parent 1835362a0c
commit 25a8199a74

View file

@ -47,7 +47,7 @@ BoneBuffer::BoneBuffer(int pipelineNbr) : mPipelineNbr(pipelineNbr)
{ {
mBufferType = false; mBufferType = false;
mBlockSize = screen->maxuniformblock / BONE_SIZE; mBlockSize = screen->maxuniformblock / BONE_SIZE;
mBlockAlign = screen->uniformblockalignment / BONE_SIZE; mBlockAlign = screen->uniformblockalignment < 64 ? 1 : screen->uniformblockalignment / BONE_SIZE;
mMaxUploadSize = (mBlockSize - mBlockAlign); mMaxUploadSize = (mBlockSize - mBlockAlign);
} }
@ -103,11 +103,8 @@ int BoneBuffer::UploadBones(const TArray<VSMatrix>& bones)
int BoneBuffer::GetBinding(unsigned int index, size_t* pOffset, size_t* pSize) int BoneBuffer::GetBinding(unsigned int index, size_t* pOffset, size_t* pSize)
{ {
unsigned int offset = index;
// this function will only get called if a uniform buffer is used. For a shader storage buffer we only need to bind the buffer once at the start. // this function will only get called if a uniform buffer is used. For a shader storage buffer we only need to bind the buffer once at the start.
if (mBlockAlign > 0) unsigned int offset = (index / mBlockAlign) * mBlockAlign;
offset = (index / mBlockAlign) * mBlockAlign;
*pOffset = offset * BONE_SIZE; *pOffset = offset * BONE_SIZE;
*pSize = mBlockSize * BONE_SIZE; *pSize = mBlockSize * BONE_SIZE;