Subversion Repository Public Repository

Divide-Framework

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

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

Diff revisions: vs.
  @@ -97,32 +97,11 @@
97 97 }
98 98 };
99 99
100 - glVertexArray::VAOMap glVertexArray::_VAOMap;
100 + GLUtil::glVAOCache glVertexArray::_VAOMap;
101 101
102 102 IMPLEMENT_CUSTOM_ALLOCATOR(glVertexArray, 0, 0)
103 103
104 104 void glVertexArray::cleanup() {
105 - clearVaos();
106 - }
107 -
108 - GLuint glVertexArray::getVao(size_t hash) {
109 - VAOMap::const_iterator result = _VAOMap.find(hash);
110 - return result != std::end(_VAOMap) ? result->second : 0;
111 - }
112 -
113 - void glVertexArray::setVao(size_t hash, GLuint id) {
114 - std::pair<VAOMap::const_iterator, bool> result =
115 - hashAlg::emplace(_VAOMap, hash, id);
116 - assert(result.second);
117 - ACKNOWLEDGE_UNUSED(result);
118 - }
119 -
120 - void glVertexArray::clearVaos() {
121 - for (VAOMap::value_type& value : _VAOMap) {
122 - if (value.second != 0) {
123 - GLUtil::_vaoPool.deallocate(value.second);
124 - }
125 - }
126 105 _VAOMap.clear();
127 106 }
128 107
  @@ -140,7 +119,6 @@
140 119 _IBid = 0;
141 120
142 121 _vaoCaches.fill(0);
143 - _vaoHashes.fill(0);
144 122
145 123 _useAttribute.fill(false);
146 124 _attributeOffset.fill(0);
  @@ -155,7 +133,6 @@
155 133 _usage = GL_STATIC_DRAW;
156 134 _prevSize = -1;
157 135 _prevSizeIndices = -1;
158 - _vaoHashes.fill(0);
159 136
160 137 _useAttribute.fill(false);
161 138 _attributeOffset.fill(0);
  @@ -272,19 +249,11 @@
272 249 for (U8 j = 0; j < to_base(VertexAttribute::COUNT); ++j) {
273 250 stageUsage[j] = _useAttribute[j] && stageMask[j];
274 251 }
275 - size_t crtHash = std::hash<AttribFlags>()(stageUsage);
276 - _vaoHashes[i] = crtHash;
277 - _vaoCaches[i] = getVao(crtHash);
278 - if (_vaoCaches[i] == 0) {
279 - // Generate a "Vertex Array Object"
280 - _vaoCaches[i] = GLUtil::_vaoPool.allocate();
281 - assert(_vaoCaches[i] != 0 && Locale::get(_ID("ERROR_VAO_INIT")));
282 - setVao(crtHash, _vaoCaches[i]);
283 - vaoCachesDirty[i] = true;
284 - }
285 252
286 - Console::printfn(" %d : %d (pass: %s)", to_base(RenderStagePass::stage(i)), to_U32(crtHash), (to_base(RenderStagePass::pass(i)) == 0 ? "PrePass" : "FwdPass"));
287 - }
253 + size_t crtHash = 0;
254 + // Dirty on a VAO map cache miss
255 + vaoCachesDirty[i] = !_VAOMap.getVAO(stageUsage, _vaoCaches[i], crtHash);
256 + Console::printfn(" %d : %d (pass: %s)", to_base(RenderStagePass::stage(i)), to_U32(crtHash), (to_base(RenderStagePass::pass(i)) == 0 ? "PrePass" : "FwdPass")); }
288 257
289 258 std::pair<bufferPtr, size_t> bufferData = getMinimalData();
290 259 // If any of the VBO's components changed size, we need to recreate the