diff --git a/src/common/rendering/hwrenderer/data/hw_bonebuffer.cpp b/src/common/rendering/hwrenderer/data/hw_bonebuffer.cpp index 9d465d417a..1cc68ca2fe 100644 --- a/src/common/rendering/hwrenderer/data/hw_bonebuffer.cpp +++ b/src/common/rendering/hwrenderer/data/hw_bonebuffer.cpp @@ -103,8 +103,11 @@ int BoneBuffer::UploadBones(const TArray& bones) 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. - unsigned int offset = (index / mBlockAlign) * mBlockAlign; + if (mBlockAlign > 0) + offset = (index / mBlockAlign) * mBlockAlign; *pOffset = offset * BONE_SIZE; *pSize = mBlockSize * BONE_SIZE; diff --git a/wadsrc/static/shaders/glsl/main.vp b/wadsrc/static/shaders/glsl/main.vp index e41152065c..d9ab20fa37 100644 --- a/wadsrc/static/shaders/glsl/main.vp +++ b/wadsrc/static/shaders/glsl/main.vp @@ -169,7 +169,7 @@ void AddWeightedBone(uint boneIndex, float weight, inout vec4 position, inout ve { if (weight != 0.0) { - mat4 transform = bones[uBoneIndexBase + boneIndex]; + mat4 transform = bones[uBoneIndexBase + (int)boneIndex]; mat3 rotation = mat3(transform); position += (transform * aPosition) * weight; normal += (rotation * aNormal.xyz) * weight;