From ba1bf87bd8f13fa2c67c435eb4a31a0c898d65ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 1 Sep 2022 13:35:04 +0200 Subject: GPUMaterial: Make uniform attrib precompute hash and attribute safe name This avoids redundant operation at draw time. The per attrib hash is to be used with the future implementation. --- source/blender/gpu/GPU_material.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/gpu/GPU_material.h') diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index b203a21e6c2..8c1cb425f0d 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -300,6 +300,10 @@ typedef struct GPUUniformAttr { /* Meaningful part of the attribute set key. */ char name[64]; /* MAX_CUSTOMDATA_LAYER_NAME */ + /** Escaped name with [""]. */ + char name_id_prop[64 * 2 + 4]; + /** Hash of name[64] + use_dupli. */ + uint32_t hash_code; bool use_dupli; /* Helper fields used by code generation. */ @@ -314,7 +318,7 @@ typedef struct GPUUniformAttrList { unsigned int count, hash_code; } GPUUniformAttrList; -GPUUniformAttrList *GPU_material_uniform_attributes(GPUMaterial *material); +GPUUniformAttrList *GPU_material_uniform_attributes(const GPUMaterial *material); struct GHash *GPU_uniform_attr_list_hash_new(const char *info); void GPU_uniform_attr_list_copy(GPUUniformAttrList *dest, GPUUniformAttrList *src); -- cgit v1.2.3