Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_codegen.c
| Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | else if (builtin == GPU_PARTICLE_VELOCITY) { | ||||
| return "unfparticlevel"; | return "unfparticlevel"; | ||||
| } | } | ||||
| else if (builtin == GPU_PARTICLE_ANG_VELOCITY) { | else if (builtin == GPU_PARTICLE_ANG_VELOCITY) { | ||||
| return "unfparticleangvel"; | return "unfparticleangvel"; | ||||
| } | } | ||||
| else if (builtin == GPU_OBJECT_INFO) { | else if (builtin == GPU_OBJECT_INFO) { | ||||
| return "unfobjectinfo"; | 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) { | else if (builtin == GPU_BARYCENTRIC_TEXCO) { | ||||
| return "unfbarycentrictex"; | return "unfbarycentrictex"; | ||||
| } | } | ||||
| else if (builtin == GPU_BARYCENTRIC_DIST) { | else if (builtin == GPU_BARYCENTRIC_DIST) { | ||||
| return "unfbarycentricdist"; | return "unfbarycentricdist"; | ||||
| } | } | ||||
| else { | else { | ||||
| return ""; | return ""; | ||||
| ▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | else if (tex->tiled_mapping_name[0]) { | ||||
| BLI_dynstr_appendf(ds, "uniform sampler2DArray %s;\n", tex->sampler_name); | BLI_dynstr_appendf(ds, "uniform sampler2DArray %s;\n", tex->sampler_name); | ||||
| BLI_dynstr_appendf(ds, "uniform sampler1DArray %s;\n", tex->tiled_mapping_name); | BLI_dynstr_appendf(ds, "uniform sampler1DArray %s;\n", tex->tiled_mapping_name); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_dynstr_appendf(ds, "uniform sampler2D %s;\n", tex->sampler_name); | BLI_dynstr_appendf(ds, "uniform sampler2D %s;\n", tex->sampler_name); | ||||
| } | } | ||||
| } | } | ||||
| /* 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 */ | /* Print other uniforms */ | ||||
| for (node = graph->nodes.first; node; node = node->next) { | for (node = graph->nodes.first; node; node = node->next) { | ||||
| for (input = node->inputs.first; input; input = input->next) { | for (input = node->inputs.first; input; input = input->next) { | ||||
| if (input->source == GPU_SOURCE_BUILTIN) { | if (input->source == GPU_SOURCE_BUILTIN) { | ||||
| /* only define each builtin uniform/varying once */ | /* only define each builtin uniform/varying once */ | ||||
| if (!(builtins & input->builtin)) { | if (!(builtins & input->builtin)) { | ||||
| builtins |= input->builtin; | builtins |= input->builtin; | ||||
| name = gpu_builtin_name(input->builtin); | name = gpu_builtin_name(input->builtin); | ||||
| if (BLI_str_startswith(name, "samp")) { | if (BLI_str_startswith(name, "unf")) { | ||||
| 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")) { | |||||
| BLI_dynstr_appendf(ds, "uniform %s %s;\n", gpu_data_type_to_string(input->type), name); | BLI_dynstr_appendf(ds, "uniform %s %s;\n", gpu_data_type_to_string(input->type), name); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_dynstr_appendf(ds, "in %s %s;\n", gpu_data_type_to_string(input->type), name); | BLI_dynstr_appendf(ds, "in %s %s;\n", gpu_data_type_to_string(input->type), name); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (input->source == GPU_SOURCE_STRUCT) { | else if (input->source == GPU_SOURCE_STRUCT) { | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | for (node = graph->nodes.first; node; node = node->next) { | ||||
| for (input = node->inputs.first; input; input = input->next) { | for (input = node->inputs.first; input; input = input->next) { | ||||
| if (input->source == GPU_SOURCE_TEX) { | if (input->source == GPU_SOURCE_TEX) { | ||||
| BLI_dynstr_append(ds, input->texture->sampler_name); | BLI_dynstr_append(ds, input->texture->sampler_name); | ||||
| } | } | ||||
| else if (input->source == GPU_SOURCE_TEX_TILED_MAPPING) { | else if (input->source == GPU_SOURCE_TEX_TILED_MAPPING) { | ||||
| BLI_dynstr_append(ds, input->texture->tiled_mapping_name); | 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) { | else if (input->source == GPU_SOURCE_OUTPUT) { | ||||
| codegen_convert_datatype( | codegen_convert_datatype( | ||||
| ds, input->link->output->type, input->type, "tmp", input->link->output->id); | ds, input->link->output->type, input->type, "tmp", input->link->output->id); | ||||
| } | } | ||||
| else if (input->source == GPU_SOURCE_BUILTIN) { | else if (input->source == GPU_SOURCE_BUILTIN) { | ||||
| /* TODO(fclem) get rid of that. */ | /* TODO(fclem) get rid of that. */ | ||||
| if (input->builtin == GPU_INVERSE_VIEW_MATRIX) { | if (input->builtin == GPU_INVERSE_VIEW_MATRIX) { | ||||
| BLI_dynstr_append(ds, "viewinv"); | BLI_dynstr_append(ds, "viewinv"); | ||||
| ▲ Show 20 Lines • Show All 880 Lines • Show Last 20 Lines | |||||