Open
Conversation
minggo
reviewed
Jan 3, 2019
src/backend/BindGroup.h
Outdated
| private: | ||
| std::unordered_map<std::string, UniformInfo> _uniformInfos; | ||
| std::unordered_map<int, UniformInfo> _vertexUniformInfos; | ||
| std::unordered_map<int, UniformInfo> _fragUniformInfos; |
Owner
There was a problem hiding this comment.
Can use std::vector instead, and reserve 3/5 elements at start.
Contributor
Author
|
update review |
minggo
reviewed
Jan 4, 2019
src/backend/Program.cpp
Outdated
| { | ||
| CC_SAFE_RELEASE(_vertexShader); | ||
| CC_SAFE_RELEASE(_fragmentShader); | ||
| _textureInfos.clear(); |
minggo
reviewed
Jan 4, 2019
src/backend/metal/ProgramMTL.h
Outdated
| { | ||
| public: | ||
| ProgramMTL(ShaderModule* vs, ShaderModule* fs); | ||
| virtual ~ProgramMTL(); |
minggo
reviewed
Jan 4, 2019
src/backend/metal/DeviceMTL.mm
Outdated
|
|
||
| Program* DeviceMTL::createProgram(ShaderModule* vs, ShaderModule* fs) | ||
| { | ||
| return new (std::nothrow) ProgramMTL(vs, fs); |
Owner
There was a problem hiding this comment.
create function should be auto released.
minggo
reviewed
Jan 4, 2019
src/backend/Program.h
Outdated
| std::vector<Texture*> textures; | ||
| }; | ||
|
|
||
| virtual int getUniformLocation(const std::string& uniform) = 0; |
Owner
There was a problem hiding this comment.
and i think should use getVertexUniformLoacation and getFragmentUniformLoacation instead
minggo
reviewed
Jan 4, 2019
src/backend/metal/ProgramMTL.h
Outdated
| virtual void setVertexUniform(int location, void* data, uint32_t size) override; | ||
| virtual void setFragmentUniform(int location, void* data, uint32_t size) override; | ||
|
|
||
| void fillUniformBuffer(uint8_t* buffer, uint32_t offset, void* uniformData, uint32_t uniformSize) const; |
Contributor
Author
|
update review |
minggo
reviewed
Jan 7, 2019
src/backend/RenderPipeline.h
Outdated
| RenderPipeline(Program* program); | ||
| virtual ~RenderPipeline(); | ||
|
|
||
| virtual Program* getProgram() { return _program; } |
minggo
reviewed
Jan 7, 2019
| { | ||
| public: | ||
| RenderPipeline(Program* program); | ||
| virtual ~RenderPipeline(); |
minggo
reviewed
Jan 7, 2019
src/backend/opengl/ProgramGL.cpp
Outdated
| _vertexTextureInfos.reserve(_maxTextureLocation); | ||
| _vertexTextureInfos.resize(_maxTextureLocation); | ||
| _fragTextureInfos.reserve(_maxTextureLocation); | ||
| _fragTextureInfos.resize(_maxTextureLocation); |
Owner
There was a problem hiding this comment.
don't have to use reserve and resize at the same time
minggo
reviewed
Jan 7, 2019
src/backend/opengl/ProgramGL.cpp
Outdated
| CC_SAFE_RETAIN(_vertexShaderModule); | ||
| CC_SAFE_RETAIN(_fragmentShaderModule); | ||
| return; | ||
| } |
minggo
reviewed
Jan 7, 2019
src/backend/opengl/ProgramGL.cpp
Outdated
| return; | ||
|
|
||
| glUseProgram(_program); | ||
| for(const auto& uniforn : _uniformInfos) |
Owner
There was a problem hiding this comment.
can optimize it, don't have to loop every time
Contributor
Author
|
add ProgramCache |
Contributor
Author
|
update ProgramCache |
minggo
reviewed
Jan 8, 2019
| dt = std::chrono::duration_cast<std::chrono::microseconds>(now - prevTime).count() / 1000000.f; | ||
| } | ||
|
|
||
| cocos2d::backend::ProgramCache::destroyInstance(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
update uniform location