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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-14 12:47:20 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2020-02-15 23:09:29 +0300
commit322dc723165a705c34df1e3246e500da1a9927de (patch)
treed82e780e36c89b327d58aa2b8ee215ee8a9fd514 /source/blender/gpu/intern/gpu_material.c
parent007f1b74a67302fb4c164eb26969419434a98aee (diff)
Cleanup: refactor GPU material attribute and texture requests
Diffstat (limited to 'source/blender/gpu/intern/gpu_material.c')
-rw-r--r--source/blender/gpu/intern/gpu_material.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 9eed3e4619b..d8d3e5a2ff2 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -197,11 +197,6 @@ void GPU_material_free(ListBase *gpumaterial)
BLI_freelistN(gpumaterial);
}
-eGPUBuiltin GPU_get_material_builtins(GPUMaterial *material)
-{
- return material->graph.builtins;
-}
-
Scene *GPU_material_scene(GPUMaterial *material)
{
return material->scene;
@@ -567,9 +562,14 @@ struct GPUUniformBuffer *GPU_material_create_sss_profile_ubo(void)
#undef SSS_EXPONENT
#undef SSS_SAMPLES
-void GPU_material_vertex_attrs(GPUMaterial *material, GPUVertAttrLayers *r_attrs)
+ListBase GPU_material_attributes(GPUMaterial *material)
{
- *r_attrs = material->graph.attrs;
+ return material->graph.attributes;
+}
+
+ListBase GPU_material_textures(GPUMaterial *material)
+{
+ return material->graph.textures;
}
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link)
@@ -696,13 +696,14 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene,
if (mat->pass == NULL) {
/* We had a cache hit and the shader has already failed to compile. */
mat->status = GPU_MAT_FAILED;
+ gpu_node_graph_free(&mat->graph);
}
else {
GPUShader *sh = GPU_pass_shader_get(mat->pass);
if (sh != NULL) {
/* We had a cache hit and the shader is already compiled. */
mat->status = GPU_MAT_SUCCESS;
- gpu_node_graph_extract_dynamic_inputs(sh, &mat->graph);
+ gpu_node_graph_free_nodes(&mat->graph);
}
else {
mat->status = GPU_MAT_QUEUED;
@@ -711,6 +712,7 @@ GPUMaterial *GPU_material_from_nodetree(Scene *scene,
}
else {
mat->status = GPU_MAT_FAILED;
+ gpu_node_graph_free(&mat->graph);
}
/* Only free after GPU_pass_shader_get where GPUUniformBuffer
@@ -748,14 +750,14 @@ void GPU_material_compile(GPUMaterial *mat)
GPUShader *sh = GPU_pass_shader_get(mat->pass);
if (sh != NULL) {
mat->status = GPU_MAT_SUCCESS;
- gpu_node_graph_extract_dynamic_inputs(sh, &mat->graph);
+ gpu_node_graph_free_nodes(&mat->graph);
}
}
else {
mat->status = GPU_MAT_FAILED;
- gpu_node_graph_free(&mat->graph);
GPU_pass_release(mat->pass);
mat->pass = NULL;
+ gpu_node_graph_free(&mat->graph);
}
}