Remove gfx_es2/vertex_format

This commit is contained in:
Henrik Rydgård committed 2015-09-19 11:07:52 +02:00
1 parent c219793803
commit 333ed22907
7 files changed
+1 -136

No files matched your search

-2
View File
@@ -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
-1
View File
@@ -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 \
+1 -3
View File
@@ -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})
-71
View File
@@ -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);
}
-51
View File
@@ -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);
-2
View File
@@ -237,7 +237,6 @@
<ClInclude Include="gfx_es2\gl3stub.h" />
<ClInclude Include="gfx_es2\glsl_program.h" />
<ClInclude Include="gfx_es2\gpu_features.h" />
<ClInclude Include="gfx_es2\vertex_format.h" />
<ClInclude Include="i18n\i18n.h" />
<ClInclude Include="image\png_load.h" />
<ClInclude Include="image\zim_load.h" />
@@ -698,7 +697,6 @@
</ClCompile>
<ClCompile Include="gfx_es2\glsl_program.cpp" />
<ClCompile Include="gfx_es2\gpu_features.cpp" />
<ClCompile Include="gfx_es2\vertex_format.cpp" />
<ClCompile Include="i18n\i18n.cpp" />
<ClCompile Include="image\png_load.cpp" />
<ClCompile Include="image\zim_load.cpp" />
-6
View File
@@ -111,9 +111,6 @@
<ClInclude Include="file\path.h">
<Filter>file</Filter>
</ClInclude>
<ClInclude Include="gfx_es2\vertex_format.h">
<Filter>gfx</Filter>
</ClInclude>
<ClInclude Include="base\NativeApp.h">
<Filter>base</Filter>
</ClInclude>
@@ -383,9 +380,6 @@
<ClCompile Include="file\path.cpp">
<Filter>file</Filter>
</ClCompile>
<ClCompile Include="gfx_es2\vertex_format.cpp">
<Filter>gfx</Filter>
</ClCompile>
<ClCompile Include="base\display.cpp">
<Filter>base</Filter>
</ClCompile>