-
Notifications
You must be signed in to change notification settings - Fork 6
Feature/to cache pipeline #111
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
Open
Mee-gu
wants to merge
13
commits into
minggo:metal-support
Choose a base branch
from
Mee-gu:feature/toCachePipeline
base: metal-support
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a8389b3
Merge pull request #1 from minggo/metal-support
Mee-gu 239455b
Merge branch 'metal-support' of github.com:Mee-gu/new-renderer into m…
1ac15dd
【BugFix】release the textures before cleaning the vertor
4afa565
【Feature】use releaseTextures() to remove duplicated code and make the…
3cbbc63
Merge pull request #3 from minggo/metal-support
Mee-gu b2b2297
【Feature】caching for RenderPipeline, test succeed on MacOS
b6b62b4
【Feature】caching for renderPipeline, test succeed on iOS
07c6cca
【Feature】only cached in metal
0bc0c38
【Feature】modify non-standard code
d4f63be
【Feature】use std::hash since the collision probability approaching 1.…
a11fa1e
【Feature】remove unused code
85f0bcc
【Feature】add a new line to separate functions and members
af86fd6
【BugFix】fix return type
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| #include "BlendState.h" | ||
|
|
||
| CC_BACKEND_BEGIN | ||
|
|
||
| BlendState::BlendState(const BlendDescriptor& descriptor) | ||
| : _blendDescriptor(descriptor) | ||
| { | ||
| } | ||
| CC_BACKEND_END |
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,200 @@ | ||
| // | ||
| // StringUtils.cpp | ||
| // Test | ||
| // | ||
| // Created by Cocos on 2018/11/2. | ||
| // Copyright © 2018 cocos. All rights reserved. | ||
| // | ||
|
|
||
| #include "StringUtils.h" | ||
|
|
||
| CC_BACKEND_BEGIN | ||
|
|
||
| std::string StringUtils::TextureFormat2String(const TextureFormat& textureFormat) | ||
| { | ||
| switch (textureFormat) { | ||
| case TextureFormat::R8G8B8A8: | ||
| return "R8G8B8A8"; | ||
| case TextureFormat::R8G8B8: | ||
| return "R8G8B8"; | ||
| case TextureFormat::A8: | ||
| return "A8"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::TextureType2String(const TextureType& textureType) | ||
| { | ||
| switch (textureType) { | ||
| case TextureType::TEXTURE_2D: | ||
| return "TEXTURE_2D"; | ||
| case TextureType::TEXTURE_CUBE: | ||
| return "TEXTURE_CUBE"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::TextureUsage2String(const TextureUsage& textureUsage) | ||
| { | ||
| switch (textureUsage) { | ||
| case TextureUsage::READ: | ||
| return "READ"; | ||
| case TextureUsage::WRITE: | ||
| return "WRITE"; | ||
| case TextureUsage::RENDER_TARGET: | ||
| return "RENDER_TARGET"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::SamplerFilterType2String(const SamplerFilter& filterType) | ||
| { | ||
| switch (filterType) { | ||
| case SamplerFilter::LINEAR: | ||
| return "LINEAR"; | ||
| case SamplerFilter::NEAREST: | ||
| return "NEAREST"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::SamplerAddressMode2String(const SamplerAddressMode& addressMode) | ||
| { | ||
| switch (addressMode) { | ||
| case SamplerAddressMode::REPEAT: | ||
| return "REPEAT"; | ||
| case SamplerAddressMode::MIRROR_REPEAT: | ||
| return "MIRROR_REPEAT"; | ||
| case SamplerAddressMode::CLAMP_TO_EDGE: | ||
| return "CLAMP_TO_EDGE"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::SamplerDescriptor2String(const SamplerDescriptor& descriptor) | ||
| { | ||
| std::string samplerInfo = descriptor.mipmapEnabled ? "mipmapEnable":"mipmapDisable"; | ||
| samplerInfo += SamplerFilterType2String(descriptor.magFilter); | ||
| samplerInfo += SamplerFilterType2String(descriptor.minFilter); | ||
| samplerInfo += SamplerFilterType2String(descriptor.mipmapFilter); | ||
| samplerInfo += SamplerAddressMode2String(descriptor.sAddressMode); | ||
| samplerInfo += SamplerAddressMode2String(descriptor.tAddressMode); | ||
| return samplerInfo; | ||
| } | ||
|
|
||
| std::string StringUtils::StencilOperation2String(const StencilOperation& operation) | ||
| { | ||
| switch (operation) { | ||
| case StencilOperation::KEEP: | ||
| return "KEEP"; | ||
| case StencilOperation::ZERO: | ||
| return "ZERO"; | ||
| case StencilOperation::REPLACE: | ||
| return "REPLACE"; | ||
| case StencilOperation::INVERT: | ||
| return "INVERT"; | ||
| case StencilOperation::INCREMENT_WRAP: | ||
| return "INCREMENT_WRAP"; | ||
| case StencilOperation::DECREMENT_WRAP: | ||
| return "DECREMENT_WRAP"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::CompareFunction2String(const CompareFunction& compareFunction) | ||
| { | ||
| switch (compareFunction) { | ||
| case CompareFunction::NEVER: | ||
| return "NEVER"; | ||
| case CompareFunction::LESS: | ||
| return "LESS"; | ||
| case CompareFunction::LESS_EQUAL: | ||
| return "LESS_EQUAL"; | ||
| case CompareFunction::GREATER: | ||
| return "GREATER"; | ||
| case CompareFunction::GREATER_EQUAL: | ||
| return "GREATER_EQUAL"; | ||
| case CompareFunction::EQUAL: | ||
| return "EQUAL"; | ||
| case CompareFunction::NOT_EQUAL: | ||
| return "NOT_EQUAL"; | ||
| case CompareFunction::ALWAYS: | ||
| return "ALWAYS"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::ColorWriteMask2String(const ColorWriteMask& colorWriteMask) | ||
| { | ||
| switch (colorWriteMask) { | ||
| case ColorWriteMask::NONE: | ||
| return "NONE"; | ||
| case ColorWriteMask::RED: | ||
| return "RED"; | ||
| case ColorWriteMask::GREEN: | ||
| return "GREEN"; | ||
| case ColorWriteMask::BLUE: | ||
| return "BLUE"; | ||
| case ColorWriteMask::ALPHA: | ||
| return "ALPHA"; | ||
| case ColorWriteMask::ALL: | ||
| return "ALL"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::BlendOperation2String(const BlendOperation& blendOperation) | ||
| { | ||
| switch (blendOperation) { | ||
| case BlendOperation::ADD: | ||
| return "ADD"; | ||
| case BlendOperation::SUBTRACT: | ||
| return "SUBTRACT"; | ||
| case BlendOperation::RESERVE_SUBTRACT: | ||
| return "RESERVE_SUBTRACT"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| std::string StringUtils::BlendFactor2String(const BlendFactor& blendFactor) | ||
| { | ||
| switch (blendFactor) { | ||
| case BlendFactor::ZERO: | ||
| return "ZERO"; | ||
| case BlendFactor::ONE: | ||
| return "ONE"; | ||
| case BlendFactor::SRC_COLOR: | ||
| return "SRC_COLOR"; | ||
| case BlendFactor::ONE_MINUS_SRC_COLOR: | ||
| return "ONE_MINUS_SRC_COLOR"; | ||
| case BlendFactor::SRC_ALPHA: | ||
| return "SRC_ALPHA"; | ||
| case BlendFactor::ONE_MINUS_SRC_ALPHA: | ||
| return "ONE_MINUS_SRC_ALPHA"; | ||
| case BlendFactor::DST_COLOR: | ||
| return "DST_COLOR"; | ||
| case BlendFactor::ONE_MINUS_DST_COLOR: | ||
| return "ONE_MINUS_DST_COLOR"; | ||
| case BlendFactor::DST_ALPHA: | ||
| return "DST_ALPHA"; | ||
| case BlendFactor::ONE_MINUS_DST_ALPHA: | ||
| return "ONE_MINUS_DST_ALPHA"; | ||
| case BlendFactor::SRC_ALPHA_SATURATE: | ||
| return "SRC_ALPHA_SATURATE"; | ||
| case BlendFactor::BLEND_CLOLOR: | ||
| return "BLEND_CLOLOR"; | ||
| default: | ||
| return ""; | ||
| } | ||
| } | ||
|
|
||
| CC_BACKEND_END |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // | ||
| // StringUtils.hpp | ||
| // Test | ||
| // | ||
| // Created by Cocos on 2018/11/2. | ||
| // Copyright © 2018 cocos. All rights reserved. | ||
| // | ||
|
|
||
| #ifndef StringUtils_hpp | ||
| #define StringUtils_hpp | ||
|
|
||
| #include <string> | ||
| #include "Types.h" | ||
| CC_BACKEND_BEGIN | ||
|
|
||
| class StringUtils | ||
| { | ||
| public: | ||
| static std::string TextureFormat2String(const TextureFormat& textureFormat); | ||
| static std::string TextureType2String(const TextureType& textureType); | ||
| static std::string TextureUsage2String(const TextureUsage& textureUsage); | ||
| static std::string SamplerFilterType2String(const SamplerFilter& filterType); | ||
| static std::string SamplerAddressMode2String(const SamplerAddressMode& addressMode); | ||
| static std::string SamplerDescriptor2String(const SamplerDescriptor& descriptor); | ||
| static std::string StencilOperation2String(const StencilOperation& operation); | ||
| static std::string CompareFunction2String(const CompareFunction& compareFunction); | ||
| static std::string ColorWriteMask2String(const ColorWriteMask& colorWriteMask); | ||
| static std::string BlendOperation2String(const BlendOperation& blendOperation); | ||
| static std::string BlendFactor2String(const BlendFactor& blendFactor); | ||
| }; | ||
|
|
||
| CC_BACKEND_END | ||
| #endif /* StringUtils_hpp */ |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,7 @@ | ||
| #include "Texture.h" | ||
| #include "StringUtils.h" | ||
|
|
||
| #include <string> | ||
|
|
||
| CC_BACKEND_BEGIN | ||
|
|
||
|
|
||
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.