IQM Support Implemented

More info to come
This commit is contained in:
Shiny Metagross 2022-08-12 13:17:08 -07:00 committed by Christoph Oelckers
commit 08f520f1c6
49 changed files with 1356 additions and 62 deletions

View file

@ -211,8 +211,10 @@ void GLBuffer::GPUWaitSync()
void GLVertexBuffer::SetFormat(int numBindingPoints, int numAttributes, size_t stride, const FVertexBufferAttribute *attrs)
{
static int VFmtToGLFmt[] = { GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_UNSIGNED_BYTE, GL_INT_2_10_10_10_REV };
static uint8_t VFmtToSize[] = {4, 3, 2, 1, 4, 4};
static int VFmtToGLFmt[] = { GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_FLOAT, GL_UNSIGNED_BYTE, GL_INT_2_10_10_10_REV, GL_UNSIGNED_BYTE };
static uint8_t VFmtToSize[] = { 4, 3, 2, 1, 4, 4, 4 };
static bool VFmtToNormalize[] = { false, false, false, false, true, true, false };
static bool VFmtToIntegerType[] = { false, false, false, false, false, false, true };
mStride = stride;
mNumBindingPoints = numBindingPoints;
@ -226,6 +228,8 @@ void GLVertexBuffer::SetFormat(int numBindingPoints, int numAttributes, size_t s
attrinf.size = VFmtToSize[attrs[i].format];
attrinf.offset = attrs[i].offset;
attrinf.bindingpoint = attrs[i].binding;
attrinf.normalize = VFmtToNormalize[attrs[i].format];
attrinf.integerType = VFmtToIntegerType[attrs[i].format];
}
}
}
@ -246,7 +250,10 @@ void GLVertexBuffer::Bind(int *offsets)
{
glEnableVertexAttribArray(i);
size_t ofs = offsets == nullptr ? attrinf.offset : attrinf.offset + mStride * offsets[attrinf.bindingpoint];
glVertexAttribPointer(i, attrinf.size, attrinf.format, attrinf.format != GL_FLOAT, (GLsizei)mStride, (void*)(intptr_t)ofs);
if (!attrinf.integerType)
glVertexAttribPointer(i, attrinf.size, attrinf.format, attrinf.normalize, (GLsizei)mStride, (void*)(intptr_t)ofs);
else
glVertexAttribIPointer(i, attrinf.size, attrinf.format, (GLsizei)mStride, (void*)(intptr_t)ofs);
}
i++;
}