[spline/bezier]Minor fixes for HW tess GLES.

This commit is contained in:
xebra 2017-02-25 17:22:54 +09:00
parent 49a37e997f
commit 0172bbe8aa
3 changed files with 11 additions and 11 deletions

View File

@ -1120,7 +1120,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
#ifndef USING_GLES2
if (isAllowTexture1D) {
// Position
glActiveTexture(GL_TEXTURE3);
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_1D, data_tex[0]);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -1135,7 +1135,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
// Texcoords
if (hasTexCoords) {
glActiveTexture(GL_TEXTURE4);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_1D, data_tex[1]);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -1150,7 +1150,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
}
// Color
glActiveTexture(GL_TEXTURE5);
glActiveTexture(GL_TEXTURE6);
glBindTexture(GL_TEXTURE_1D, data_tex[2]);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -1167,7 +1167,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
#endif
{
// Position
glActiveTexture(GL_TEXTURE3);
glActiveTexture(GL_TEXTURE4);
glBindTexture(GL_TEXTURE_2D, data_tex[0]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -1182,7 +1182,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
// Texcoords
if (hasTexCoords) {
glActiveTexture(GL_TEXTURE4);
glActiveTexture(GL_TEXTURE5);
glBindTexture(GL_TEXTURE_2D, data_tex[1]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@ -1197,7 +1197,7 @@ void DrawEngineGLES::TessellationDataTransferGLES::SendDataToShader(const float
}
// Color
glActiveTexture(GL_TEXTURE5);
glActiveTexture(GL_TEXTURE6);
glBindTexture(GL_TEXTURE_2D, data_tex[2]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

View File

@ -305,11 +305,11 @@ LinkedShader::LinkedShader(ShaderID VSID, Shader *vs, ShaderID FSID, Shader *fs,
if (u_tess_pos_tex != -1)
glUniform1i(u_tess_pos_tex, 3); // Texture unit 3
glUniform1i(u_tess_pos_tex, 4); // Texture unit 4
if (u_tess_tex_tex != -1)
glUniform1i(u_tess_tex_tex, 4); // Texture unit 4
glUniform1i(u_tess_tex_tex, 5); // Texture unit 5
if (u_tess_col_tex != -1)
glUniform1i(u_tess_col_tex, 5); // Texture unit 5
glUniform1i(u_tess_col_tex, 6); // Texture unit 6
// The rest, use the "dirty" mechanism.
dirtyUniforms = DIRTY_ALL_UNIFORMS;

View File

@ -488,7 +488,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) {
WRITE(p, " weights[1] = 3.0 * tess_pos * (1.0 - tess_pos) * (1.0 - tess_pos);\n");
WRITE(p, " weights[2] = 3.0 * tess_pos * tess_pos * (1.0 - tess_pos);\n");
WRITE(p, " weights[3] = tess_pos * tess_pos * tess_pos;\n");
} else if (doSpline) {
} else { // Spline
WRITE(p, " ivec2 spline_num_patches = ivec2(u_spline_count_u - 3, u_spline_count_v - 3);\n");
WRITE(p, " ivec2 spline_type = ivec2(u_spline_type_u, u_spline_type_v);\n");
WRITE(p, " vec2 knots[6];\n");
@ -527,7 +527,7 @@ void GenerateVertexShader(const ShaderID &id, char *buffer) {
WRITE(p, " vec3 du = tess_sample(_pos, bernderiv_u);\n");
WRITE(p, " vec3 dv = tess_sample(_pos, bernderiv_v);\n");
} else if (doSpline) {
} else { // Spline
WRITE(p, " vec2 tess_next_u = vec2(normal.x, 0.0);\n");
WRITE(p, " vec2 tess_next_v = vec2(0.0, normal.y);\n");
// Right