Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_texture.c
| Show First 20 Lines • Show All 606 Lines • ▼ Show 20 Lines | GPUTexture *GPU_texture_create_nD( | ||||
| tex->number = -1; | tex->number = -1; | ||||
| tex->refcount = 1; | tex->refcount = 1; | ||||
| tex->format = tex_format; | tex->format = tex_format; | ||||
| tex->components = gpu_get_component_count(tex_format); | tex->components = gpu_get_component_count(tex_format); | ||||
| tex->bytesize = gpu_get_bytesize(tex_format); | tex->bytesize = gpu_get_bytesize(tex_format); | ||||
| tex->format_flag = 0; | tex->format_flag = 0; | ||||
| if (n == 2) { | if (n == 2) { | ||||
| if (d == 0) | if (d > 1) | ||||
| tex->target_base = tex->target = GL_TEXTURE_2D; | |||||
| else | |||||
| tex->target_base = tex->target = GL_TEXTURE_2D_ARRAY; | tex->target_base = tex->target = GL_TEXTURE_2D_ARRAY; | ||||
| else | |||||
| tex->target_base = tex->target = GL_TEXTURE_2D; | |||||
| } | } | ||||
| else if (n == 1) { | else if (n == 1) { | ||||
| if (h == 0) | if (h == 0) | ||||
| tex->target_base = tex->target = GL_TEXTURE_1D; | tex->target_base = tex->target = GL_TEXTURE_1D; | ||||
| else | else | ||||
| tex->target_base = tex->target = GL_TEXTURE_1D_ARRAY; | tex->target_base = tex->target = GL_TEXTURE_1D_ARRAY; | ||||
| } | } | ||||
| else if (n == 3) { | else if (n == 3) { | ||||
| Show All 29 Lines | GPUTexture *GPU_texture_create_nD( | ||||
| } | } | ||||
| glBindTexture(tex->target, tex->bindcode); | glBindTexture(tex->target, tex->bindcode); | ||||
| /* Check if texture fit in VRAM */ | /* Check if texture fit in VRAM */ | ||||
| GLenum proxy = GL_PROXY_TEXTURE_2D; | GLenum proxy = GL_PROXY_TEXTURE_2D; | ||||
| if (n == 2) { | if (n == 2) { | ||||
| if (d > 0) | if (d > 1) | ||||
| proxy = GL_PROXY_TEXTURE_2D_ARRAY; | proxy = GL_PROXY_TEXTURE_2D_ARRAY; | ||||
| } | } | ||||
| else if (n == 1) { | else if (n == 1) { | ||||
| if (h == 0) | if (h == 0) | ||||
| proxy = GL_PROXY_TEXTURE_1D; | proxy = GL_PROXY_TEXTURE_1D; | ||||
| else | else | ||||
| proxy = GL_PROXY_TEXTURE_1D_ARRAY; | proxy = GL_PROXY_TEXTURE_1D_ARRAY; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 961 Lines • Show Last 20 Lines | |||||