message: minor reorganizing of the command loop
diff: @@ -122,7 +122,7 @@ void RenderPass::recordDriverCommands(
  if (!commands.empty()) {
  Driver::PipelineState pipeline;
  Handle<HwUniformBuffer> uboHandle = scene.getRenderableUBO();
  - FMaterialInstance const* UTILS_RESTRICT previousMi = nullptr;
  + FMaterialInstance const* UTILS_RESTRICT mi = nullptr;
  FMaterial const* UTILS_RESTRICT ma = nullptr;
  Command const* UTILS_RESTRICT c;
  for (c = commands.cbegin(); c->key != -1LLU; ++c) {
  @@ -131,24 +131,22 @@ void RenderPass::recordDriverCommands(
  */
  // per-renderable uniform
  - PrimitiveInfo const& UTILS_RESTRICT info = c->primitive;
  - size_t offset = info.index * sizeof(PerRenderableUib);
  - driver.bindUniformBufferRange(BindingPoints::PER_RENDERABLE, uboHandle, offset, sizeof(PerRenderableUib));
  - if (info.perRenderableBones) {
  - driver.bindUniformBuffer(BindingPoints::PER_RENDERABLE_BONES, info.perRenderableBones);
  - }
  -
  - FMaterialInstance const* const UTILS_RESTRICT mi = info.mi;
  - if (UTILS_UNLIKELY(mi != previousMi)) {
  + const PrimitiveInfo info = c->primitive;
  + pipeline.rasterState = info.rasterState;
  + if (UTILS_UNLIKELY(mi != info.mi)) {
  // this is always taken the first time
  - previousMi = mi;
  - mi->use(driver);
  + mi = info.mi;
  + pipeline.polygonOffset = mi->getPolygonOffset();
  ma = mi->getMaterial();
  + mi->use(driver);
  }
  pipeline.program = ma->getProgram(info.materialVariant.key);
  - pipeline.rasterState = info.rasterState;
  - pipeline.polygonOffset = mi->getPolygonOffset();
  + size_t offset = info.index * sizeof(PerRenderableUib);
  + if (info.perRenderableBones) {
  + driver.bindUniformBuffer(BindingPoints::PER_RENDERABLE_BONES, info.perRenderableBones);
  + }
  + driver.bindUniformBufferRange(BindingPoints::PER_RENDERABLE, uboHandle, offset, sizeof(PerRenderableUib));
  driver.draw(pipeline, info.primitiveHandle);
  }
  