Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 556 vs 557 for /trunk/Source Code/Platform/Video/OpenGL/Buffers/VertexBuffer/glVertexArray.cpp

Diff revisions: vs.
  @@ -228,7 +228,7 @@
228 228 for (U8 j = 0; j < to_uint(VertexAttribute::COUNT); ++j) {
229 229 stageUsage[j] = _useAttribute[j] && stageMask[j];
230 230 }
231 - U32 crtHash = to_uint(std::hash<AttribFlags>()(stageUsage));
231 + U32 crtHash = std::hash<AttribFlags>()(stageUsage);
232 232 _vaoHashes[i] = crtHash;
233 233 _vaoCaches[i] = getVao(crtHash);
234 234 if (_vaoCaches[i] == 0) {
  @@ -239,7 +239,7 @@
239 239 vaoCachesDirty[i] = true;
240 240 }
241 241
242 - Console::printfn(" %d : %d", i, crtHash);
242 + Console::printfn(" %d : %d", i, to_uint(crtHash));
243 243 }
244 244
245 245
  @@ -275,7 +275,7 @@
275 275 size,
276 276 countRequirement * GLUtil::VBO::MAX_VBO_CHUNK_SIZE_BYTES,
277 277 GLUtil::getVBOMemUsage(_VBHandle._id),
278 - GLUtil::g_globalVBOs.size());
278 + GLUtil::getVBOCount());
279 279
280 280 _effectiveEntryOffset = _VBHandle._offset * GLUtil::VBO::MAX_VBO_CHUNK_SIZE_BYTES;
281 281 }
  @@ -285,8 +285,7 @@
285 285
286 286 _smallData.clear();
287 287
288 - // Check if we need to update the IBO (will be true for the first Refresh()
289 - // call)
288 + // Check if we need to update the IBO (will be true for the first Refresh() call)
290 289 if (indicesChanged) {
291 290 bufferPtr data = usesLargeIndices()
292 291 ? static_cast<bufferPtr>(_hardwareIndicesL.data())
  @@ -349,56 +348,16 @@
349 348 return;
350 349 }
351 350 // Make sure the buffer is current
352 - if (!setActive()) {
353 - return;
354 - }
355 -
356 - static const size_t cmdSize = sizeof(IndirectDrawCommand);
357 -
358 - bufferPtr offset = (bufferPtr)(cmd.baseInstance * cmdSize);
359 - U16 drawCount = command.drawCount();
360 - GLenum mode = GLUtil::glPrimitiveTypeTable[to_uint(command.primitiveType())];
361 -
362 - if (useCmdBuffer) {
363 - if (command.renderGeometry()) {
364 - glMultiDrawElementsIndirect(mode, _formatInternal, offset, drawCount, cmdSize);
365 - }
366 - if (command.renderWireframe()) {
367 - glMultiDrawElementsIndirect(GL_LINE_LOOP, _formatInternal, offset, drawCount, cmdSize);
368 - }
369 - } else {
370 - if (drawCount > 1) {
371 - vectorImpl<GLsizei> count(drawCount, cmd.indexCount);
372 - vectorImpl<U32> indices(drawCount, cmd.firstIndex);
373 - if (command.renderGeometry()) {
374 - glMultiDrawElements(mode, count.data(), _formatInternal, (bufferPtr*)indices.data(), drawCount);
375 - }
376 - if (command.renderWireframe()) {
377 - glMultiDrawElements(GL_LINE_LOOP, count.data(), _formatInternal, (bufferPtr*)indices.data(), drawCount);
378 - }
379 - } else {
380 - if (command.renderGeometry()) {
381 - glDrawElements(mode, cmd.indexCount, _formatInternal, bufferOffset(cmd.firstIndex));
382 - }
383 - if (command.renderWireframe()) {
384 - glDrawElements(GL_LINE_LOOP, cmd.indexCount, _formatInternal, bufferOffset(cmd.firstIndex));
385 - }
386 - }
387 - }
388 - }
389 -
390 - /// Set the current buffer as active
391 - bool glVertexArray::setActive() {
392 351 // Make sure we have valid data (buffer creation is deferred to the first activate call)
393 352 if (_IBid == 0) {
394 353 if (!createInternal()) {
395 - return false;
354 + return;
396 355 }
397 356 }
398 357 // Check if we have a refresh request queued up
399 358 if (_refreshQueued) {
400 359 if (!refresh()) {
401 - return false;
360 + return;
402 361 }
403 362 }
404 363
  @@ -411,9 +370,8 @@
411 370 }
412 371
413 372 // Bind the the vertex buffer and index buffer
414 - GL_API::setActiveBuffer(GL_ELEMENT_ARRAY_BUFFER, _IBid);
415 373 setIfDifferentBindRange(_VBHandle._id, _VBHandle._offset * GLUtil::VBO::MAX_VBO_CHUNK_SIZE_BYTES, _effectiveEntrySize);
416 - return true;
374 + GLUtil::submitRenderCommand(command, useCmdBuffer, _formatInternal, _IBid);
417 375 }
418 376
419 377 /// Activate and set all of the required vertex attributes.