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>2016-10-20 21:29:59 +0300
committerMike Erwin <significant.bit@gmail.com>2016-10-20 21:29:59 +0300
commitc6abbb40ad8e62a74c992ca02b8bc85171b6af8e (patch)
tree267a6f3804d9673a13ee5504081ca760a384f6fd /source/blender/gpu/gawain/immediate.c
parenta92d20a0a467ece2680d8bb7600a37be470fce66 (diff)
Gawain: closer integration of immediate mode & matrix APIs
- any shader program can use matrix state (not only built-in shaders) - you can mix matrix & begin/end calls, and the bound shader will use the latest matrix state Part of T49450 & T49043
Diffstat (limited to 'source/blender/gpu/gawain/immediate.c')
-rw-r--r--source/blender/gpu/gawain/immediate.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/gpu/gawain/immediate.c b/source/blender/gpu/gawain/immediate.c
index 30c82fd2710..7c3edc20d42 100644
--- a/source/blender/gpu/gawain/immediate.c
+++ b/source/blender/gpu/gawain/immediate.c
@@ -13,6 +13,10 @@
#include "attrib_binding.h"
#include <string.h>
+// necessary functions from matrix API
+extern void gpuBindMatrices(GLuint program);
+extern bool gpuMatricesDirty(void);
+
typedef struct {
// TODO: organize this struct by frequency of change (run-time)
@@ -116,6 +120,7 @@ void immBindProgram(GLuint program)
{
#if TRUST_NO_ONE
assert(imm.bound_program == 0);
+ assert(glIsProgram(program));
#endif
if (!imm.vertex_format.packed)
@@ -124,6 +129,8 @@ void immBindProgram(GLuint program)
glUseProgram(program);
get_attrib_locations(&imm.vertex_format, &imm.attrib_binding, program);
imm.bound_program = program;
+
+ gpuBindMatrices(program);
}
void immUnbindProgram()
@@ -326,6 +333,9 @@ static void immDrawSetup(void)
glVertexAttribIPointer(loc, a->comp_ct, a->comp_type, stride, pointer);
}
}
+
+ if (gpuMatricesDirty())
+ gpuBindMatrices(imm.bound_program);
}
void immEnd()