diff --git a/neo/framework/Common_printf.cpp b/neo/framework/Common_printf.cpp index 0c6695d3..b67b799e 100644 --- a/neo/framework/Common_printf.cpp +++ b/neo/framework/Common_printf.cpp @@ -175,9 +175,17 @@ void idCommonLocal::VPrintf( const char* fmt, va_list args ) } } #endif + + if( !idLib::IsMainThread() ) { + // RB: printf should be thread-safe on Linux +#if defined(_WIN32) OutputDebugString( msg ); +#else + printf( msg ); +#endif + // RB end return; } @@ -448,7 +456,9 @@ void idCommonLocal::DumpWarnings() fileSystem->CloseFile( warningFile ); -#ifndef ID_DEBUG + // RB begin +#if defined(_WIN32) && !defined(_DEBUG) + // RB end idStr osPath; osPath = fileSystem->RelativePathToOSPath( "warnings.txt", "fs_savepath" ); WinExec( va( "Notepad.exe %s", osPath.c_str() ), SW_SHOW ); diff --git a/neo/framework/KeyInput.cpp b/neo/framework/KeyInput.cpp index 65a9051b..6adf36d7 100644 --- a/neo/framework/KeyInput.cpp +++ b/neo/framework/KeyInput.cpp @@ -3,6 +3,7 @@ Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2012 Robert Beckebans This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). @@ -369,6 +370,8 @@ idKeyInput::LocalizedKeyName */ const char* idKeyInput::LocalizedKeyName( keyNum_t keynum ) { + // RB: FIXME +#if defined(_WIN32) if( keynum < K_JOY1 ) { // On the PC, we want to turn the scan code in to a key label that matches the currently selected keyboard layout @@ -400,6 +403,10 @@ const char* idKeyInput::LocalizedKeyName( keyNum_t keynum ) } } return "????"; +#else + return KeyNumToString( keynum ); +#endif + // RB end } /* diff --git a/neo/framework/Zip.cpp b/neo/framework/Zip.cpp index 6e2f0645..1ffddb17 100644 --- a/neo/framework/Zip.cpp +++ b/neo/framework/Zip.cpp @@ -1479,6 +1479,8 @@ idZipBuilder::GetFileTime */ bool idZipBuilder::GetFileTime( const idStr& filename, unsigned long* dostime ) const { + // RB: FIXME +#if defined(_WIN32) { FILETIME filetime; WIN32_FIND_DATA fileData; @@ -1492,6 +1494,9 @@ bool idZipBuilder::GetFileTime( const idStr& filename, unsigned long* dostime ) } FindClose( findHandle ); } +#endif + // RB end + return false; } diff --git a/neo/idlib/sys/sys_defines.h b/neo/idlib/sys/sys_defines.h index 9390d480..3fafb8d4 100644 --- a/neo/idlib/sys/sys_defines.h +++ b/neo/idlib/sys/sys_defines.h @@ -143,6 +143,8 @@ If you have questions concerning this license or the applicable additional terms // DG end #define ID_HDRSTOP +#define CALLBACK +#define __cdecl #endif // RB end diff --git a/neo/renderer/BufferObject.cpp b/neo/renderer/BufferObject.cpp index 9ea2cad7..74401d02 100644 --- a/neo/renderer/BufferObject.cpp +++ b/neo/renderer/BufferObject.cpp @@ -3,6 +3,7 @@ Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2012 Robert Beckebans This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). @@ -35,6 +36,8 @@ idCVar r_showBuffers( "r_showBuffers", "0", CVAR_INTEGER, "" ); //static const GLenum bufferUsage = GL_STATIC_DRAW_ARB; static const GLenum bufferUsage = GL_DYNAMIC_DRAW_ARB; +// RB begin +#if defined(_WIN32) /* ================== IsWriteCombined @@ -53,7 +56,8 @@ bool IsWriteCombined( void* base ) bool isWriteCombined = ( ( info.AllocationProtect & PAGE_WRITECOMBINE ) != 0 ); return isWriteCombined; } - +#endif +// RB end /* @@ -237,8 +241,10 @@ void idVertexBuffer::FreeBufferObject() idLib::Printf( "vertex buffer free %p, api %p (%i bytes)\n", this, GetAPIObject(), GetSize() ); } - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); - qglDeleteBuffersARB( 1, & bufferObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + qglDeleteBuffersARB( 1, (const unsigned int*) & bufferObject ); + // RB end ClearWithoutFreeing(); } @@ -302,7 +308,10 @@ void idVertexBuffer::Update( const void* data, int updateSize ) const int numBytes = ( updateSize + 15 ) & ~15; - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + // RB end + qglBindBufferARB( GL_ARRAY_BUFFER_ARB, bufferObject ); qglBufferSubDataARB( GL_ARRAY_BUFFER_ARB, GetOffset(), ( GLsizeiptrARB )numBytes, data ); /* @@ -324,7 +333,10 @@ void* idVertexBuffer::MapBuffer( bufferMapType_t mapType ) const void* buffer = NULL; - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + // RB end + qglBindBufferARB( GL_ARRAY_BUFFER_ARB, bufferObject ); if( mapType == BM_READ ) { @@ -369,7 +381,10 @@ void idVertexBuffer::UnmapBuffer() const assert( apiObject != NULL ); assert( IsMapped() ); - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + // RB end + qglBindBufferARB( GL_ARRAY_BUFFER_ARB, bufferObject ); if( !qglUnmapBufferARB( GL_ARRAY_BUFFER_ARB ) ) { @@ -511,8 +526,10 @@ void idIndexBuffer::FreeBufferObject() idLib::Printf( "index buffer free %p, api %p (%i bytes)\n", this, GetAPIObject(), GetSize() ); } - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); - qglDeleteBuffersARB( 1, & bufferObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + qglDeleteBuffersARB( 1, ( const unsigned int* )& bufferObject ); + // RB end ClearWithoutFreeing(); } @@ -577,7 +594,10 @@ void idIndexBuffer::Update( const void* data, int updateSize ) const int numBytes = ( updateSize + 15 ) & ~15; - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + // RB end + qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, bufferObject ); qglBufferSubDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, GetOffset(), ( GLsizeiptrARB )numBytes, data ); /* @@ -600,7 +620,10 @@ void* idIndexBuffer::MapBuffer( bufferMapType_t mapType ) const void* buffer = NULL; - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + // RB end + qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, bufferObject ); if( mapType == BM_READ ) { @@ -645,7 +668,10 @@ void idIndexBuffer::UnmapBuffer() const assert( apiObject != NULL ); assert( IsMapped() ); - GLuint bufferObject = reinterpret_cast< GLuint >( apiObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject ); + // RB end + qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, bufferObject ); if( !qglUnmapBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB ) ) { @@ -769,9 +795,12 @@ void idJointBuffer::FreeBufferObject() idLib::Printf( "joint buffer free %p, api %p (%i joints)\n", this, GetAPIObject(), GetNumJoints() ); } - GLuint buffer = reinterpret_cast< GLuint >( apiObject ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + GLintptrARB buffer = reinterpret_cast< GLintptrARB >( apiObject ); + qglBindBufferARB( GL_UNIFORM_BUFFER, 0 ); - qglDeleteBuffersARB( 1, & buffer ); + qglDeleteBuffersARB( 1, (const GLuint*)& buffer ); + // RB end ClearWithoutFreeing(); } @@ -836,7 +865,10 @@ void idJointBuffer::Update( const float* joints, int numUpdateJoints ) const const int numBytes = numUpdateJoints * 3 * 4 * sizeof( float ); - qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLuint >( apiObject ) ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLintptrARB >( apiObject ) ); + // RB end + qglBufferSubDataARB( GL_UNIFORM_BUFFER, GetOffset(), ( GLsizeiptrARB )numBytes, joints ); } @@ -855,7 +887,10 @@ float* idJointBuffer::MapBuffer( bufferMapType_t mapType ) const void* buffer = NULL; - qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLuint >( apiObject ) ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLintptrARB >( apiObject ) ); + // RB end + numBytes = numBytes; assert( GetOffset() == 0 ); //buffer = qglMapBufferARB( GL_UNIFORM_BUFFER, GL_WRITE_ONLY_ARB ); @@ -884,7 +919,10 @@ void idJointBuffer::UnmapBuffer() const assert( apiObject != NULL ); assert( IsMapped() ); - qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLuint >( apiObject ) ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLintptrARB >( apiObject ) ); + // RB end + if( !qglUnmapBufferARB( GL_UNIFORM_BUFFER ) ) { idLib::Printf( "idJointBuffer::UnmapBuffer failed\n" ); diff --git a/neo/renderer/Model_lwo.cpp b/neo/renderer/Model_lwo.cpp index eb6108d2..2ffa3834 100644 --- a/neo/renderer/Model_lwo.cpp +++ b/neo/renderer/Model_lwo.cpp @@ -2835,7 +2835,7 @@ int lwResolvePolySurfaces( lwPolygonList* polygon, lwTagList* tlist, lwSurface** surf, int* nsurfs ) { lwSurface** s, *st; - int i, index; + int i; if( tlist->count == 0 ) return 1; @@ -2855,10 +2855,13 @@ int lwResolvePolySurfaces( lwPolygonList* polygon, lwTagList* tlist, st = st->next; } } - + // RB: 64 bit fixes + uintptr_t index; for( i = 0; i < polygon->count; i++ ) { - index = ( int ) polygon->pol[ i ].surf; + index = ( uintptr_t ) polygon->pol[ i ].surf; + // RB end + if( index < 0 || index > tlist->count ) return 0; if( !s[ index ] ) { diff --git a/neo/renderer/OpenGL/gl_Image.cpp b/neo/renderer/OpenGL/gl_Image.cpp index 439b2c6d..2d427337 100644 --- a/neo/renderer/OpenGL/gl_Image.cpp +++ b/neo/renderer/OpenGL/gl_Image.cpp @@ -488,12 +488,24 @@ void idImage::AllocImage() // As of 2011-10-6 using NVIDIA hardware and drivers we have to allocate the memory with HeapAlloc // with the exact size otherwise large image allocation (for instance for physical page textures) // may fail on Vista 32-bit. + + // RB begin +#if defined(_WIN32) void* data = HeapAlloc( GetProcessHeap(), 0, compressedSize ); qglCompressedTexImage2DARB( uploadTarget + side, level, internalFormat, w, h, 0, compressedSize, data ); if( data != NULL ) { HeapFree( GetProcessHeap(), 0, data ); } +#else + byte* data = ( byte* )Mem_Alloc( compressedSize, TAG_TEMP ); + qglCompressedTexImage2DARB( uploadTarget + side, level, internalFormat, w, h, 0, compressedSize, data ); + if( data != NULL ) + { + Mem_Free( data ); + } +#endif + // RB end } else { diff --git a/neo/renderer/RenderSystem.cpp b/neo/renderer/RenderSystem.cpp index f6b51bfc..17bab745 100644 --- a/neo/renderer/RenderSystem.cpp +++ b/neo/renderer/RenderSystem.cpp @@ -733,7 +733,10 @@ void idRenderSystemLocal::SwapCommandBuffers_FinishRendering( // read back the start and end timer queries from the previous frame if( glConfig.timerQueryAvailable ) { - uint64 drawingTimeNanoseconds = 0; + // RB: 64 bit fixes, changed int64 to GLuint64EXT + GLuint64EXT drawingTimeNanoseconds = 0; + // RB end + if( tr.timerQueryId != 0 ) { qglGetQueryObjectui64vEXT( tr.timerQueryId, GL_QUERY_RESULT, &drawingTimeNanoseconds ); diff --git a/neo/renderer/RenderSystem_init.cpp b/neo/renderer/RenderSystem_init.cpp index 4e87b333..5351ad94 100644 --- a/neo/renderer/RenderSystem_init.cpp +++ b/neo/renderer/RenderSystem_init.cpp @@ -3,6 +3,7 @@ Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. +Copyright (C) 2012 Robert Beckebans This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code"). @@ -31,8 +32,13 @@ If you have questions concerning this license or the applicable additional terms #include "tr_local.h" +// RB begin +#if defined(_WIN32) + // Vista OpenGL wrapper check #include "../sys/win32/win_local.h" +#endif +// RB end // DeviceContext bypasses RenderSystem to work directly with this idGuiModel* tr_guiModel; @@ -195,7 +201,9 @@ idCVar stereoRender_deGhost( "stereoRender_deGhost", "0.05", CVAR_FLOAT | CVAR_A // GL_ARB_multitexture PFNGLACTIVETEXTUREPROC qglActiveTextureARB; -PFNGLCLIENTACTIVETEXTUREPROC qglClientActiveTextureARB; +// RB: deprecated +//PFNGLCLIENTACTIVETEXTUREPROC qglClientActiveTextureARB; +// RB end // GL_EXT_direct_state_access PFNGLBINDMULTITEXTUREEXTPROC qglBindMultiTextureEXT; @@ -319,7 +327,9 @@ void APIENTRY glBindMultiTextureEXT( GLenum texunit, GLenum target, GLuint textu R_CheckExtension ================= */ -bool R_CheckExtension( char* name ) +// RB begin +static bool R_CheckExtension( const char* name ) +// RB end { if( !strstr( glConfig.extensions_string, name ) ) { @@ -343,8 +353,15 @@ static void CALLBACK DebugCallback( unsigned int source, unsigned int type, unsigned int id, unsigned int severity, int length, const char* message, void* userParam ) { // it probably isn't safe to do an idLib::Printf at this point + + // RB begin +#if defined(_WIN32) OutputDebugString( message ); OutputDebugString( "\n" ); +#else + printf( "%s\n", message ); +#endif + // RB end } /* @@ -379,7 +396,9 @@ static void R_CheckPortableExtensions() if( glConfig.multitextureAvailable ) { qglActiveTextureARB = ( void( APIENTRY* )( GLenum ) )GLimp_ExtensionPointer( "glActiveTextureARB" ); - qglClientActiveTextureARB = ( void( APIENTRY* )( GLenum ) )GLimp_ExtensionPointer( "glClientActiveTextureARB" ); + // RB: deprecated + //qglClientActiveTextureARB = ( void( APIENTRY* )( GLenum ) )GLimp_ExtensionPointer( "glClientActiveTextureARB" ); + // RB end } // GL_EXT_direct_state_access @@ -919,6 +938,8 @@ void R_InitOpenGL() // Reset our gamma R_SetColorMappings(); + // RB begin +#if defined(_WIN32) static bool glCheck = false; if( !glCheck && win32.osversion.dwMajorVersion == 6 ) { @@ -943,6 +964,8 @@ void R_InitOpenGL() } } } +#endif + // RB end } /* @@ -1849,6 +1872,8 @@ void GfxInfo_f( const idCmdArgs& args ) common->Printf( "-------\n" ); + // RB begin +#if defined(_WIN32) // WGL_EXT_swap_interval typedef BOOL ( WINAPI * PFNWGLSWAPINTERVALEXTPROC )( int interval ); extern PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT; @@ -1861,6 +1886,8 @@ void GfxInfo_f( const idCmdArgs& args ) { common->Printf( "swapInterval not forced\n" ); } +#endif + // RB end if( glConfig.stereoPixelFormatAvailable && glConfig.isStereoPixelFormat ) { diff --git a/neo/renderer/tr_backend_draw.cpp b/neo/renderer/tr_backend_draw.cpp index 9662c6bc..38f1a268 100644 --- a/neo/renderer/tr_backend_draw.cpp +++ b/neo/renderer/tr_backend_draw.cpp @@ -170,7 +170,9 @@ void RB_DrawElementsWithCounters( const drawSurf_t* surf ) } indexBuffer = &vertexCache.frameData[vertexCache.drawListNum].indexBuffer; } - const int indexOffset = ( int )( ibHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK; + // RB: 64 bit fixes, changed int to GLintptrARB + const GLintptrARB indexOffset = ( GLintptrARB )( ibHandle >> VERTCACHE_OFFSET_SHIFT ) & VERTCACHE_OFFSET_MASK; + // RB end RENDERLOG_PRINTF( "Binding Buffers: %p:%i %p:%i\n", vertexBuffer, vertOffset, indexBuffer, indexOffset ); @@ -200,22 +202,26 @@ void RB_DrawElementsWithCounters( const drawSurf_t* surf ) } assert( ( jointBuffer.GetOffset() & ( glConfig.uniformBufferOffsetAlignment - 1 ) ) == 0 ); - const GLuint ubo = reinterpret_cast< GLuint >( jointBuffer.GetAPIObject() ); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + const GLintptrARB ubo = reinterpret_cast< GLintptrARB >( jointBuffer.GetAPIObject() ); + // RB end + qglBindBufferRange( GL_UNIFORM_BUFFER, 0, ubo, jointBuffer.GetOffset(), jointBuffer.GetNumJoints() * sizeof( idJointMat ) ); } renderProgManager.CommitUniforms(); - if( backEnd.glState.currentIndexBuffer != ( GLuint )indexBuffer->GetAPIObject() || !r_useStateCaching.GetBool() ) + // RB: 64 bit fixes, changed GLuint to GLintptrARB + if( backEnd.glState.currentIndexBuffer != ( GLintptrARB )indexBuffer->GetAPIObject() || !r_useStateCaching.GetBool() ) { - qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, ( GLuint )indexBuffer->GetAPIObject() ); - backEnd.glState.currentIndexBuffer = ( GLuint )indexBuffer->GetAPIObject(); + qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, ( GLintptrARB )indexBuffer->GetAPIObject() ); + backEnd.glState.currentIndexBuffer = ( GLintptrARB )indexBuffer->GetAPIObject(); } - if( ( backEnd.glState.vertexLayout != LAYOUT_DRAW_VERT ) || ( backEnd.glState.currentVertexBuffer != ( GLuint )vertexBuffer->GetAPIObject() ) || !r_useStateCaching.GetBool() ) + if( ( backEnd.glState.vertexLayout != LAYOUT_DRAW_VERT ) || ( backEnd.glState.currentVertexBuffer != ( GLintptrARB )vertexBuffer->GetAPIObject() ) || !r_useStateCaching.GetBool() ) { - qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLuint )vertexBuffer->GetAPIObject() ); - backEnd.glState.currentVertexBuffer = ( GLuint )vertexBuffer->GetAPIObject(); + qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLintptrARB )vertexBuffer->GetAPIObject() ); + backEnd.glState.currentVertexBuffer = ( GLintptrARB )vertexBuffer->GetAPIObject(); qglEnableVertexAttribArrayARB( PC_ATTRIB_INDEX_VERTEX ); qglEnableVertexAttribArrayARB( PC_ATTRIB_INDEX_NORMAL ); @@ -233,6 +239,7 @@ void RB_DrawElementsWithCounters( const drawSurf_t* surf ) backEnd.glState.vertexLayout = LAYOUT_DRAW_VERT; } + // RB end qglDrawElementsBaseVertex( GL_TRIANGLES, r_singleTriangle.GetBool() ? 3 : surf->numIndexes, @@ -1713,11 +1720,11 @@ static void RB_StencilShadowPass( const drawSurf_t* drawSurfs, const viewLight_t RENDERLOG_PRINTF( "Binding Buffers: %p %p\n", vertexBuffer, indexBuffer ); - - if( backEnd.glState.currentIndexBuffer != ( GLuint )indexBuffer->GetAPIObject() || !r_useStateCaching.GetBool() ) + // RB: 64 bit fixes, changed GLuint to GLintptrARB + if( backEnd.glState.currentIndexBuffer != ( GLintptrARB )indexBuffer->GetAPIObject() || !r_useStateCaching.GetBool() ) { - qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, ( GLuint )indexBuffer->GetAPIObject() ); - backEnd.glState.currentIndexBuffer = ( GLuint )indexBuffer->GetAPIObject(); + qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, ( GLintptrARB )indexBuffer->GetAPIObject() ); + backEnd.glState.currentIndexBuffer = ( GLintptrARB )indexBuffer->GetAPIObject(); } if( drawSurf->jointCache ) @@ -1732,13 +1739,13 @@ static void RB_StencilShadowPass( const drawSurf_t* drawSurfs, const viewLight_t } assert( ( jointBuffer.GetOffset() & ( glConfig.uniformBufferOffsetAlignment - 1 ) ) == 0 ); - const GLuint ubo = reinterpret_cast< GLuint >( jointBuffer.GetAPIObject() ); + const GLintptrARB ubo = reinterpret_cast< GLintptrARB >( jointBuffer.GetAPIObject() ); qglBindBufferRange( GL_UNIFORM_BUFFER, 0, ubo, jointBuffer.GetOffset(), jointBuffer.GetNumJoints() * sizeof( idJointMat ) ); - if( ( backEnd.glState.vertexLayout != LAYOUT_DRAW_SHADOW_VERT_SKINNED ) || ( backEnd.glState.currentVertexBuffer != ( GLuint )vertexBuffer->GetAPIObject() ) || !r_useStateCaching.GetBool() ) + if( ( backEnd.glState.vertexLayout != LAYOUT_DRAW_SHADOW_VERT_SKINNED ) || ( backEnd.glState.currentVertexBuffer != ( GLintptrARB )vertexBuffer->GetAPIObject() ) || !r_useStateCaching.GetBool() ) { - qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLuint )vertexBuffer->GetAPIObject() ); - backEnd.glState.currentVertexBuffer = ( GLuint )vertexBuffer->GetAPIObject(); + qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLintptrARB )vertexBuffer->GetAPIObject() ); + backEnd.glState.currentVertexBuffer = ( GLintptrARB )vertexBuffer->GetAPIObject(); qglEnableVertexAttribArrayARB( PC_ATTRIB_INDEX_VERTEX ); qglDisableVertexAttribArrayARB( PC_ATTRIB_INDEX_NORMAL ); @@ -1758,10 +1765,10 @@ static void RB_StencilShadowPass( const drawSurf_t* drawSurfs, const viewLight_t else { - if( ( backEnd.glState.vertexLayout != LAYOUT_DRAW_SHADOW_VERT ) || ( backEnd.glState.currentVertexBuffer != ( GLuint )vertexBuffer->GetAPIObject() ) || !r_useStateCaching.GetBool() ) + if( ( backEnd.glState.vertexLayout != LAYOUT_DRAW_SHADOW_VERT ) || ( backEnd.glState.currentVertexBuffer != ( GLintptrARB )vertexBuffer->GetAPIObject() ) || !r_useStateCaching.GetBool() ) { - qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLuint )vertexBuffer->GetAPIObject() ); - backEnd.glState.currentVertexBuffer = ( GLuint )vertexBuffer->GetAPIObject(); + qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLintptrARB )vertexBuffer->GetAPIObject() ); + backEnd.glState.currentVertexBuffer = ( GLintptrARB )vertexBuffer->GetAPIObject(); qglEnableVertexAttribArrayARB( PC_ATTRIB_INDEX_VERTEX ); qglDisableVertexAttribArrayARB( PC_ATTRIB_INDEX_NORMAL ); @@ -1775,6 +1782,7 @@ static void RB_StencilShadowPass( const drawSurf_t* drawSurfs, const viewLight_t backEnd.glState.vertexLayout = LAYOUT_DRAW_SHADOW_VERT; } } + // RB end renderProgManager.CommitUniforms(); diff --git a/neo/renderer/tr_backend_rendertools.cpp b/neo/renderer/tr_backend_rendertools.cpp index 378b553b..059dce0b 100644 --- a/neo/renderer/tr_backend_rendertools.cpp +++ b/neo/renderer/tr_backend_rendertools.cpp @@ -796,8 +796,10 @@ static void RB_ShowSilhouette() continue; } - qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLuint )vertexBuffer.GetAPIObject() ); - int vertOffset = vertexBuffer.GetOffset(); + // RB: 64 bit fixes, changed GLuint to GLintptrARB + qglBindBufferARB( GL_ARRAY_BUFFER_ARB, ( GLintptrARB )vertexBuffer.GetAPIObject() ); + GLintptrARB vertOffset = vertexBuffer.GetOffset(); + // RB end qglVertexPointer( 3, GL_FLOAT, sizeof( idShadowVert ), ( void* )vertOffset ); qglBegin( GL_LINES ); diff --git a/neo/renderer/tr_frontend_main.cpp b/neo/renderer/tr_frontend_main.cpp index 4db1dff5..0777855d 100644 --- a/neo/renderer/tr_frontend_main.cpp +++ b/neo/renderer/tr_frontend_main.cpp @@ -79,7 +79,11 @@ void R_ToggleSmpFrame() frameData = &smpFrameData[smpFrame % NUM_FRAME_DATA]; // reset the memory allocation - const unsigned int bytesNeededForAlignment = FRAME_ALLOC_ALIGNMENT - ( ( unsigned int )frameData->frameMemory & ( FRAME_ALLOC_ALIGNMENT - 1 ) ); + + // RB: 64 bit fixes, changed unsigned int to uintptr_t + const uintptr_t bytesNeededForAlignment = FRAME_ALLOC_ALIGNMENT - ( ( uintptr_t )frameData->frameMemory & ( FRAME_ALLOC_ALIGNMENT - 1 ) ); + // RB end + frameData->frameMemoryAllocated.SetValue( bytesNeededForAlignment ); frameData->frameMemoryUsed.SetValue( 0 ); diff --git a/neo/renderer/tr_local.h b/neo/renderer/tr_local.h index 4f4dd770..337d40b7 100644 --- a/neo/renderer/tr_local.h +++ b/neo/renderer/tr_local.h @@ -645,9 +645,12 @@ struct glstate_t int faceCulling; vertexLayoutType_t vertexLayout; - unsigned int currentVertexBuffer; - unsigned int currentIndexBuffer; + // RB: 64 bit fixes, changed unsigned int to uintptr_t + uintptr_t currentVertexBuffer; + uintptr_t currentIndexBuffer; + // RB end + float polyOfsScale; float polyOfsBias;