[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60346] branches/soc-2013-viewport_fx/ source/blender/gpu: because I had not used the feature yet, I had not noticed that I had 'object' and 'param' parameters backwards in the implementation of aspects.
Jason Wilkins
Jason.A.Wilkins at gmail.com
Tue Sep 24 00:32:02 CEST 2013
Revision: 60346
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60346
Author: jwilkins
Date: 2013-09-23 22:32:01 +0000 (Mon, 23 Sep 2013)
Log Message:
-----------
because I had not used the feature yet, I had not noticed that I had 'object' and 'param' parameters backwards in the implementation of aspects. also fixed potential bug when using a 'param' and mixing up calls to different aspects
Modified Paths:
--------------
branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h
branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_blender_aspect.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_select.c
branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_select_intern.h
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h 2013-09-23 21:55:56 UTC (rev 60345)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_aspect.h 2013-09-23 22:32:01 UTC (rev 60346)
@@ -44,20 +44,21 @@
void GPU_delete_aspects(size_t count, const uint32_t* aspects);
typedef struct GPUaspectimpl {
- bool (*render_begin )(void* param, const void* object);
- bool (*render_end )(void* param, const void* object);
- bool (*render_commit)(void* param);
- bool (*select_begin )(void* param, const void* object);
- bool (*select_end )(void* param, const void* object);
- bool (*select_commit)(void* param);
- void (*enable )(void* param, uint32_t options);
- void (*disable )(void* param, uint32_t options);
- void* param;
+ bool (*render_begin )(const void* object, void* param);
+ bool (*render_end )(const void* object, void* param);
+ bool (*render_commit)(const void* object);
+ bool (*select_begin )(const void* object, void* param);
+ bool (*select_end )(const void* object, void* param);
+ bool (*select_commit)(const void* object);
+ void (*enable )(const void* object, uint32_t options);
+ void (*disable )(const void* object, uint32_t options);
+ void* object;
+ void* current_param; /* not a part of the interface */
} GPUaspectimpl;
void GPU_aspect_impl(uint32_t aspect, GPUaspectimpl* aspectImpl);
-bool GPU_aspect_begin(uint32_t aspect, const void* object);
+bool GPU_aspect_begin(uint32_t aspect, void* param);
bool GPU_aspect_end (void);
void GPU_aspect_enable (uint32_t aspect, uint32_t options);
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h 2013-09-23 21:55:56 UTC (rev 60345)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/GPU_blender_aspect.h 2013-09-23 22:32:01 UTC (rev 60346)
@@ -37,12 +37,14 @@
extern uint32_t GPU_ASPECT_BASIC;
+extern uint32_t GPU_ASPECT_CODEGEN;
extern uint32_t GPU_ASPECT_FONT;
extern uint32_t GPU_ASPECT_PIXELS;
extern uint32_t GPU_ASPECT_RASTER;
extern uint32_t GPU_ASPECT_SPRITE;
extern GPUaspectimpl GPU_ASPECTIMPL_BASIC;
+extern GPUaspectimpl GPU_ASPECTIMPL_CODEGEN;
extern GPUaspectimpl GPU_ASPECTIMPL_FONT;
extern GPUaspectimpl GPU_ASPECTIMPL_PIXELS;
extern GPUaspectimpl GPU_ASPECTIMPL_RASTER;
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c 2013-09-23 21:55:56 UTC (rev 60345)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_aspect.c 2013-09-23 22:32:01 UTC (rev 60346)
@@ -48,8 +48,7 @@
static GPUaspectimpl dummy = { NULL };
-static uint32_t current_aspect = -1;
-static const void* current_object = NULL;
+static uint32_t current_aspect = -1;
static bool in_select_mode = false;
@@ -102,9 +101,9 @@
if (aspectImpl != NULL) {
if (in_select_mode)
- return aspectImpl->select_commit != NULL ? aspectImpl->select_commit(aspectImpl->param) : false;
+ return aspectImpl->select_commit != NULL ? aspectImpl->select_commit(aspectImpl->object) : false;
else
- return aspectImpl->render_commit != NULL ? aspectImpl->render_commit(aspectImpl->param) : false;
+ return aspectImpl->render_commit != NULL ? aspectImpl->render_commit(aspectImpl->object) : false;
}
return false;
@@ -161,29 +160,33 @@
void GPU_aspect_impl(uint32_t aspect, GPUaspectimpl* aspectImpl)
{
- GPU_ASPECT_FUNCS[aspect] = aspectImpl;
+ if (aspectImpl != NULL)
+ GPU_ASPECT_FUNCS[aspect] = aspectImpl;
+ else
+ GPU_ASPECT_FUNCS[aspect] = &dummy;
}
-bool GPU_aspect_begin(uint32_t aspect, const void* object)
+bool GPU_aspect_begin(uint32_t aspect, void* param)
{
GPUaspectimpl* aspectImpl;
GPU_ASSERT(!gpu_aspect_active());
current_aspect = aspect;
- current_object = object;
in_select_mode = gpu_is_select_mode();
aspectImpl = GPU_ASPECT_FUNCS[aspect];
if (aspectImpl != NULL) {
+ aspectImpl->current_param = param;
+
if (in_select_mode)
- return aspectImpl->select_begin != NULL ? aspectImpl->select_begin(aspectImpl->param, object) : true;
+ return aspectImpl->select_begin != NULL ? aspectImpl->select_begin(aspectImpl->object, param) : true;
else
- return aspectImpl->render_begin != NULL ? aspectImpl->render_begin(aspectImpl->param, object) : true;
+ return aspectImpl->render_begin != NULL ? aspectImpl->render_begin(aspectImpl->object, param) : true;
}
return true;
@@ -194,22 +197,23 @@
bool GPU_aspect_end(void)
{
GPUaspectimpl* aspectImpl;
- const void* object;
+ void* param;
GPU_ASSERT(gpu_aspect_active());
GPU_ASSERT(in_select_mode == gpu_is_select_mode()); /* not allowed to change select/render mode while an aspect is active */
aspectImpl = GPU_ASPECT_FUNCS[current_aspect];
- object = current_object;
current_aspect = -1;
- current_object = NULL;
if (aspectImpl != NULL) {
+ param = aspectImpl->current_param;
+ aspectImpl->current_param = NULL;
+
if (in_select_mode)
- return aspectImpl->select_end != NULL ? aspectImpl->select_end(aspectImpl->param, object) : true;
+ return aspectImpl->select_end != NULL ? aspectImpl->select_end(aspectImpl->object, param) : true;
else
- return aspectImpl->render_end != NULL ? aspectImpl->render_end(aspectImpl->param, object) : true;
+ return aspectImpl->render_end != NULL ? aspectImpl->render_end(aspectImpl->object, param) : true;
}
return true;
@@ -226,7 +230,7 @@
aspectImpl = GPU_ASPECT_FUNCS[aspect];
if (aspectImpl != NULL && aspectImpl->enable != NULL)
- aspectImpl->enable(aspectImpl->param, options);
+ aspectImpl->enable(aspectImpl->object, options);
}
@@ -240,5 +244,5 @@
aspectImpl = GPU_ASPECT_FUNCS[aspect];
if (aspectImpl != NULL && aspectImpl->disable != NULL )
- aspectImpl->disable(aspectImpl->param, options);
+ aspectImpl->disable(aspectImpl->object, options);
}
Modified: branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_blender_aspect.c
===================================================================
--- branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_blender_aspect.c 2013-09-23 21:55:56 UTC (rev 60345)
+++ branches/soc-2013-viewport_fx/source/blender/gpu/intern/gpu_blender_aspect.c 2013-09-23 22:32:01 UTC (rev 60346)
@@ -45,22 +45,23 @@
-uint32_t GPU_ASPECT_FONT = 0;
-uint32_t GPU_ASPECT_BASIC = 0;
-uint32_t GPU_ASPECT_PIXELS = 0;
-uint32_t GPU_ASPECT_RASTER = 0;
-uint32_t GPU_ASPECT_SPRITE = 0;
+uint32_t GPU_ASPECT_BASIC = 0;
+uint32_t GPU_ASPECT_CODEGEN = 0;
+uint32_t GPU_ASPECT_FONT = 0;
+uint32_t GPU_ASPECT_PIXELS = 0;
+uint32_t GPU_ASPECT_RASTER = 0;
+uint32_t GPU_ASPECT_SPRITE = 0;
-static bool font_end(void* UNUSED(param), const void* UNUSED(object))
+static bool font_end(const void* UNUSED(object), void* UNUSED(param))
{
gpu_font_unbind();
return true;
}
-static bool font_commit(void* UNUSED(param))
+static bool font_commit(const void* UNUSED(object))
{
gpu_font_bind();
@@ -80,14 +81,14 @@
-static bool pixels_end(void* UNUSED(param), const void* UNUSED(object))
+static bool pixels_end(const void* UNUSED(object), void* UNUSED(param))
{
gpu_pixels_unbind();
return true;
}
-static bool pixels_commit(void* UNUSED(param))
+static bool pixels_commit(const void* UNUSED(object))
{
gpu_pixels_bind();
@@ -107,26 +108,26 @@
-static bool basic_end(void* UNUSED(param), const void* UNUSED(object))
+static bool basic_end(const void* UNUSED(object), void* UNUSED(param))
{
gpu_basic_unbind();
return true;
}
-static bool basic_commit(void* UNUSED(param))
+static bool basic_commit(const void* UNUSED(object))
{
gpu_basic_bind();
return true;
}
-static void basic_enable(void* UNUSED(param), uint32_t options)
+static void basic_enable(const void* UNUSED(object), uint32_t options)
{
gpu_basic_enable(options);
}
-static void basic_disable(void* UNUSED(param), uint32_t options)
+static void basic_disable(const void* UNUSED(object), uint32_t options)
{
gpu_basic_disable(options);
}
@@ -144,26 +145,39 @@
-static bool raster_end(void* UNUSED(param), const void* UNUSED(object))
+GPUaspectimpl GPU_ASPECTIMPL_CODEGEN = {
+ NULL, /* render_begin */
+ NULL, /* render_end */
+ NULL, /* render_commit */
+ NULL, /* select_begin */
+ NULL, /* select_end */
+ NULL, /* select_commit */
+ NULL, /* enable */
+ NULL, /* disable */
+};
+
+
+
+static bool raster_end(const void* UNUSED(object), void* UNUSED(param))
{
gpu_raster_unbind();
return true;
}
-static bool raster_commit(void* UNUSED(param))
+static bool raster_commit(const void* UNUSED(object))
{
gpu_raster_bind();
return true;
}
-static void raster_enable(void* UNUSED(param), uint32_t options)
+static void raster_enable(const void* UNUSED(object), uint32_t options)
{
gpu_raster_enable(options);
}
-static void raster_disable(void* UNUSED(param), uint32_t options)
+static void raster_disable(const void* UNUSED(object), uint32_t options)
{
gpu_raster_disable(options);
}
@@ -181,26 +195,26 @@
-static bool sprite_end(void* UNUSED(param), const void* UNUSED(object))
+static bool sprite_end(const void* UNUSED(object), void* UNUSED(param))
{
gpu_sprite_unbind();
return true;
}
-static bool sprite_commit(void* UNUSED(param))
+static bool sprite_commit(const void* UNUSED(object))
{
gpu_sprite_bind();
return true;
}
-static void sprite_enable(void* UNUSED(param), uint32_t options)
+static void sprite_enable(const void* UNUSED(object), uint32_t options)
{
gpu_sprite_enable(options);
}
-static void sprite_disable(void* UNUSED(param), uint32_t options)
+static void sprite_disable(const void* UNUSED(object), uint32_t options)
{
gpu_sprite_disable(options);
}
@@ -220,14 +234,16 @@
void gpu_blender_aspect_init(void)
{
+ GPU_gen_aspects(1, &GPU_ASPECT_BASIC);
+ GPU_gen_aspects(1, &GPU_ASPECT_CODEGEN);
GPU_gen_aspects(1, &GPU_ASPECT_FONT);
- GPU_gen_aspects(1, &GPU_ASPECT_BASIC);
GPU_gen_aspects(1, &GPU_ASPECT_PIXELS);
GPU_gen_aspects(1, &GPU_ASPECT_RASTER);
GPU_gen_aspects(1, &GPU_ASPECT_SPRITE);
+ GPU_aspect_impl(GPU_ASPECT_BASIC, &GPU_ASPECTIMPL_BASIC);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list