Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2017-05-21 22:59:34 +0300
committerMike Erwin <significant.bit@gmail.com>2017-05-21 22:59:34 +0300
commit68d8618538e6715e659d5be4e3f15bfbcf2db574 (patch)
treecd1f2a68ffba96242f87c629f751a3871107652e /intern/gawain
parent67b9a5b3d64e0c52b4da844d41c749c924da742d (diff)
Gawain: promote 10_10_10 to first-class vertex format
This format is part of OpenGL 3.3, and one of the reasons for choosing 3.3 over 3.2. Instead of checking #if USE_10_10_10 just use it wherever needed.
Diffstat (limited to 'intern/gawain')
-rw-r--r--intern/gawain/gawain/vertex_format.h8
-rw-r--r--intern/gawain/src/vertex_format.c16
2 files changed, 0 insertions, 24 deletions
diff --git a/intern/gawain/gawain/vertex_format.h b/intern/gawain/gawain/vertex_format.h
index fa93abeb717..b4cce0b930f 100644
--- a/intern/gawain/gawain/vertex_format.h
+++ b/intern/gawain/gawain/vertex_format.h
@@ -18,8 +18,6 @@
#define AVG_VERTEX_ATTRIB_NAME_LEN 11
#define VERTEX_ATTRIB_NAMES_BUFFER_LEN ((AVG_VERTEX_ATTRIB_NAME_LEN + 1) * MAX_VERTEX_ATTRIBS)
-#define USE_10_10_10 1
-
typedef enum {
COMP_I8,
COMP_U8,
@@ -30,9 +28,7 @@ typedef enum {
COMP_F32,
-#if USE_10_10_10
COMP_I10
-#endif
} VertexCompType;
typedef enum {
@@ -71,8 +67,6 @@ void VertexFormat_add_alias(VertexFormat*, const char* alias);
// format conversion
-#if USE_10_10_10
-
typedef struct {
int x : 10;
int y : 10;
@@ -82,5 +76,3 @@ typedef struct {
PackedNormal convert_i10_v3(const float data[3]);
PackedNormal convert_i10_s3(const short data[3]);
-
-#endif // USE_10_10_10
diff --git a/intern/gawain/src/vertex_format.c b/intern/gawain/src/vertex_format.c
index 7fea0d393e4..d2f89455cbc 100644
--- a/intern/gawain/src/vertex_format.c
+++ b/intern/gawain/src/vertex_format.c
@@ -64,9 +64,7 @@ static GLenum convert_comp_type_to_gl(VertexCompType type)
[COMP_F32] = GL_FLOAT,
- #if USE_10_10_10
[COMP_I10] = GL_INT_2_10_10_10_REV
- #endif
};
return table[type];
}
@@ -83,20 +81,16 @@ static unsigned comp_sz(VertexCompType type)
static unsigned attrib_sz(const Attrib *a)
{
-#if USE_10_10_10
if (a->comp_type == COMP_I10)
return 4; // always packed as 10_10_10_2
-#endif
return a->comp_ct * comp_sz(a->comp_type);
}
static unsigned attrib_align(const Attrib *a)
{
-#if USE_10_10_10
if (a->comp_type == COMP_I10)
return 4; // always packed as 10_10_10_2
-#endif
unsigned c = comp_sz(a->comp_type);
if (a->comp_ct == 3 && c <= 2)
@@ -156,14 +150,12 @@ unsigned VertexFormat_add_attrib(VertexFormat* format, const char* name, VertexC
// float type can only kept as float
assert(fetch_mode == KEEP_FLOAT);
break;
- #if USE_10_10_10
case COMP_I10:
// 10_10_10 format intended for normals (xyz) or colors (rgb)
// extra component packed.w can be manually set to { -2, -1, 0, 1 }
assert(comp_ct == 3 || comp_ct == 4);
assert(fetch_mode == NORMALIZE_INT_TO_FLOAT); // not strictly required, may relax later
break;
- #endif
default:
// integer types can be kept as int or converted/normalized to float
assert(fetch_mode != KEEP_FLOAT);
@@ -177,11 +169,7 @@ unsigned VertexFormat_add_attrib(VertexFormat* format, const char* name, VertexC
attrib->name[attrib->name_ct++] = copy_attrib_name(format, name);
attrib->comp_type = comp_type;
attrib->gl_comp_type = convert_comp_type_to_gl(comp_type);
-#if USE_10_10_10
attrib->comp_ct = (comp_type == COMP_I10) ? 4 : comp_ct; // system needs 10_10_10_2 to be 4 or BGRA
-#else
- attrib->comp_ct = comp_ct;
-#endif
attrib->sz = attrib_sz(attrib);
attrib->offset = 0; // offsets & stride are calculated later (during pack)
attrib->fetch_mode = fetch_mode;
@@ -262,8 +250,6 @@ void VertexFormat_pack(VertexFormat* format)
}
-#if USE_10_10_10
-
// OpenGL ES packs in a different order as desktop GL but component conversion is the same.
// Of the code here, only struct PackedNormal needs to change.
@@ -305,5 +291,3 @@ PackedNormal convert_i10_s3(const short data[3])
};
return n;
}
-
-#endif // USE_10_10_10