added kShaderType_PositionColor_noMVP_GrayScale for WP8 to support UIScale9Sprite

This commit is contained in:
Dale Stammen 2015-01-16 15:02:05 -08:00
parent 5988cb520d
commit 86567afa5f
3 changed files with 25 additions and 1 deletions

View File

@ -52,6 +52,9 @@ const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_ALPHA_TEST_NO_MV = "ShaderPo
const char* GLProgram::SHADER_NAME_POSITION_COLOR = "ShaderPositionColor";
const char* GLProgram::SHADER_NAME_POSITION_COLOR_POINTSIZE = "ShaderPositionColorPointsize";
const char* GLProgram::SHADER_NAME_POSITION_COLOR_NO_MVP = "ShaderPositionColor_noMVP";
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || defined(WP8_SHADER_COMPILER)
const char* GLProgram::SHADER_NAME_POSITION_COLOR_NO_MVP_GRAYSCALE = "ShaderPositionColor_noMVP_GrayScale";
#endif
const char* GLProgram::SHADER_NAME_POSITION_TEXTURE = "ShaderPositionTexture";
const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_U_COLOR = "ShaderPositionTexture_uColor";
const char* GLProgram::SHADER_NAME_POSITION_TEXTURE_A8_COLOR = "ShaderPositionTextureA8Color";

View File

@ -122,6 +122,9 @@ public:
static const char* SHADER_NAME_POSITION_COLOR;
static const char* SHADER_NAME_POSITION_COLOR_POINTSIZE;
static const char* SHADER_NAME_POSITION_COLOR_NO_MVP;
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || defined(WP8_SHADER_COMPILER)
static const char* SHADER_NAME_POSITION_COLOR_NO_MVP_GRAYSCALE;
#endif
static const char* SHADER_NAME_POSITION_TEXTURE;
static const char* SHADER_NAME_POSITION_TEXTURE_U_COLOR;
static const char* SHADER_NAME_POSITION_TEXTURE_A8_COLOR;

View File

@ -32,6 +32,10 @@ THE SOFTWARE.
#include "base/ccMacros.h"
#include "base/CCConfiguration.h"
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || defined(WP8_SHADER_COMPILER)
#include "ui/shaders/UIShaders.h"
#endif
NS_CC_BEGIN
enum {
@ -57,6 +61,9 @@ enum {
kShaderType_3DPositionNormal,
kShaderType_3DPositionNormalTex,
kShaderType_3DSkinPositionNormalTex,
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || defined(WP8_SHADER_COMPILER)
kShaderType_PositionColor_noMVP_GrayScale,
#endif
kShaderType_MAX,
};
@ -228,6 +235,13 @@ void GLProgramCache::loadDefaultGLPrograms()
p = new GLProgram();
loadDefaultGLProgram(p, kShaderType_3DSkinPositionNormalTex);
_programs.insert(std::make_pair(GLProgram::SHADER_3D_SKINPOSITION_NORMAL_TEXTURE, p));
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || defined(WP8_SHADER_COMPILER)
p = new GLProgram();
loadDefaultGLProgram(p, kShaderType_PositionColor_noMVP_GrayScale);
_programs.insert(std::make_pair(GLProgram::SHADER_NAME_POSITION_COLOR_NO_MVP_GRAYSCALE, p));
#endif
}
void GLProgramCache::reloadDefaultGLPrograms()
@ -358,7 +372,6 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
case kShaderType_PositionTextureColor_noMVP:
p->initWithByteArrays(ccPositionTextureColor_noMVP_vert, ccPositionTextureColor_noMVP_frag);
break;
case kShaderType_PositionTextureColorAlphaTest:
p->initWithByteArrays(ccPositionTextureColor_vert, ccPositionTextureColorAlphaTest_frag);
break;
@ -431,6 +444,11 @@ void GLProgramCache::loadDefaultGLProgram(GLProgram *p, int type)
p->initWithByteArrays((def + std::string(cc3D_SkinPositionNormalTex_vert)).c_str(), (def + std::string(cc3D_ColorNormalTex_frag)).c_str());
}
break;
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || defined(WP8_SHADER_COMPILER)
case kShaderType_PositionColor_noMVP_GrayScale:
p->initWithByteArrays(ccPositionTextureColor_noMVP_vert, ccUIGrayScale_frag);
break;
#endif
default:
CCLOG("cocos2d: %s:%d, error shader type", __FUNCTION__, __LINE__);
return;