precompiled shaders for WP8 only

This commit is contained in:
Dale Stammen 2014-10-14 14:20:32 -07:00
parent ad9c729f6b
commit c28e2c66c5
2 changed files with 9 additions and 9 deletions

View File

@ -39,7 +39,7 @@ THE SOFTWARE.
#include "deprecated/CCString.h" #include "deprecated/CCString.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER)
#include "CCPrecompiledShaders.h" #include "CCPrecompiledShaders.h"
#endif #endif
@ -177,7 +177,7 @@ GLProgram::~GLProgram()
bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray)
{ {
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
GLboolean hasCompiler = false; GLboolean hasCompiler = false;
glGetBooleanv(GL_SHADER_COMPILER, &hasCompiler); glGetBooleanv(GL_SHADER_COMPILER, &hasCompiler);
_hasShaderCompiler = (hasCompiler == GL_TRUE); _hasShaderCompiler = (hasCompiler == GL_TRUE);
@ -226,14 +226,14 @@ bool GLProgram::initWithByteArrays(const GLchar* vShaderByteArray, const GLchar*
CHECK_GL_ERROR_DEBUG(); CHECK_GL_ERROR_DEBUG();
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER)
_shaderId = CCPrecompiledShaders::getInstance()->addShaders(vShaderByteArray, fShaderByteArray); _shaderId = CCPrecompiledShaders::getInstance()->addShaders(vShaderByteArray, fShaderByteArray);
#endif #endif
return true; return true;
} }
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
GLProgram* GLProgram::createWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray) GLProgram* GLProgram::createWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray)
{ {
auto ret = new (std::nothrow) GLProgram(); auto ret = new (std::nothrow) GLProgram();
@ -529,7 +529,7 @@ bool GLProgram::link()
{ {
CCASSERT(_program != 0, "Cannot link invalid program"); CCASSERT(_program != 0, "Cannot link invalid program");
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
if(!_hasShaderCompiler) if(!_hasShaderCompiler)
{ {
// precompiled shader program is already linked // precompiled shader program is already linked
@ -562,7 +562,7 @@ bool GLProgram::link()
_vertShader = _fragShader = 0; _vertShader = _fragShader = 0;
#if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if DEBUG || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
glGetProgramiv(_program, GL_LINK_STATUS, &status); glGetProgramiv(_program, GL_LINK_STATUS, &status);
if (status == GL_FALSE) if (status == GL_FALSE)
@ -573,7 +573,7 @@ bool GLProgram::link()
} }
#endif #endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER)
if (status == GL_TRUE) if (status == GL_TRUE)
{ {
CCPrecompiledShaders::getInstance()->addProgram(_program, _shaderId); CCPrecompiledShaders::getInstance()->addProgram(_program, _shaderId);

View File

@ -175,7 +175,7 @@ public:
* @lua initWithString * @lua initWithString
*/ */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
/** Initializes the CCGLProgram with precompiled shader program */ /** Initializes the CCGLProgram with precompiled shader program */
static GLProgram* createWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray); static GLProgram* createWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray);
bool initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray); bool initWithPrecompiledProgramByteArray(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray);
@ -343,7 +343,7 @@ protected:
struct _hashUniformEntry* _hashForUniforms; struct _hashUniformEntry* _hashForUniforms;
bool _hasShaderCompiler; bool _hasShaderCompiler;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) #if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || defined(WP8_SHADER_COMPILER)
std::string _shaderId; std::string _shaderId;
#endif #endif