Update native (making GLES3 features possible on desktop). Minor optimization.

This commit is contained in:
Henrik Rydgard 2013-10-08 21:50:43 +02:00
parent e08ac100ce
commit 7a0b1e40c6
4 changed files with 11 additions and 7 deletions

View file

@ -81,7 +81,7 @@ LinkedShader::LinkedShader(Shader *vs, Shader *fs, u32 vertType, bool useHWTrans
glAttachShader(program, fs->shader);
// Bind attribute locations to fixed locations so that they're
// the same in all shaders. We can use this later to minimize the calls to
// the same in all shaders. We use this later to minimize the calls to
// glEnableVertexAttribArray and glDisableVertexAttribArray.
glBindAttribLocation(program, ATTR_POSITION, "position");
glBindAttribLocation(program, ATTR_TEXCOORD, "texcoord");
@ -279,7 +279,6 @@ static void SetMatrix4x3(int uniform, const float *m4x3) {
void LinkedShader::use(u32 vertType, LinkedShader *previous) {
glUseProgram(program);
updateUniforms(vertType);
glEnableVertexAttribArray(0);
int enable, disable;
if (previous) {
enable = attrMask & ~previous->attrMask;
@ -288,7 +287,7 @@ void LinkedShader::use(u32 vertType, LinkedShader *previous) {
enable = attrMask;
disable = ~attrMask;
}
for (int i = 1; i < ATTR_COUNT; i++) {
for (int i = 0; i < ATTR_COUNT; i++) {
if (enable & (1 << i))
glEnableVertexAttribArray(i);
else if (disable & (1 << i))
@ -297,8 +296,7 @@ void LinkedShader::use(u32 vertType, LinkedShader *previous) {
}
void LinkedShader::stop() {
glDisableVertexAttribArray(0);
for (int i = 1; i < ATTR_COUNT; i++) {
for (int i = 0; i < ATTR_COUNT; i++) {
if (attrMask & (1 << i))
glDisableVertexAttribArray(i);
}

View file

@ -172,6 +172,12 @@ bool GL_Init(HWND window, std::string *error_message) {
m_hrc = hRC;
}
if (GLEW_OK != glewInit()) {
*error_message = "Failed to re-initialize GLEW.";
return false;
}
if (!m_hrc) {
*error_message = "No m_hrc";
return false;

2
lang

@ -1 +1 @@
Subproject commit fa980bf1e567687c3649e4b2b461d1a223f800cc
Subproject commit 6d8cc479c8be8ba20bdab5595e5c041e7db0cdf7

2
native

@ -1 +1 @@
Subproject commit 5bbab2794a009061a3b5bbf6b69b3ef32d34c152
Subproject commit cf8ee8722367fceea64d5766395ccbed3e68bba7