-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/to cache pipeline #111
base: metal-support
Are you sure you want to change the base?
Conversation
get latest code
…etal-support * 'metal-support' of github.com:Mee-gu/new-renderer: use MTLPixelFormatDepth32Float_Stencil8 instead since it has better compatibility use MTLPixelFormatDepth32Float_Stencil8 instead since it has better compatibility 【Feature】add test case (minggo#109)
… code looks clean
Feature/to cache pipeline (minggo#110)
@@ -102,4 +178,37 @@ | |||
return new (std::nothrow) RenderPipelineMTL(_mtlDevice, descriptor); | |||
} | |||
|
|||
size_t DeviceMTL::findRenderPipelineInCache(const RenderPipelineDescriptor& descriptor) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just return RenderPipeline*
?
…0/std::numeric_limits<size_t>::max().
@@ -248,7 +247,7 @@ MTLVertexFormat toMTLVertexFormat(VertexFormat vertexFormat) | |||
info += StringUtils::BlendFactor2String(blendDescriptor.destinationAlphaBlendFactor); | |||
} | |||
|
|||
return HashAlgorithm::PJWHash(info.c_str(), info.length()); | |||
return std::hash<std::string>{}(info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use std::hash since the collision probability approaching 1.0/std::numeric_limits<size_t>::max().
src/backend/Device.h
Outdated
// Create a auto released depth stencil state. | ||
virtual DepthStencilState* createDepthStencilState(const DepthStencilDescriptor& descriptor) = 0; | ||
// Create a auto released blend state. | ||
virtual BlendState* createBlendState(const BlendDescriptor& descriptor) = 0; | ||
// Create a render pipeline, not auto released. | ||
virtual RenderPipeline* newRenderPipeline(const RenderPipelineDescriptor& descriptor) = 0; | ||
|
||
// Cache RenderPipeline for reuse | ||
// virtual RenderPipeline* cacheRenderPipeline(const RenderPipelineDescriptor& descriptor) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove unneeded codes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
Cache ShaderModule, RenderPass and RenderPipeline for reuse