//----------------------------------------------------------------------------- float Matrix22::Element ( int row, int coloumn ) const { DIA_ASSERT(row >= 0 && row < kNumRows, "Oubound the array"); DIA_ASSERT(coloumn >= 0 && coloumn < kNumColoumns, "Oubound the array"); return mElement[LinearIndex(row, coloumn)]; }
//----------------------------------------------------------------------------- void Matrix22::SetElement ( int row, int coloumn, float value ) { DIA_ASSERT(row >= 0 && row < kNumRows, "Oubound the array"); DIA_ASSERT(coloumn >= 0 && coloumn < kNumColoumns, "Oubound the array"); mElement[LinearIndex(row, coloumn)] = value; }
void Renderer::processPrimitiveVertices(int unit, unsigned int start, unsigned int triangleCount, unsigned int loop, int thread) { Triangle *triangle = triangleBatch[unit]; int primitiveDrawCall = primitiveProgress[unit].drawCall; DrawCall *draw = drawList[primitiveDrawCall & DRAW_COUNT_BITS]; DrawData *data = draw->data; VertexTask *task = vertexTask[thread]; const void *indices = data->indices; VertexProcessor::RoutinePointer vertexRoutine = draw->vertexPointer; if(task->vertexCache.drawCall != primitiveDrawCall) { task->vertexCache.clear(); task->vertexCache.drawCall = primitiveDrawCall; } unsigned int batch[128][3]; // FIXME: Adjust to dynamic batch size VkPrimitiveTopology topology = static_cast<VkPrimitiveTopology>(static_cast<int>(draw->topology)); if(!indices) { struct LinearIndex { unsigned int operator[](unsigned int i) { return i; } }; if(!setBatchIndices(batch, topology, LinearIndex(), start, triangleCount)) { return; } } else { switch(draw->indexType) { case VK_INDEX_TYPE_UINT16: if(!setBatchIndices(batch, topology, static_cast<const uint16_t*>(indices), start, triangleCount)) { return; } break; case VK_INDEX_TYPE_UINT32: if(!setBatchIndices(batch, topology, static_cast<const uint32_t*>(indices), start, triangleCount)) { return; } break; break; default: ASSERT(false); return; } } task->primitiveStart = start; task->vertexCount = triangleCount * 3; vertexRoutine(&triangle->v0, (unsigned int*)&batch, task, data); }