diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 9435ead6..3c129fab 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -1376,9 +1376,9 @@ again: RendererType::Enum first = RendererType::Direct3D9; RendererType::Enum second = RendererType::Direct3D11; - if (windowsVersionIs(Condition::GreaterEqual, 0x0603) ) + if (windowsVersionIs(Condition::GreaterEqual, 0x0602) ) { - first = RendererType::Direct3D11 /* Direct3D12 */; + first = RendererType::Enum(RendererType::Direct3D11+1) /* Direct3D12 */; second = RendererType::Direct3D11; if (!s_rendererCreator[second].supported) second = RendererType::Direct3D9; diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 56ed7399..dde20bc7 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -1092,14 +1092,17 @@ namespace bgfx void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE { - ID3D11DeviceContext* deviceCtx = m_deviceCtx; + const uint32_t numVertices = _numIndices*4/6; + if (0 < numVertices) + { + ID3D11DeviceContext* deviceCtx = m_deviceCtx; - uint32_t numVertices = _numIndices*4/6; - m_indexBuffers [_blitter.m_ib->handle.idx].update(0, _numIndices*2, _blitter.m_ib->data); - m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data, true); + m_indexBuffers [_blitter.m_ib->handle.idx].update(0, _numIndices*2, _blitter.m_ib->data); + m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data, true); - deviceCtx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); - deviceCtx->DrawIndexed(_numIndices, 0, 0); + deviceCtx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); + deviceCtx->DrawIndexed(_numIndices, 0, 0); + } } void preReset() diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index b6d5fa73..a9043284 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -924,17 +924,20 @@ namespace bgfx void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE { - uint32_t numVertices = _numIndices*4/6; - m_indexBuffers [_blitter.m_ib->handle.idx].update(0, _numIndices*2, _blitter.m_ib->data, true); - m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data, true); + const uint32_t numVertices = _numIndices*4/6; + if (0 < numVertices) + { + m_indexBuffers[_blitter.m_ib->handle.idx].update(0, _numIndices * 2, _blitter.m_ib->data, true); + m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data, true); - DX_CHECK(m_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST - , 0 - , 0 - , numVertices - , 0 - , _numIndices/3 - ) ); + DX_CHECK(m_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST + , 0 + , 0 + , numVertices + , 0 + , _numIndices / 3 + ) ); + } } void updateMsaa() diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index e20728b6..586a41f8 100644 --- a/src/renderer_d3d9.h +++ b/src/renderer_d3d9.h @@ -145,7 +145,7 @@ namespace bgfx memcpy(buffer, _data, _size); - m_ptr->Unlock(); + DX_CHECK(m_ptr->Unlock() ); } void destroy() @@ -185,7 +185,7 @@ namespace bgfx memcpy(buffer, _data, _size); - m_ptr->Unlock(); + DX_CHECK(m_ptr->Unlock() ); } void destroy() diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 10c3df5a..7aa0d24d 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1703,24 +1703,27 @@ namespace bgfx void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE { - uint32_t numVertices = _numIndices*4/6; - m_indexBuffers[_blitter.m_ib->handle.idx].update(0, _numIndices*2, _blitter.m_ib->data); - m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data); + const uint32_t numVertices = _numIndices*4/6; + if (0 < numVertices) + { + m_indexBuffers[_blitter.m_ib->handle.idx].update(0, _numIndices*2, _blitter.m_ib->data); + m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data); - VertexBufferGL& vb = m_vertexBuffers[_blitter.m_vb->handle.idx]; - GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) ); + VertexBufferGL& vb = m_vertexBuffers[_blitter.m_vb->handle.idx]; + GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) ); - IndexBufferGL& ib = m_indexBuffers[_blitter.m_ib->handle.idx]; - GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) ); + IndexBufferGL& ib = m_indexBuffers[_blitter.m_ib->handle.idx]; + GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) ); - ProgramGL& program = m_program[_blitter.m_program.idx]; - program.bindAttributes(_blitter.m_decl, 0); + ProgramGL& program = m_program[_blitter.m_program.idx]; + program.bindAttributes(_blitter.m_decl, 0); - GL_CHECK(glDrawElements(GL_TRIANGLES - , _numIndices - , GL_UNSIGNED_SHORT - , (void*)0 - ) ); + GL_CHECK(glDrawElements(GL_TRIANGLES + , _numIndices + , GL_UNSIGNED_SHORT + , (void*)0 + ) ); + } } void updateResolution(const Resolution& _resolution)