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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-25 13:11:55 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-04-25 13:13:26 +0300
commit7e18aa4250ffc8ec6c475fb90fc5549e6a4d5de6 (patch)
tree6d44ac28836a8bc9ff613effdf29656b33366b6e /source
parent38a0896f154162cb07cd20b6189c080046a050f5 (diff)
Fix T63524: crash selecting an object in texture coordinate node
Using mat4 in a uniform buffer object was not properly supported.
Diffstat (limited to 'source')
-rw-r--r--source/blender/gpu/intern/gpu_uniformbuffer.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_uniformbuffer.c b/source/blender/gpu/intern/gpu_uniformbuffer.c
index 651e3c1aaa7..6b2c9033c13 100644
--- a/source/blender/gpu/intern/gpu_uniformbuffer.c
+++ b/source/blender/gpu/intern/gpu_uniformbuffer.c
@@ -65,7 +65,7 @@ static void gpu_uniformbuffer_inputs_sort(struct ListBase *inputs);
/* Only support up to this type, if you want to extend it, make sure the
* padding logic is correct for the new types. */
-#define MAX_UBO_GPU_TYPE GPU_VEC4
+#define MAX_UBO_GPU_TYPE GPU_MAT4
static void gpu_uniformbuffer_initialize(GPUUniformBuffer *ubo, const void *data)
{
@@ -255,11 +255,11 @@ static int inputs_cmp(const void *a, const void *b)
/**
* Make sure we respect the expected alignment of UBOs.
- * vec4, pad vec3 as vec4, then vec2, then floats.
+ * mat4, vec4, pad vec3 as vec4, then vec2, then floats.
*/
static void gpu_uniformbuffer_inputs_sort(ListBase *inputs)
{
- /* Order them as vec4, vec3, vec2, float. */
+ /* Order them as mat4, vec4, vec3, vec2, float. */
BLI_listbase_sort(inputs, inputs_cmp);
/* Creates a lookup table for the different types; */
@@ -268,6 +268,17 @@ static void gpu_uniformbuffer_inputs_sort(ListBase *inputs)
for (LinkData *link = inputs->first; link; link = link->next) {
GPUInput *input = link->data;
+
+ if (input->type == GPU_MAT3) {
+ /* Alignment for mat3 is not handled currently, so not supported */
+ BLI_assert(!"mat3 not supported in UBO");
+ continue;
+ }
+ else if (input->type > MAX_UBO_GPU_TYPE) {
+ BLI_assert(!"GPU type not supported in UBO");
+ continue;
+ }
+
if (input->type == cur_type) {
continue;
}