From 5d3e2e42234bb7dd14fe1c32ce82973bba1b5724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Wed, 26 Apr 2017 18:37:12 +0200 Subject: [PATCH] Work around a bug with DSA glNamedBufferData() in SVGA3D driver. For some reason a buffer *allocated* with this function caused Mesh::draw() to draw nothing. I gave up on investigating the root cause -- using non-DSA glBufferData() "just works", so in case of this driver the "svga3d-broken-dsa-bufferdata" workaround uses the non-DSA code path. --- src/Magnum/Implementation/BufferState.cpp | 9 +++++++++ src/Magnum/Implementation/driverSpecific.cpp | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Magnum/Implementation/BufferState.cpp b/src/Magnum/Implementation/BufferState.cpp index 1bc239bae..175f531ae 100644 --- a/src/Magnum/Implementation/BufferState.cpp +++ b/src/Magnum/Implementation/BufferState.cpp @@ -178,6 +178,15 @@ BufferState::BufferState(Context& context, std::vector& extensions) } #endif + #ifndef MAGNUM_TARGET_GLES + if(context.isExtensionSupported() && + (context.detectedDriver() & Context::DetectedDriver::Svga3D) && + !context.isDriverWorkaroundDisabled("svga3d-broken-dsa-bufferdata")) + { + dataImplementation = &Buffer::dataImplementationDefault; + } + #endif + #ifdef MAGNUM_TARGET_GLES static_cast(context); static_cast(extensions); diff --git a/src/Magnum/Implementation/driverSpecific.cpp b/src/Magnum/Implementation/driverSpecific.cpp index a27a1bc64..e2ea72fd0 100644 --- a/src/Magnum/Implementation/driverSpecific.cpp +++ b/src/Magnum/Implementation/driverSpecific.cpp @@ -88,7 +88,14 @@ namespace { /* NaCl advertises some additional extensions but the GLESv2 library does not have any entrypoints for them and there is no GetProcAddress equivalent, thus marking them as unsupported. */ - "nacl-missing-extension-entrypoints" + "nacl-missing-extension-entrypoints", + #endif + + #ifndef MAGNUM_TARGET_GLES + /* SVGA3D (VMware host GL driver) glDrawArrays() draws nothing when the + vertex buffer memory is initialized using glNamedBufferData() from + ARB_DSA. Using the non-DSA glBufferData() works. */ + "svga3d-broken-dsa-bufferdata", #endif }; }