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

Fix warnings of 64bit compiler.

This commit is contained in:
Sergey Lipskiy 2018-05-06 15:54:12 +07:00
parent 10710f96ac
commit 6725ad474a
15 changed files with 31 additions and 30 deletions

View File

@ -307,7 +307,7 @@ void ColorBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress, bool _sync)
u32 ColorBufferToRDRAM::_getRealWidth(u32 _viWidth)
{
u32 index = 0;
const u32 maxIndex = m_allowedRealWidths.size() - 1;
const u32 maxIndex = static_cast<u32>(m_allowedRealWidths.size()) - 1;
while (index < maxIndex && _viWidth > m_allowedRealWidths[index])
{
++index;

View File

@ -347,7 +347,7 @@ void CombinerInfo::_saveShadersStorage() const
bool CombinerInfo::_loadShadersStorage()
{
if (gfxContext.loadShadersStorage(m_combiners)) {
m_shadersLoaded = m_combiners.size();
m_shadersLoaded = static_cast<u32>(m_combiners.size());
return true;
}

View File

@ -283,7 +283,7 @@ void Debugger::_fillTriInfo(TriInfo & _info)
void Debugger::_addTrianglesByElements(const Context::DrawTriangleParameters & _params)
{
u8 * elements = reinterpret_cast<u8*>(_params.elements);
u32 cur_tri = m_triangles.size();
u32 cur_tri = static_cast<u32>(m_triangles.size());
for (u32 i = 0; i < _params.elementsCount;) {
m_triangles.emplace_back();
TriInfo & info = m_triangles.back();
@ -297,7 +297,7 @@ void Debugger::_addTrianglesByElements(const Context::DrawTriangleParameters & _
void Debugger::_addTriangles(const Context::DrawTriangleParameters & _params)
{
u32 cur_tri = m_triangles.size();
u32 cur_tri = static_cast<u32>(m_triangles.size());
for (u32 i = 0; i < _params.verticesCount;) {
m_triangles.emplace_back();
TriInfo & info = m_triangles.back();
@ -333,7 +333,7 @@ void Debugger::addRects(const graphics::Context::DrawRectParameters & _params)
if (!m_bCapture)
return;
u32 cur_tri = m_triangles.size();
u32 cur_tri = static_cast<u32>(m_triangles.size());
for (u32 i = 0; i < 2; ++i) {
m_triangles.emplace_back();
TriInfo & info = m_triangles.back();
@ -530,7 +530,7 @@ void Debugger::_drawTextureCache()
return val->texture->name == tex;
});
auto d = std::distance(texInfos.begin(), iter);
m_startTexRow[m_tmu] = d / m_cacheViewerCols;
m_startTexRow[m_tmu] = static_cast<u32>(d) / m_cacheViewerCols;
m_clickY = 0;
m_selectedTexPos[m_tmu].row = 0;
m_selectedTexPos[m_tmu].col = d % m_cacheViewerCols;

View File

@ -299,8 +299,8 @@ bool FrameBuffer::isValid(bool _forceCheck) const
return false;
return true;
} else if (!m_RdramCopy.empty()) {
const u32 * const pCopy = (const u32*)m_RdramCopy.data();
const u32 size = m_RdramCopy.size();
const u32 * const pCopy = reinterpret_cast<const u32* >(m_RdramCopy.data());
const u32 size = static_cast<u32>(m_RdramCopy.size());
const u32 size_dwords = size >> 2;
u32 start = m_startAddress >> 2;
u32 wrongPixels = 0;

View File

@ -27,7 +27,7 @@ namespace graphics {
const u32 stridePixels = _stride * colorsPerPixel;
if (_height * widthPixels > m_pixelData.size())
_height = m_pixelData.size() / widthPixels;
_height = static_cast<u32>(m_pixelData.size()) / widthPixels;
for (u32 heightIndex = 0; heightIndex < _height; ++heightIndex) {
for (u32 widthIndex = 0; widthIndex < widthPixels; ++widthIndex) {
@ -49,7 +49,7 @@ namespace graphics {
u8* pixelDataAlloc = m_pixelData.data();
if (_height * widthBytes > m_pixelData.size())
_height = m_pixelData.size() / widthBytes;
_height = static_cast<u32>(m_pixelData.size()) / widthBytes;
for (u32 index = 0; index < _height; ++index) {
memcpy(pixelDataAlloc + index * widthBytes, _gpuData + ((index + _heightOffset) * strideBytes), widthBytes);

View File

@ -44,7 +44,8 @@ void getStorageFileName(const opengl::GLInfo & _glinfo, wchar_t * _shadersFileNa
strOpenGLType = L"OpenGL";
}
swprintf(_shadersFileName, PLUGIN_PATH_SIZE, L"%ls/GLideN64.%08lx.%ls.%ls", pPath, std::hash<std::string>()(RSP.romname), strOpenGLType.c_str(), _fileExtension);
swprintf(_shadersFileName, PLUGIN_PATH_SIZE, L"%ls/GLideN64.%08x.%ls.%ls",
pPath, static_cast<u32>(std::hash<std::string>()(RSP.romname)), strOpenGLType.c_str(), _fileExtension);
}
/*
@ -134,12 +135,12 @@ bool ShaderStorage::saveShadersStorage(const graphics::Combiners & _combiners) c
shadersOut.write((char*)&configOptionsBitSet, sizeof(configOptionsBitSet));
const char * strRenderer = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
u32 len = strlen(strRenderer);
u32 len = static_cast<u32>(strlen(strRenderer));
shadersOut.write((char*)&len, sizeof(len));
shadersOut.write(strRenderer, len);
const char * strGLVersion = reinterpret_cast<const char *>(glGetString(GL_VERSION));
len = strlen(strGLVersion);
len = static_cast<u32>(strlen(strGLVersion));
shadersOut.write((char*)&len, sizeof(len));
shadersOut.write(strGLVersion, len);

View File

@ -155,7 +155,7 @@ public:
void * getDataRange(u32 _offset, u32 _range) override
{
if (_range > m_size)
_range = m_size;
_range = static_cast<u32>(m_size);
return glMapBufferRange(GL_PIXEL_PACK_BUFFER, _offset, _range, GL_MAP_READ_BIT);
}

View File

@ -106,7 +106,7 @@ void BufferedDrawer::_updateRectBuffer(const graphics::Context::DrawRectParamete
}
Buffer & buffer = m_rectsBuffers.vbo;
const size_t dataSize = _params.verticesCount * sizeof(RectVertex);
const u32 dataSize = _params.verticesCount * static_cast<u32>(sizeof(RectVertex));
if (m_glInfo.bufferStorage) {
_updateBuffer(buffer, _params.verticesCount, dataSize, _params.vertices);
@ -125,7 +125,7 @@ void BufferedDrawer::_updateRectBuffer(const graphics::Context::DrawRectParamete
if (buffer.offset < prevOffset)
m_rectBufferOffsets.clear();
buffer.pos = buffer.offset / sizeof(RectVertex);
buffer.pos = static_cast<GLint>(buffer.offset / sizeof(RectVertex));
m_rectBufferOffsets[crc] = buffer.pos;
}
@ -179,14 +179,14 @@ void BufferedDrawer::_updateTrianglesBuffers(const graphics::Context::DrawTriang
}
_convertFromSPVertex(_params.flatColors, _params.verticesCount, _params.vertices);
const GLsizeiptr vboDataSize = _params.verticesCount * sizeof(Vertex);
const u32 vboDataSize = _params.verticesCount * static_cast<u32>(sizeof(Vertex));
Buffer & vboBuffer = m_trisBuffers.vbo;
_updateBuffer(vboBuffer, _params.verticesCount, vboDataSize, m_vertices.data());
if (_params.elements == nullptr)
return;
const GLsizeiptr eboDataSize = sizeof(GLushort) * _params.elementsCount;
const u32 eboDataSize = static_cast<u32>(sizeof(GLushort)) * _params.elementsCount;
Buffer & eboBuffer = m_trisBuffers.ebo;
_updateBuffer(eboBuffer, _params.elementsCount, eboDataSize, _params.elements);
}

View File

@ -141,7 +141,7 @@ public:
SPVertex * getDMAVerticesData() { return m_dmaVertices.data(); }
SPVertex & getCurrentDMAVertex();
size_t getDMAVerticesCount() const { return m_dmaVerticesNum; }
u32 getDMAVerticesCount() const { return m_dmaVerticesNum; }
void updateScissor(FrameBuffer * _pBuffer) const;
@ -197,7 +197,7 @@ private:
} triangles;
std::vector<SPVertex> m_dmaVertices;
size_t m_dmaVerticesNum;
u32 m_dmaVerticesNum;
RectVertex m_rect[4];

View File

@ -92,12 +92,12 @@ void NoiseTexture::_fillTextureData()
start += chunk;
} while (start < NOISE_TEX_NUM - chunk);
FillTextureData(generator(), &m_texData, start, m_texData.size());
FillTextureData(generator(), &m_texData, start, static_cast<u32>(m_texData.size()));
for (auto& t : threads)
t.join();
} else {
FillTextureData(static_cast<u32>(time(nullptr)), &m_texData, 0, m_texData.size());
FillTextureData(static_cast<u32>(time(nullptr)), &m_texData, 0, static_cast<u32>(m_texData.size()));
}
displayLoadProgress(L"");

View File

@ -357,7 +357,7 @@ void TextDrawer::drawText(const char *_pText, float _x, float _y) const
Context::DrawRectParameters rectParams;
rectParams.mode = drawmode::TRIANGLES;
rectParams.verticesCount = coords.size();
rectParams.verticesCount = static_cast<u32>(coords.size());
rectParams.vertices = coords.data();
rectParams.combiner = m_program.get();
gfxContext.drawRects(rectParams);

View File

@ -1192,7 +1192,7 @@ void gDPLLETriangle(u32 _w1, u32 _w2, int _shade, int _texture, int _zbuffer, u3
if (_zbuffer != 0)
gSP.geometryMode |= G_ZBUFFER;
drawer.drawScreenSpaceTriangle(vtx - vtx0);
drawer.drawScreenSpaceTriangle(static_cast<u32>(vtx - vtx0));
gSP.textureTile[0] = textureTileOrg[0];
gSP.textureTile[1] = textureTileOrg[1];

View File

@ -1445,7 +1445,7 @@ void gSPDMATriangles( u32 tris, u32 n ){
mode |= G_CULL_FRONT;
}
if ((gSP.geometryMode&G_CULL_BOTH) != mode) {
drawer.drawDMATriangles(pVtx - drawer.getDMAVerticesData());
drawer.drawDMATriangles(static_cast<u32>(pVtx - drawer.getDMAVerticesData()));
pVtx = drawer.getDMAVerticesData();
gSP.geometryMode &= ~G_CULL_BOTH;
gSP.geometryMode |= mode;
@ -1474,7 +1474,7 @@ void gSPDMATriangles( u32 tris, u32 n ){
++triangles;
}
DebugMsg(DEBUG_NORMAL, "gSPDMATriangles( 0x%08X, %i );\n");
drawer.drawDMATriangles(pVtx - drawer.getDMAVerticesData());
drawer.drawDMATriangles(static_cast<u32>(pVtx - drawer.getDMAVerticesData()));
}
void gSP1Quadrangle( s32 v0, s32 v1, s32 v2, s32 v3 )

View File

@ -834,7 +834,7 @@ void TriGen0000()
// Step 3. Process vertices
const SWVertex * vertex = (const SWVertex*)vtxData32.data();
const size_t vtxSize = vtxData32.size() / 2;
const u32 vtxSize = static_cast<u32>(vtxData32.size()) / 2;
gSPSWVertex(vertex, vtxSize, 0);
// Step 4. Prepare color indices and texture coordinates. Prepare vertices for rendering
@ -902,7 +902,7 @@ void TriGen0001()
// Step 3. Process vertices
const SWVertex * vertex = (const SWVertex*)vtxData32.data();
const size_t vtxSize = vtxData32.size() / 2;
const u32 vtxSize = static_cast<u32>(vtxData32.size()) / 2;
gSPSWVertex(vertex, vtxSize, 0);
// Step 4. Prepare color indices and texture coordinates. Prepare vertices for rendering

View File

@ -155,7 +155,7 @@ void T3DUX_LoadObject(u32 pstate, u32 pvtx, u32 ptri, u32 pcol)
const u32 w1 = t32uxSetTileW1 | (tri->pal << 20);
const u32 newPal = _SHIFTR(w1, 20, 4);
if (pal != newPal) {
drawer.drawDMATriangles(pVtx - drawer.getDMAVerticesData());
drawer.drawDMATriangles(static_cast<u32>(pVtx - drawer.getDMAVerticesData()));
pVtx = drawer.getDMAVerticesData();
pal = newPal;
RDP_SetTile(t32uxSetTileW0, w1);
@ -207,7 +207,7 @@ void T3DUX_LoadObject(u32 pstate, u32 pvtx, u32 ptri, u32 pcol)
}
}
drawer.drawDMATriangles(pVtx - drawer.getDMAVerticesData());
drawer.drawDMATriangles(static_cast<u32>(pVtx - drawer.getDMAVerticesData()));
}
void RunT3DUX()