DRW: Add uniform name recording in debug mode.

This commit is contained in:
Clément Foucault 2018-06-02 20:46:04 +02:00
parent f25e459f8f
commit bc6358a580
2 changed files with 10 additions and 0 deletions

View File

@ -182,6 +182,8 @@ typedef enum {
DRW_UNIFORM_BLOCK_PERSIST
} DRWUniformType;
#define MAX_UNIFORM_NAME 13
struct DRWUniform {
DRWUniform *next; /* single-linked list */
union {
@ -195,6 +197,9 @@ struct DRWUniform {
char type; /* DRWUniformType */
char length; /* cannot be more than 16 */
char arraysize; /* cannot be more than 16 too */
#ifndef NDEBUG
char name[MAX_UNIFORM_NAME];
#endif
};
typedef enum {

View File

@ -132,6 +132,11 @@ static void drw_shgroup_uniform(DRWShadingGroup *shgroup, const char *name,
BLI_assert(length >= 0 && length <= 16);
drw_shgroup_uniform_create_ex(shgroup, location, type, value, length, arraysize);
#ifndef NDEBUG
/* Save uniform name to easily identify it when debugging. */
BLI_strncpy(shgroup->uniforms->name, name, MAX_UNIFORM_NAME);
#endif
}
void DRW_shgroup_uniform_texture(DRWShadingGroup *shgroup, const char *name, const GPUTexture *tex)