Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_tex_image.cc
| Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | if (!*texco) { | ||||
| node_shader_gpu_bump_tex_coord(mat, node, texco); | node_shader_gpu_bump_tex_coord(mat, node, texco); | ||||
| } | } | ||||
| node_shader_gpu_tex_mapping(mat, node, in, out); | node_shader_gpu_tex_mapping(mat, node, in, out); | ||||
| eGPUSamplerState sampler_state = GPU_SAMPLER_DEFAULT; | eGPUSamplerState sampler_state = GPU_SAMPLER_DEFAULT; | ||||
| switch (tex->extension) { | switch (tex->extension) { | ||||
| case SHD_IMAGE_EXTENSION_REPEAT: | case IMAGE_TEX_EXT_REPEAT: | ||||
| sampler_state |= GPU_SAMPLER_REPEAT; | sampler_state |= GPU_SAMPLER_REPEAT; | ||||
| break; | break; | ||||
| case SHD_IMAGE_EXTENSION_CLIP: | case IMAGE_TEX_EXT_CLIP: | ||||
| sampler_state |= GPU_SAMPLER_CLAMP_BORDER; | sampler_state |= GPU_SAMPLER_CLAMP_BORDER; | ||||
| break; | break; | ||||
| default: | default: | ||||
| break; | break; | ||||
| } | } | ||||
| if (tex->interpolation != SHD_INTERP_CLOSEST) { | if (tex->interpolation != IMAGE_TEX_INTERP_CLOSEST) { | ||||
| sampler_state |= GPU_SAMPLER_ANISO | GPU_SAMPLER_FILTER; | sampler_state |= GPU_SAMPLER_ANISO | GPU_SAMPLER_FILTER; | ||||
| /* TODO(fclem): For now assume mipmap is always enabled. */ | /* TODO(fclem): For now assume mipmap is always enabled. */ | ||||
| sampler_state |= GPU_SAMPLER_MIPMAP; | sampler_state |= GPU_SAMPLER_MIPMAP; | ||||
| } | } | ||||
| const bool use_cubic = ELEM(tex->interpolation, SHD_INTERP_CUBIC, SHD_INTERP_SMART); | const bool use_cubic = ELEM(tex->interpolation, IMAGE_TEX_INTERP_CUBIC, IMAGE_TEX_INTERP_SMART); | ||||
| if (ima->source == IMA_SRC_TILED) { | if (ima->source == IMA_SRC_TILED) { | ||||
| const char *gpu_node_name = use_cubic ? "node_tex_tile_cubic" : "node_tex_tile_linear"; | const char *gpu_node_name = use_cubic ? "node_tex_tile_cubic" : "node_tex_tile_linear"; | ||||
| GPUNodeLink *gpu_image = GPU_image_tiled(mat, ima, iuser, sampler_state); | GPUNodeLink *gpu_image = GPU_image_tiled(mat, ima, iuser, sampler_state); | ||||
| GPUNodeLink *gpu_image_tile_mapping = GPU_image_tiled_mapping(mat, ima, iuser); | GPUNodeLink *gpu_image_tile_mapping = GPU_image_tiled_mapping(mat, ima, iuser); | ||||
| /* UDIM tiles needs a samper2DArray and sampler1DArray for tile mapping. */ | /* UDIM tiles needs a samper2DArray and sampler1DArray for tile mapping. */ | ||||
| GPU_stack_link(mat, node, gpu_node_name, in, out, gpu_image, gpu_image_tile_mapping); | GPU_stack_link(mat, node, gpu_node_name, in, out, gpu_image, gpu_image_tile_mapping); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 97 Lines • Show Last 20 Lines | |||||