+
+ bool scissorEnabled = false;
+
+ auto scissorTestList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR_TEST);
+ if(!scissorTestList.empty())
+ {
+ if(scissorTestList[0]->data.scissorTest.enable)
+ {
+ mGl.Enable(GL_SCISSOR_TEST);
+ scissorEnabled = true;
+ }
+ else
+ {
+ mGl.Disable(GL_SCISSOR_TEST);
+ }
+ }
+
+ auto scissorList = commandBuffer->GetCommandsByType(0 | CommandType::SET_SCISSOR);
+ if(!scissorList.empty() && scissorEnabled)
+ {
+ auto& rect = scissorList[0]->data.scissor.region;
+ mGl.Scissor(rect.x, rect.y, rect.width, rect.height);
+ }
+
+ auto viewportList = commandBuffer->GetCommandsByType(0 | CommandType::SET_VIEWPORT);
+ if(!viewportList.empty())
+ {
+ mGl.Viewport(viewportList[0]->data.viewport.region.x, viewportList[0]->data.viewport.region.y, viewportList[0]->data.viewport.region.width, viewportList[0]->data.viewport.region.height);
+ }
+
+ // ignore viewport enable
+