diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f374a0d01..7af1dd2342 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -923,8 +923,6 @@ add_library(native STATIC ext/native/gfx_es2/gpu_features.h ext/native/gfx_es2/glsl_program.cpp ext/native/gfx_es2/glsl_program.h - ext/native/gfx_es2/vertex_format.cpp - ext/native/gfx_es2/vertex_format.h ext/native/gfx_es2/gl3stub.c ext/native/gfx_es2/gl3stub.h ext/native/i18n/i18n.cpp diff --git a/ext/native/Android.mk b/ext/native/Android.mk index 8817551b33..5a1c5901a4 100644 --- a/ext/native/Android.mk +++ b/ext/native/Android.mk @@ -73,7 +73,6 @@ LOCAL_SRC_FILES :=\ gfx_es2/gl3stub.c \ gfx_es2/draw_buffer.cpp.arm \ gfx_es2/draw_text.cpp.arm \ - gfx_es2/vertex_format.cpp \ gfx/gl_debug_log.cpp \ gfx/gl_lost_manager.cpp \ gfx/texture_atlas.cpp \ diff --git a/ext/native/gfx_es2/CMakeLists.txt b/ext/native/gfx_es2/CMakeLists.txt index 9d2471f50e..75fbdd6ea8 100644 --- a/ext/native/gfx_es2/CMakeLists.txt +++ b/ext/native/gfx_es2/CMakeLists.txt @@ -1,11 +1,9 @@ set(SRCS draw_buffer.cpp draw_text.cpp - fbo.cpp glsl_program.cpp gpu_features.cpp - gl_state.cpp - vertex_format.cpp) + gl_state.cpp) set(SRCS ${SRCS}) diff --git a/ext/native/gfx_es2/vertex_format.cpp b/ext/native/gfx_es2/vertex_format.cpp deleted file mode 100644 index 5c0fd6232f..0000000000 --- a/ext/native/gfx_es2/vertex_format.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "base/logging.h" -#include "gfx_es2/glsl_program.h" -#include "gfx_es2/vertex_format.h" - -static const GLuint formatLookup[16] = { - GL_FLOAT, - 0, //GL_HALF_FLOAT_EXT, - GL_UNSIGNED_SHORT, - GL_UNSIGNED_BYTE, - 0, //GL_UNSIGNED_INT_10_10_10_2, - 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -void SetVertexFormat(const GLSLProgram *program, uint32_t vertexFormat) { - // First special case our favorites - if (vertexFormat == (POS_FLOAT | NRM_FLOAT | UV0_FLOAT)) { - const int vertexSize = 3*4 + 3*4 + 2*4; - glUniform1i(program->sampler0, 0); - glEnableVertexAttribArray(program->a_position); - glEnableVertexAttribArray(program->a_normal); - glEnableVertexAttribArray(program->a_texcoord0); - glVertexAttribPointer(program->a_position, 3, GL_FLOAT, GL_FALSE, vertexSize, (void *)0); - glVertexAttribPointer(program->a_normal, 3, GL_FLOAT, GL_FALSE, vertexSize, (void *)12); - glVertexAttribPointer(program->a_texcoord0, 2, GL_FLOAT, GL_FALSE, vertexSize, (void *)24); - return; - } - - // Then have generic code here. - - - int vertexSize = 0; - - FLOG("TODO: Write generic code."); - - if (vertexFormat & UV0_MASK) { - glUniform1i(program->sampler0, 0); - } - - glEnableVertexAttribArray(program->a_position); - glVertexAttribPointer(program->a_position, 3, GL_FLOAT, GL_FALSE, vertexSize, (void *)0); - if (vertexFormat & NRM_MASK) { - glEnableVertexAttribArray(program->a_normal); - glVertexAttribPointer(program->a_normal, 3, GL_FLOAT, GL_FALSE, vertexSize, (void *)12); - } - if (vertexFormat & UV0_MASK) { - glEnableVertexAttribArray(program->a_texcoord0); - glVertexAttribPointer(program->a_texcoord0, 2, GL_FLOAT, GL_FALSE, vertexSize, (void *)24); - } - if (vertexFormat & UV1_MASK) { - glEnableVertexAttribArray(program->a_texcoord1); - glVertexAttribPointer(program->a_texcoord1, 2, GL_FLOAT, GL_FALSE, vertexSize, (void *)24); - } - if (vertexFormat & RGBA_MASK) { - glEnableVertexAttribArray(program->a_color); - glVertexAttribPointer(program->a_color, 4, GL_FLOAT, GL_FALSE, vertexSize, (void *)28); - } -} - -// TODO: Save state so that we can get rid of this. -void UnsetVertexFormat(const GLSLProgram *program, uint32_t vertexFormat) { - glDisableVertexAttribArray(program->a_position); - if (vertexFormat & NRM_MASK) - glDisableVertexAttribArray(program->a_normal); - if (vertexFormat & UV0_MASK) - glDisableVertexAttribArray(program->a_texcoord0); - if (vertexFormat & UV1_MASK) - glDisableVertexAttribArray(program->a_texcoord1); - if (vertexFormat & RGBA_MASK) - glDisableVertexAttribArray(program->a_color); -} diff --git a/ext/native/gfx_es2/vertex_format.h b/ext/native/gfx_es2/vertex_format.h deleted file mode 100644 index edaac48145..0000000000 --- a/ext/native/gfx_es2/vertex_format.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -// TODO: Actually use for something :) - -#include "base/basictypes.h" - -// Vertex format flags -enum VtxFmt { - POS_FLOAT = 1, - POS_FLOAT16 = 2, - POS_UINT16 = 3, - POS_UINT8 = 4, - POS_101010 = 5, - - NRM_FLOAT = 1 << 4, - NRM_FLOAT16 = 2 << 4, - NRM_SINT16 = 3 << 4, - NRM_UINT8 = 4 << 4, - NRM_101010 = 5 << 4, - - TANGENT_FLOAT = 1 << 8, - //.... - - UV0_NONE = 1 << 12, - UV0_FLOAT = 1 << 12, - // .... - UV1_NONE = 1 << 16, - UV1_FLOAT = 1 << 16, - - RGBA_NONE = 0 << 20, - RGBA_FLOAT = 1 << 20, - RGBA_FLOAT16 = 2 << 20, - RGBA_UINT16 = 3 << 20, - RGBA_UINT8 = 4 << 20, - RGBA_101010 = 5 << 20, - - POS_MASK = 0x0000000F, - NRM_MASK = 0x000000F0, - TANGENT_MASK = 0x00000F00, - UV0_MASK = 0x0000F000, - UV1_MASK = 0x000F0000, - RGBA_MASK = 0x00F00000, - - // Can add more here, such as a generic AUX or something. Don't know what to use it for though. Hardness for cloth sim? -}; - -struct GLSLProgram; - -// When calling this, the relevant vertex buffer must be bound to GL_ARRAY_BUFFER. -void SetVertexFormat(const GLSLProgram *program, uint32_t format); -void UnsetVertexFormat(const GLSLProgram *program, uint32_t format); diff --git a/ext/native/native.vcxproj b/ext/native/native.vcxproj index 0147779fcc..7ba1bea383 100644 --- a/ext/native/native.vcxproj +++ b/ext/native/native.vcxproj @@ -237,7 +237,6 @@ - @@ -698,7 +697,6 @@ - diff --git a/ext/native/native.vcxproj.filters b/ext/native/native.vcxproj.filters index a317162f45..ef1d6c10d3 100644 --- a/ext/native/native.vcxproj.filters +++ b/ext/native/native.vcxproj.filters @@ -111,9 +111,6 @@ file - - gfx - base @@ -383,9 +380,6 @@ file - - gfx - base