1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 22:09:35 +00:00

Use short, not byte, for element index

This commit is contained in:
Logan McNaughton 2018-02-26 12:00:59 -07:00 committed by Sergey Lipskiy
parent 06746ac26c
commit fefc4e63a8
5 changed files with 10 additions and 10 deletions

View File

@ -186,7 +186,7 @@ void BufferedDrawer::_updateTrianglesBuffers(const graphics::Context::DrawTriang
if (_params.elements == nullptr)
return;
const GLsizeiptr eboDataSize = sizeof(GLubyte) * _params.elementsCount;
const GLsizeiptr eboDataSize = sizeof(GLushort) * _params.elementsCount;
Buffer & eboBuffer = m_trisBuffers.ebo;
_updateBuffer(eboBuffer, _params.elementsCount, eboDataSize, _params.elements);
}
@ -204,8 +204,8 @@ void BufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParamete
}
if (config.frameBufferEmulation.N64DepthCompare == 0) {
glDrawElementsBaseVertex(GLenum(_params.mode), _params.elementsCount, GL_UNSIGNED_BYTE,
(char*)nullptr + m_trisBuffers.ebo.pos - _params.elementsCount, m_trisBuffers.vbo.pos - _params.verticesCount);
glDrawElementsBaseVertex(GLenum(_params.mode), _params.elementsCount, GL_UNSIGNED_SHORT,
(u16*)nullptr + m_trisBuffers.ebo.pos - _params.elementsCount, m_trisBuffers.vbo.pos - _params.verticesCount);
return;
}
@ -214,8 +214,8 @@ void BufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParamete
const GLint vboStartPos = m_trisBuffers.vbo.pos - _params.verticesCount;
for (GLuint i = 0; i < _params.elementsCount; i += 3) {
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
glDrawElementsBaseVertex(GLenum(_params.mode), 3, GL_UNSIGNED_BYTE,
(char*)nullptr + eboStartPos + i, vboStartPos);
glDrawElementsBaseVertex(GLenum(_params.mode), 3, GL_UNSIGNED_SHORT,
(u16*)nullptr + eboStartPos + i, vboStartPos);
}
}

View File

@ -82,14 +82,14 @@ void UnbufferedDrawer::drawTriangles(const graphics::Context::DrawTriangleParame
}
if (config.frameBufferEmulation.N64DepthCompare == 0) {
glDrawElements(GLenum(_params.mode), _params.elementsCount, GL_UNSIGNED_BYTE, _params.elements);
glDrawElements(GLenum(_params.mode), _params.elementsCount, GL_UNSIGNED_SHORT, _params.elements);
return;
}
// Draw polygons one by one
for (GLuint i = 0; i < _params.elementsCount; i += 3) {
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
glDrawElements(GLenum(_params.mode), 3, GL_UNSIGNED_BYTE, (u8*)_params.elements + i);
glDrawElements(GLenum(_params.mode), 3, GL_UNSIGNED_SHORT, (u16*)_params.elements + i);
}
}

View File

@ -191,7 +191,7 @@ private:
struct {
std::array<SPVertex, VERTBUFF_SIZE> vertices;
std::array<u8, ELEMBUFF_SIZE> elements;
std::array<u16, ELEMBUFF_SIZE> elements;
u32 num = 0;
int maxElement = 0;
} triangles;

View File

@ -164,7 +164,7 @@ u32 clipW(const SPVertex ** _vsrc, SPVertex * _vdst)
return dsti;
}
f32 renderTriangles(const SPVertex * _pVertices, const u8 * _pElements, u32 _numElements)
f32 renderTriangles(const SPVertex * _pVertices, const u16 * _pElements, u32 _numElements)
{
vertexclip vclip[16];
vertexi vdraw[12];

View File

@ -3,6 +3,6 @@
#include "gSP.h"
f32 renderTriangles(const SPVertex * _pVertices, const u8 * _pElements, u32 _numElements);
f32 renderTriangles(const SPVertex * _pVertices, const u16 * _pElements, u32 _numElements);
#endif // SOFTWARE_RENDER_H