mirror of https://github.com/axmolengine/axmol.git
Merge pull request #5097 from ricardoquesada/render_vbo_fixes
Renderer: When not using VAOs, call...
This commit is contained in:
commit
218d9ceabc
|
@ -17,6 +17,7 @@ cocos2d-x-3.0final ?.? ?
|
|||
[FIX] Particles: Crash was triggered if there is not `textureFileName`section in particle plist file.
|
||||
[FIX] Renderer: QuadCommand::init() does not copy the Quads, it only store a reference making the code faster
|
||||
[FIX] Renderer: Performance improved in Sprite and SpriteBatchNode (and subclasses) sprites in about 20%
|
||||
[FIX] Renderer: When note using VAO, call glBufferData() instead of glBufferSubData().
|
||||
[FIX] Sprite: removed _hasChildren optimization. It uses !_children.empty() now which is super fast as well
|
||||
[FIX] Tests: TestCpp works with CMake on Windows.
|
||||
[FIX] Tests: Sprites Performance Test has 4 new tests
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
//TODO use material to decide if it is translucent
|
||||
inline bool isTranslucent() const { return true; }
|
||||
|
||||
inline int32_t getMaterialID() const { return _materialID; }
|
||||
inline uint32_t getMaterialID() const { return _materialID; }
|
||||
|
||||
inline GLuint getTextureID() const { return _textureID; }
|
||||
|
||||
|
@ -71,7 +71,7 @@ public:
|
|||
inline const kmMat4& getModelView() const { return _mv; }
|
||||
|
||||
protected:
|
||||
int32_t _materialID;
|
||||
uint32_t _materialID;
|
||||
|
||||
//Key Data
|
||||
int _viewport; /// Which view port it belongs to
|
||||
|
|
|
@ -249,7 +249,7 @@ void Renderer::render()
|
|||
//Batch quads
|
||||
if(_numQuads + cmdQuadCount > VBO_SIZE)
|
||||
{
|
||||
CCASSERT(cmdQuadCount < VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command");
|
||||
CCASSERT(cmdQuadCount>=0 && cmdQuadCount<VBO_SIZE, "VBO is not big enough for quad data, please break the quad data down or use customized render command");
|
||||
|
||||
//Draw batched quads if VBO is full
|
||||
_lastCommand --;
|
||||
|
@ -381,7 +381,7 @@ void Renderer::drawBatchedQuads()
|
|||
#define kQuadSize sizeof(_quads[0].bl)
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
|
||||
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(_quads[0]) * _numQuads , _quads);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * _numQuads , _quads, GL_DYNAMIC_DRAW);
|
||||
|
||||
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);
|
||||
|
||||
|
@ -398,7 +398,7 @@ void Renderer::drawBatchedQuads()
|
|||
}
|
||||
|
||||
//Start drawing verties in batch
|
||||
for(size_t i = _firstCommand; i <= _lastCommand; i++)
|
||||
for(ssize_t i = _firstCommand; i <= _lastCommand; i++)
|
||||
{
|
||||
RenderCommand* command = _renderGroups[_renderStack.top().renderQueueID][i];
|
||||
if (command->getType() == RenderCommand::Type::QUAD_COMMAND)
|
||||
|
|
|
@ -42,7 +42,7 @@ typedef std::vector<RenderCommand*> RenderQueue;
|
|||
struct RenderStackElement
|
||||
{
|
||||
int renderQueueID;
|
||||
size_t currentIndex;
|
||||
ssize_t currentIndex;
|
||||
};
|
||||
|
||||
class Renderer
|
||||
|
@ -86,10 +86,10 @@ protected:
|
|||
std::stack<RenderStackElement> _renderStack;
|
||||
std::vector<RenderQueue> _renderGroups;
|
||||
|
||||
int _lastMaterialID;
|
||||
uint32_t _lastMaterialID;
|
||||
|
||||
size_t _firstCommand;
|
||||
size_t _lastCommand;
|
||||
ssize_t _firstCommand;
|
||||
ssize_t _lastCommand;
|
||||
|
||||
V3F_C4B_T2F_Quad _quads[VBO_SIZE];
|
||||
GLushort _indices[6 * VBO_SIZE];
|
||||
|
|
|
@ -391,7 +391,7 @@ void Console::commandTextures(int fd, const char *command)
|
|||
{
|
||||
Scheduler *sched = Director::getInstance()->getScheduler();
|
||||
sched->performFunctionInCocosThread( [&](){
|
||||
mydprintf(fd, "%s", TextureCache::getInstance()->getCachedTextureInfo().c_str());
|
||||
mydprintf(fd, "%s", Director::getInstance()->getTextureCache()->getCachedTextureInfo().c_str());
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue