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 <brecht>2020-03-11 16:58:19 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-03-11 16:59:05 +0300
commitb9f6d033beecd75398be14419d37d8aab0609812 (patch)
treeb2385a92388dfb1d17a99a72dd442bc5bc38de85 /source/blender/gpu/intern/gpu_codegen.c
parente1e772a80243f3c279fcd076c8311301e8885d41 (diff)
Eevee: internal support for arbitrary number of volume grids
This has no user visible impact yet since smoke volumes only support a fixed set of attributes, but will become important with the new volume object. For GPU shader compilation, volume grids are now handled separately from image textures. They are somewhere between a vertex attribute and an image texture, basically an attribute that is stored as a texture. Differential Revision: https://developer.blender.org/D6952
Diffstat (limited to 'source/blender/gpu/intern/gpu_codegen.c')
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index e8616c1e256..bcaa95c2f59 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -269,18 +269,6 @@ static const char *gpu_builtin_name(eGPUBuiltin builtin)
else if (builtin == GPU_OBJECT_INFO) {
return "unfobjectinfo";
}
- else if (builtin == GPU_VOLUME_DENSITY) {
- return "sampdensity";
- }
- else if (builtin == GPU_VOLUME_COLOR) {
- return "sampcolor";
- }
- else if (builtin == GPU_VOLUME_FLAME) {
- return "sampflame";
- }
- else if (builtin == GPU_VOLUME_TEMPERATURE) {
- return "unftemperature";
- }
else if (builtin == GPU_BARYCENTRIC_TEXCO) {
return "unfbarycentrictex";
}
@@ -344,6 +332,11 @@ static int codegen_process_uniforms_functions(GPUMaterial *material,
}
}
+ /* Volume Grids */
+ for (GPUMaterialVolumeGrid *grid = graph->volume_grids.first; grid; grid = grid->next) {
+ BLI_dynstr_appendf(ds, "uniform sampler3D %s;\n", grid->sampler_name);
+ }
+
/* Print other uniforms */
for (node = graph->nodes.first; node; node = node->next) {
for (input = node->inputs.first; input; input = input->next) {
@@ -353,13 +346,7 @@ static int codegen_process_uniforms_functions(GPUMaterial *material,
builtins |= input->builtin;
name = gpu_builtin_name(input->builtin);
- if (BLI_str_startswith(name, "samp")) {
- if ((input->builtin == GPU_VOLUME_DENSITY) || (input->builtin == GPU_VOLUME_COLOR) ||
- (input->builtin == GPU_VOLUME_FLAME)) {
- BLI_dynstr_appendf(ds, "uniform sampler3D %s;\n", name);
- }
- }
- else if (BLI_str_startswith(name, "unf")) {
+ if (BLI_str_startswith(name, "unf")) {
BLI_dynstr_appendf(ds, "uniform %s %s;\n", gpu_data_type_to_string(input->type), name);
}
else {
@@ -442,6 +429,9 @@ static void codegen_call_functions(DynStr *ds, GPUNodeGraph *graph, GPUOutput *f
else if (input->source == GPU_SOURCE_TEX_TILED_MAPPING) {
BLI_dynstr_append(ds, input->texture->tiled_mapping_name);
}
+ else if (input->source == GPU_SOURCE_VOLUME_GRID) {
+ BLI_dynstr_append(ds, input->volume_grid->sampler_name);
+ }
else if (input->source == GPU_SOURCE_OUTPUT) {
codegen_convert_datatype(
ds, input->link->output->type, input->type, "tmp", input->link->output->id);