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:
authorClément Foucault <foucault.clem@gmail.com>2018-02-11 17:33:39 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-02-14 20:59:42 +0300
commitdf86e9cab54fe1272697bb652436f46937fc0886 (patch)
treefcd65d243612ec6be4fc819ce5a1f6fb0c5ecb10 /intern/gawain
parent27a7174546d1f007eb4a1fd084ce5b6d470aae25 (diff)
GWN: Extend support for multiple of 4 components in batches.
Diffstat (limited to 'intern/gawain')
-rw-r--r--intern/gawain/gawain/gwn_vertex_format.h2
-rw-r--r--intern/gawain/src/gwn_batch.c4
-rw-r--r--intern/gawain/src/gwn_vertex_format.c4
3 files changed, 5 insertions, 5 deletions
diff --git a/intern/gawain/gawain/gwn_vertex_format.h b/intern/gawain/gawain/gwn_vertex_format.h
index 45c86498172..911c0605ecc 100644
--- a/intern/gawain/gawain/gwn_vertex_format.h
+++ b/intern/gawain/gawain/gwn_vertex_format.h
@@ -41,7 +41,7 @@ typedef enum {
typedef struct Gwn_VertAttr {
Gwn_VertCompType comp_type;
unsigned gl_comp_type;
- unsigned comp_ct; // 1 to 4 or 16
+ unsigned comp_ct; // 1 to 4 or 8 or 12 or 16
unsigned sz; // size in bytes, 1 to 64
unsigned offset; // from beginning of vertex, in bytes
Gwn_VertFetchMode fetch_mode;
diff --git a/intern/gawain/src/gwn_batch.c b/intern/gawain/src/gwn_batch.c
index c15591abc79..ee6de9d1126 100644
--- a/intern/gawain/src/gwn_batch.c
+++ b/intern/gawain/src/gwn_batch.c
@@ -145,13 +145,13 @@ static void create_bindings(Gwn_Batch* batch, const Gwn_ShaderInterface* interfa
if (input == NULL) continue;
- if (a->comp_ct == 16) // Mat4 case
+ if (a->comp_ct == 16 || a->comp_ct == 12 || a->comp_ct == 8)
{
#if TRUST_NO_ONE
assert(a->fetch_mode == GWN_FETCH_FLOAT);
assert(a->gl_comp_type == GL_FLOAT);
#endif
- for (int i = 0; i < 4; ++i)
+ for (int i = 0; i < a->comp_ct / 4; ++i)
{
glEnableVertexAttribArray(input->location + i);
glVertexAttribDivisor(input->location + i, (use_instancing) ? 1 : 0);
diff --git a/intern/gawain/src/gwn_vertex_format.c b/intern/gawain/src/gwn_vertex_format.c
index ff534673294..4694bc22b2b 100644
--- a/intern/gawain/src/gwn_vertex_format.c
+++ b/intern/gawain/src/gwn_vertex_format.c
@@ -136,7 +136,7 @@ unsigned GWN_vertformat_attr_add(Gwn_VertFormat* format, const char* name, Gwn_V
assert(format->name_ct < GWN_VERT_ATTR_MAX_LEN); // there's room for more
assert(format->attrib_ct < GWN_VERT_ATTR_MAX_LEN); // there's room for more
assert(!format->packed); // packed means frozen/locked
- assert((comp_ct >= 1 && comp_ct <= 4) || comp_ct == 16);
+ assert((comp_ct >= 1 && comp_ct <= 4) || comp_ct == 8 || comp_ct == 12 || comp_ct == 16);
switch (comp_type)
{
case GWN_COMP_F32:
@@ -153,7 +153,7 @@ unsigned GWN_vertformat_attr_add(Gwn_VertFormat* format, const char* name, Gwn_V
// integer types can be kept as int or converted/normalized to float
assert(fetch_mode != GWN_FETCH_FLOAT);
// only support float matrices (see Batch_update_program_bindings)
- assert(comp_ct != 16);
+ assert(comp_ct != 8 && comp_ct != 12 && comp_ct != 16);
}
#endif
format->name_ct++; // multiname support