workaround for base vertex. damn old nvidia driver

This commit is contained in:
degasus 2013-02-26 23:15:55 +01:00
parent 025f8d342f
commit a650ae8c7b
4 changed files with 42 additions and 28 deletions

View File

@ -167,6 +167,7 @@ struct VideoConfig
bool bSupportsGLSLCache;
bool bSupportsGLPinnedMemory;
bool bSupportsGLSync;
bool bSupportsGLBaseVertex;
} backend_info;
// Utility

View File

@ -239,13 +239,6 @@ Renderer::Renderer()
bSuccess = false;
}
if (!GLEW_ARB_draw_elements_base_vertex)
{
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need GL_ARB_draw_elements_base_vertex.\n"
"GPU: Does your video card support OpenGL 3.2?");
bSuccess = false;
}
if (!GLEW_ARB_sampler_objects)
{
ERROR_LOG(VIDEO, "GPU: OGL ERROR: Need GL_ARB_sampler_objects.");
@ -255,25 +248,25 @@ Renderer::Renderer()
s_bHaveCoverageMSAA = GLEW_NV_framebuffer_multisample_coverage;
g_Config.backend_info.bSupportsDualSourceBlend = GLEW_ARB_blend_func_extended;
g_Config.backend_info.bSupportsGLSLUBO = GLEW_ARB_uniform_buffer_object;
g_Config.backend_info.bSupportsGLPinnedMemory = GLEW_AMD_pinned_memory;
g_Config.backend_info.bSupportsGLSync = GLEW_ARB_sync;
g_Config.backend_info.bSupportsGLSLCache = GLEW_ARB_get_program_binary;
g_Config.backend_info.bSupportsGLBaseVertex = GLEW_ARB_draw_elements_base_vertex;
UpdateActiveConfig();
OSD::AddMessage(StringFromFormat("Supports: %s%s%s%s- Missing: %s%s%s%s",
OSD::AddMessage(StringFromFormat("Supports: %s%s%s%s%s- Missing: %s%s%s%s%s",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "DualSourceBlend " : "",
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "UniformBuffer " : "",
g_ActiveConfig.backend_info.bSupportsGLPinnedMemory ? "PinnedMemory " : "",
g_ActiveConfig.backend_info.bSupportsGLSLCache ? "ShaderCache " : "",
g_ActiveConfig.backend_info.bSupportsGLBaseVertex ? "BaseVertex " : "",
g_ActiveConfig.backend_info.bSupportsDualSourceBlend ? "" : "DualSourceBlend ",
g_ActiveConfig.backend_info.bSupportsGLSLUBO ? "" : "UniformBuffer ",
g_ActiveConfig.backend_info.bSupportsGLPinnedMemory ? "" : "PinnedMemory ",
g_ActiveConfig.backend_info.bSupportsGLSLCache ? "" : "ShaderCache "
g_ActiveConfig.backend_info.bSupportsGLSLCache ? "" : "ShaderCache ",
g_ActiveConfig.backend_info.bSupportsGLBaseVertex ? "" : "BaseVertex "
).c_str(), 5000);
s_LastMultisampleMode = g_ActiveConfig.iMultisampleMode;

View File

@ -39,7 +39,9 @@ StreamBuffer::StreamBuffer(u32 type, size_t size, StreamType uploadType)
if(m_uploadtype == STREAM_DETECT)
{
if(g_Config.backend_info.bSupportsGLSync && g_Config.backend_info.bSupportsGLPinnedMemory)
if(!g_Config.backend_info.bSupportsGLBaseVertex)
m_uploadtype = BUFFERSUBDATA;
else if(g_Config.backend_info.bSupportsGLSync && g_Config.backend_info.bSupportsGLPinnedMemory)
m_uploadtype = PINNED_MEMORY;
else if(g_Config.backend_info.bSupportsGLSync && g_Config.bHackedBufferUpload)
m_uploadtype = MAP_AND_RISK;

View File

@ -122,20 +122,38 @@ void VertexManager::Draw(u32 stride)
u32 triangle_index_size = IndexGenerator::GetTriangleindexLen();
u32 line_index_size = IndexGenerator::GetLineindexLen();
u32 point_index_size = IndexGenerator::GetPointindexLen();
if (triangle_index_size > 0)
{
glDrawElementsBaseVertex(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (line_index_size > 0)
{
glDrawElementsBaseVertex(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[1], s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (point_index_size > 0)
{
glDrawElementsBaseVertex(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2], s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
if(g_Config.backend_info.bSupportsGLBaseVertex) {
if (triangle_index_size > 0)
{
glDrawElementsBaseVertex(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0], s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (line_index_size > 0)
{
glDrawElementsBaseVertex(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[1], s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (point_index_size > 0)
{
glDrawElementsBaseVertex(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2], s_baseVertex);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
} else {
if (triangle_index_size > 0)
{
glDrawElements(GL_TRIANGLES, triangle_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[0]);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (line_index_size > 0)
{
glDrawElements(GL_LINES, line_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[1]);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
if (point_index_size > 0)
{
glDrawElements(GL_POINTS, point_index_size, GL_UNSIGNED_SHORT, (u8*)NULL+s_offset[2]);
INCSTAT(stats.thisFrame.numIndexedDrawCalls);
}
}
}