message: Improve buffer code
diff: @@ -29,9 +29,13 @@ CDraw3DLine::CDraw3DLine(IVideoDriver* _driver)
  callBack->drop();
  m_meshBuffer->setPrimitiveType(EPT_LINES);
  - m_meshBuffer->setMeshDataAndFormat(m_desc);
  m_meshBuffer->setIndexType(EIT_UNKNOWN);
  m_meshBuffer->setIndexCount(2);
  +
  + auto buff = m_driver->getDefaultUpStreamingBuffer()->getBuffer();
  + m_desc->mapVertexAttrBuffer(buff,EVAI_ATTR0,ECPA_THREE,ECT_FLOAT,sizeof(S3DLineVertex), offsetof(S3DLineVertex, Position[0]));
  + m_desc->mapVertexAttrBuffer(buff,EVAI_ATTR1,ECPA_FOUR,ECT_FLOAT,sizeof(S3DLineVertex), offsetof(S3DLineVertex, Color[0]));
  + m_meshBuffer->setMeshDataAndFormat(m_desc);
  m_desc->drop();
  }
  @@ -48,26 +52,23 @@ void CDraw3DLine::draw(
  auto upStreamBuff = m_driver->getDefaultUpStreamingBuffer();
  void* lineData[1] = { vertices };
  - upStreamBuff->multi_place(2u, (const void* const*)lineData, (uint32_t*)&m_offsets,(uint32_t*)&sizes,(uint32_t*)&alignments);
  + upStreamBuff->multi_place(1u, (const void* const*)lineData, (uint32_t*)&m_offsets,(uint32_t*)&sizes,(uint32_t*)&alignments);
  if (upStreamBuff->needsManualFlushOrInvalidate())
  {
  auto upStreamMem = upStreamBuff->getBuffer()->getBoundMemory();
  m_driver->flushMappedMemoryRanges({{ upStreamMem,m_offsets[0],sizes[0] }});
  }
  - auto buff = upStreamBuff->getBuffer();
  - m_desc->mapVertexAttrBuffer(buff,EVAI_ATTR0,ECPA_THREE,ECT_FLOAT,sizeof(S3DLineVertex), offsetof(S3DLineVertex, Position[0]) + m_offsets[0]);
  - m_desc->mapVertexAttrBuffer(buff,EVAI_ATTR1,ECPA_FOUR,ECT_FLOAT,sizeof(S3DLineVertex), offsetof(S3DLineVertex, Color[0]) + m_offsets[0]);
  + m_meshBuffer->setBaseVertex(m_offsets[0]/sizeof(S3DLineVertex));
  m_driver->setTransform(E4X3TS_WORLD, core::matrix4x3());
  m_driver->setMaterial(m_material);
  m_driver->drawMeshBuffer(m_meshBuffer);
  - upStreamBuff->multi_free(2u,(uint32_t*)&m_offsets,(uint32_t*)&sizes,m_driver->placeFence());
  + upStreamBuff->multi_free(1u,(uint32_t*)&m_offsets,(uint32_t*)&sizes,m_driver->placeFence());
  }
  CDraw3DLine::~CDraw3DLine()
  {
  - m_desc->drop();
  m_meshBuffer->drop();
  }
  