Blender  V2.93
util_texture.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __UTIL_TEXTURE_H__
18 #define __UTIL_TEXTURE_H__
19 
20 #include "util_transform.h"
21 
23 
24 /* Texture limits on devices. */
25 #define TEX_NUM_MAX (INT_MAX >> 4)
26 
27 /* Color to use when textures are not found. */
28 #define TEX_IMAGE_MISSING_R 1
29 #define TEX_IMAGE_MISSING_G 0
30 #define TEX_IMAGE_MISSING_B 1
31 #define TEX_IMAGE_MISSING_A 1
32 
33 /* Texture type. */
34 #define kernel_tex_type(tex) (tex & IMAGE_DATA_TYPE_MASK)
35 
36 /* Interpolation types for textures
37  * cuda also use texture space to store other objects */
38 typedef enum InterpolationType {
44 
47 
48 /* Texture types
49  * Since we store the type in the lower bits of a flat index,
50  * the shift and bit mask constant below need to be kept in sync. */
51 typedef enum ImageDataType {
62 
65 
66 /* Alpha types
67  * How to treat alpha in images. */
68 typedef enum ImageAlphaType {
74 
77 
78 #define IMAGE_DATA_TYPE_SHIFT 4
79 #define IMAGE_DATA_TYPE_MASK 0xF
80 
81 /* Extension types for textures.
82  *
83  * Defines how the image is extrapolated past its original bounds. */
84 typedef enum ExtensionType {
85  /* Cause the image to repeat horizontally and vertically. */
87  /* Extend by repeating edge pixels of the image. */
89  /* Clip to image size and set exterior pixels as transparent. */
91 
94 
95 typedef struct TextureInfo {
96  /* Pointer, offset or texture depending on device. */
98  /* Data Type */
100  /* Buffer number for OpenCL. */
102  /* Interpolation and extension type. */
104  /* Dimensions. */
106  /* Transform for 3D textures. */
110 
112 
113 #endif /* __UTIL_TEXTURE_H__ */
unsigned int uint
Definition: BLI_sys_types.h:83
#define CCL_NAMESPACE_END
unsigned __int64 uint64_t
Definition: stdint.h:93
uint64_t data
Definition: util_texture.h:97
uint data_type
Definition: util_texture.h:99
uint use_transform_3d
Definition: util_texture.h:107
uint interpolation
Definition: util_texture.h:103
Transform transform_3d
Definition: util_texture.h:108
ImageDataType
Definition: util_texture.h:51
@ IMAGE_DATA_NUM_TYPES
Definition: util_texture.h:63
@ IMAGE_DATA_TYPE_BYTE
Definition: util_texture.h:56
@ IMAGE_DATA_TYPE_FLOAT
Definition: util_texture.h:55
@ IMAGE_DATA_TYPE_FLOAT4
Definition: util_texture.h:52
@ IMAGE_DATA_TYPE_USHORT4
Definition: util_texture.h:58
@ IMAGE_DATA_TYPE_USHORT
Definition: util_texture.h:59
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT
Definition: util_texture.h:60
@ IMAGE_DATA_TYPE_NANOVDB_FLOAT3
Definition: util_texture.h:61
@ IMAGE_DATA_TYPE_HALF
Definition: util_texture.h:57
@ IMAGE_DATA_TYPE_BYTE4
Definition: util_texture.h:53
@ IMAGE_DATA_TYPE_HALF4
Definition: util_texture.h:54
ImageAlphaType
Definition: util_texture.h:68
@ IMAGE_ALPHA_ASSOCIATED
Definition: util_texture.h:70
@ IMAGE_ALPHA_CHANNEL_PACKED
Definition: util_texture.h:71
@ IMAGE_ALPHA_NUM_TYPES
Definition: util_texture.h:75
@ IMAGE_ALPHA_AUTO
Definition: util_texture.h:73
@ IMAGE_ALPHA_IGNORE
Definition: util_texture.h:72
@ IMAGE_ALPHA_UNASSOCIATED
Definition: util_texture.h:69
InterpolationType
Definition: util_texture.h:38
@ INTERPOLATION_LINEAR
Definition: util_texture.h:40
@ INTERPOLATION_SMART
Definition: util_texture.h:43
@ INTERPOLATION_NONE
Definition: util_texture.h:39
@ INTERPOLATION_CLOSEST
Definition: util_texture.h:41
@ INTERPOLATION_CUBIC
Definition: util_texture.h:42
@ INTERPOLATION_NUM_TYPES
Definition: util_texture.h:45
struct TextureInfo TextureInfo
ExtensionType
Definition: util_texture.h:84
@ EXTENSION_REPEAT
Definition: util_texture.h:86
@ EXTENSION_NUM_TYPES
Definition: util_texture.h:92
@ EXTENSION_CLIP
Definition: util_texture.h:90
@ EXTENSION_EXTEND
Definition: util_texture.h:88