Cleanup: use eGPU prefix for GPU enum types

This commit is contained in:
Campbell Barton 2019-01-23 14:15:43 +11:00
parent 14d947dcad
commit 2e4f1b592f
37 changed files with 194 additions and 194 deletions

View File

@ -194,7 +194,7 @@ void blf_batch_draw(void)
GPU_vertbuf_data_len_set(g_batch.verts, g_batch.glyph_len);
GPU_vertbuf_use(g_batch.verts); /* send data */
GPUBuiltinShader shader = (g_batch.simple_shader) ? GPU_SHADER_TEXT_SIMPLE : GPU_SHADER_TEXT;
eGPUBuiltinShader shader = (g_batch.simple_shader) ? GPU_SHADER_TEXT_SIMPLE : GPU_SHADER_TEXT;
GPU_batch_program_set_builtin(g_batch.batch, shader);
GPU_batch_uniform_1i(g_batch.batch, "glyph", 0);
GPU_batch_draw(g_batch.batch);

View File

@ -114,7 +114,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v
int buffer_size[2] = {(int)viewport_size[0] / 2, (int)viewport_size[1] / 2};
GPUTextureFormat down_format = DRW_state_draw_background() ? GPU_R11F_G11F_B10F : GPU_RGBA16F;
eGPUTextureFormat down_format = DRW_state_draw_background() ? GPU_R11F_G11F_B10F : GPU_RGBA16F;
effects->dof_down_near = DRW_texture_pool_query_2D(buffer_size[0], buffer_size[1], down_format,
&draw_engine_eevee_type);
@ -131,7 +131,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *v
});
/* Go full 32bits for rendering and reduce the color artifacts. */
GPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
eGPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
effects->dof_blur = DRW_texture_pool_query_2D(buffer_size[0] * 2, buffer_size[1], fb_format,
&draw_engine_eevee_type);

View File

@ -117,7 +117,7 @@ static void eevee_create_shader_downsample(void)
}
#define SETUP_BUFFER(tex, fb, fb_color) { \
GPUTextureFormat format = (DRW_state_is_scene_render()) ? GPU_RGBA32F : GPU_RGBA16F; \
eGPUTextureFormat format = (DRW_state_is_scene_render()) ? GPU_RGBA32F : GPU_RGBA16F; \
DRW_texture_ensure_fullscreen_2D(&tex, format, DRW_TEX_FILTER | DRW_TEX_MIPMAP); \
GPU_framebuffer_ensure_config(&fb, { \
GPU_ATTACHMENT_TEXTURE(dtxl->depth), \

View File

@ -256,7 +256,7 @@ static void eevee_draw_background(void *vedata)
DRW_uniformbuffer_update(sldata->common_ubo, &sldata->common_data);
GPU_framebuffer_bind(fbl->main_fb);
GPUFrameBufferBits clear_bits = GPU_DEPTH_BIT;
eGPUFrameBufferBits clear_bits = GPU_DEPTH_BIT;
clear_bits |= (DRW_state_draw_background()) ? 0 : GPU_COLOR_BIT;
clear_bits |= ((stl->effects->enabled_effects & EFFECT_SSS) != 0) ? GPU_STENCIL_BIT : 0;
GPU_framebuffer_clear(fbl->main_fb, clear_bits, clear_col, clear_depth, clear_stencil);

View File

@ -330,7 +330,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat
static float error_col[3] = {1.0f, 0.0f, 1.0f};
struct GPUMaterial *gpumat = EEVEE_material_world_lightprobe_get(scene, wo);
GPUMaterialStatus status = GPU_material_status(gpumat);
eGPUMaterialStatus status = GPU_material_status(gpumat);
switch (status) {
case GPU_MAT_SUCCESS:

View File

@ -528,7 +528,7 @@ void EEVEE_lights_cache_shcaster_object_add(EEVEE_ViewLayerData *sldata, Object
void EEVEE_lights_cache_finish(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
{
EEVEE_LampsInfo *linfo = sldata->lamps;
GPUTextureFormat shadow_pool_format = GPU_R32F;
eGPUTextureFormat shadow_pool_format = GPU_R32F;
sldata->common_data.la_num_light = linfo->num_light;

View File

@ -1164,14 +1164,14 @@ static void material_opaque(
scene, ma, vedata, false, false, use_ssrefract,
use_sss, use_translucency, linfo->shadow_method);
GPUMaterialStatus status_mat_surface = GPU_material_status(*gpumat);
eGPUMaterialStatus status_mat_surface = GPU_material_status(*gpumat);
/* Alpha CLipped : Discard pixel from depth pass, then
* fail the depth test for shading. */
if (ELEM(ma->blend_method, MA_BM_CLIP, MA_BM_HASHED)) {
*gpumat_depth = EEVEE_material_mesh_depth_get(scene, ma, (ma->blend_method == MA_BM_HASHED), false);
GPUMaterialStatus status_mat_depth = GPU_material_status(*gpumat_depth);
eGPUMaterialStatus status_mat_depth = GPU_material_status(*gpumat_depth);
if (status_mat_depth != GPU_MAT_SUCCESS) {
/* Mixing both flags. If depth shader fails, show it to the user by not using
* the surface shader. */

View File

@ -159,7 +159,7 @@ int EEVEE_screen_raytrace_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
int tracing_res[2] = {(int)viewport_size[0] / divisor, (int)viewport_size[1] / divisor};
int size_fs[2] = {(int)viewport_size[0], (int)viewport_size[1]};
const bool high_qual_input = true; /* TODO dither low quality input */
const GPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8;
const eGPUTextureFormat format = (high_qual_input) ? GPU_RGBA16F : GPU_RGBA8;
/* MRT for the shading pass in order to output needed data for the SSR pass. */
effects->ssr_specrough_input = DRW_texture_pool_query_2D(size_fs[0], size_fs[1], format,

View File

@ -111,7 +111,7 @@ static void GPENCIL_create_framebuffers(void *vedata)
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
/* Go full 32bits for rendering */
GPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
eGPUTextureFormat fb_format = DRW_state_is_image_render() ? GPU_RGBA32F : GPU_RGBA16F;
if (DRW_state_is_fbo()) {
const float *viewport_size = DRW_viewport_size_get();

View File

@ -409,9 +409,9 @@ void workbench_deferred_engine_init(WORKBENCH_Data *vedata)
{
const float *viewport_size = DRW_viewport_size_get();
const int size[2] = {(int)viewport_size[0], (int)viewport_size[1]};
const GPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA32F;
const GPUTextureFormat comp_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_R11F_G11F_B10F;
const GPUTextureFormat id_tex_format = OBJECT_ID_PASS_ENABLED(wpd) ? GPU_R32UI : GPU_R8;
const eGPUTextureFormat nor_tex_format = NORMAL_ENCODING_ENABLED() ? GPU_RG16 : GPU_RGBA32F;
const eGPUTextureFormat comp_tex_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_R11F_G11F_B10F;
const eGPUTextureFormat id_tex_format = OBJECT_ID_PASS_ENABLED(wpd) ? GPU_R32UI : GPU_R8;
e_data.object_id_tx = NULL;
e_data.color_buffer_tx = NULL;

View File

@ -174,7 +174,7 @@ DRWPass *workbench_taa_create_pass(WORKBENCH_Data *vedata, GPUTexture **color_bu
int previous_jitter_index = effect_info->jitter_index;
{
const GPUTextureFormat hist_buffer_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_RGBA8;
const eGPUTextureFormat hist_buffer_format = DRW_state_is_image_render() ? GPU_RGBA16F : GPU_RGBA8;
DRW_texture_ensure_fullscreen_2D(&txl->history_buffer_tx, hist_buffer_format, 0);
DRW_texture_ensure_fullscreen_2D(&txl->depth_buffer_tx, GPU_DEPTH24_STENCIL8, 0);
}

View File

@ -200,23 +200,23 @@ typedef enum {
/* Textures from DRW_texture_pool_query_* have the options
* DRW_TEX_FILTER for color float textures, and no options
* for depth textures and integer textures. */
struct GPUTexture *DRW_texture_pool_query_2D(int w, int h, GPUTextureFormat format, DrawEngineType *engine_type);
struct GPUTexture *DRW_texture_pool_query_2D(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type);
struct GPUTexture *DRW_texture_create_1D(
int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_2D(
int w, int h, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_2D_array(
int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_3D(
int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
struct GPUTexture *DRW_texture_create_cube(
int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels);
void DRW_texture_ensure_fullscreen_2D(
struct GPUTexture **tex, GPUTextureFormat format, DRWTextureFlag flags);
struct GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags);
void DRW_texture_ensure_2D(
struct GPUTexture **tex, int w, int h, GPUTextureFormat format, DRWTextureFlag flags);
struct GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags);
void DRW_texture_generate_mipmaps(struct GPUTexture *tex);
void DRW_texture_free(struct GPUTexture *tex);
@ -255,7 +255,7 @@ struct GPUShader *DRW_shader_create_with_lib(
const char *vert, const char *geom, const char *frag, const char *lib, const char *defines);
struct GPUShader *DRW_shader_create_with_transform_feedback(
const char *vert, const char *geom, const char *defines,
const GPUShaderTFBType prim_type, const char **varying_names, const int varying_count);
const eGPUShaderTFBType prim_type, const char **varying_names, const int varying_count);
struct GPUShader *DRW_shader_create_2D(const char *frag, const char *defines);
struct GPUShader *DRW_shader_create_3D(const char *frag, const char *defines);
struct GPUShader *DRW_shader_create_fullscreen(const char *frag, const char *defines);

View File

@ -363,7 +363,7 @@ GPUShader *DRW_shader_create_with_lib(
GPUShader *DRW_shader_create_with_transform_feedback(
const char *vert, const char *geom, const char *defines,
const GPUShaderTFBType prim_type, const char **varying_names, const int varying_count)
const eGPUShaderTFBType prim_type, const char **varying_names, const int varying_count)
{
return GPU_shader_create_ex(vert,
datatoc_gpu_shader_depth_only_frag_glsl,

View File

@ -30,7 +30,7 @@
#ifndef NDEBUG
/* Maybe gpu_texture.c is a better place for this. */
static bool drw_texture_format_supports_framebuffer(GPUTextureFormat format)
static bool drw_texture_format_supports_framebuffer(eGPUTextureFormat format)
{
/* Some formats do not work with framebuffers. */
switch (format) {
@ -79,7 +79,7 @@ void drw_texture_set_parameters(GPUTexture *tex, DRWTextureFlag flags)
GPU_texture_unbind(tex);
}
GPUTexture *DRW_texture_create_1D(int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture *DRW_texture_create_1D(int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_1D(w, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@ -87,7 +87,7 @@ GPUTexture *DRW_texture_create_1D(int w, GPUTextureFormat format, DRWTextureFlag
return tex;
}
GPUTexture *DRW_texture_create_2D(int w, int h, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture *DRW_texture_create_2D(int w, int h, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_2D(w, h, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@ -96,7 +96,7 @@ GPUTexture *DRW_texture_create_2D(int w, int h, GPUTextureFormat format, DRWText
}
GPUTexture *DRW_texture_create_2D_array(
int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_2D_array(w, h, d, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@ -105,7 +105,7 @@ GPUTexture *DRW_texture_create_2D_array(
}
GPUTexture *DRW_texture_create_3D(
int w, int h, int d, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
int w, int h, int d, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_3D(w, h, d, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@ -113,7 +113,7 @@ GPUTexture *DRW_texture_create_3D(
return tex;
}
GPUTexture *DRW_texture_create_cube(int w, GPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
GPUTexture *DRW_texture_create_cube(int w, eGPUTextureFormat format, DRWTextureFlag flags, const float *fpixels)
{
GPUTexture *tex = GPU_texture_create_cube(w, format, fpixels, NULL);
drw_texture_set_parameters(tex, flags);
@ -121,7 +121,7 @@ GPUTexture *DRW_texture_create_cube(int w, GPUTextureFormat format, DRWTextureFl
return tex;
}
GPUTexture *DRW_texture_pool_query_2D(int w, int h, GPUTextureFormat format, DrawEngineType *engine_type)
GPUTexture *DRW_texture_pool_query_2D(int w, int h, eGPUTextureFormat format, DrawEngineType *engine_type)
{
BLI_assert(drw_texture_format_supports_framebuffer(format));
GPUTexture *tex = GPU_viewport_texture_pool_query(DST.viewport, engine_type, w, h, format);
@ -129,7 +129,7 @@ GPUTexture *DRW_texture_pool_query_2D(int w, int h, GPUTextureFormat format, Dra
return tex;
}
void DRW_texture_ensure_fullscreen_2D(GPUTexture **tex, GPUTextureFormat format, DRWTextureFlag flags)
void DRW_texture_ensure_fullscreen_2D(GPUTexture **tex, eGPUTextureFormat format, DRWTextureFlag flags)
{
if (*(tex) == NULL) {
const float *size = DRW_viewport_size_get();
@ -137,7 +137,7 @@ void DRW_texture_ensure_fullscreen_2D(GPUTexture **tex, GPUTextureFormat format,
}
}
void DRW_texture_ensure_2D(GPUTexture **tex, int w, int h, GPUTextureFormat format, DRWTextureFlag flags)
void DRW_texture_ensure_2D(GPUTexture **tex, int w, int h, eGPUTextureFormat format, DRWTextureFlag flags)
{
if (*(tex) == NULL) {
*(tex) = DRW_texture_create_2D(w, h, format, flags, NULL);

View File

@ -1311,7 +1311,7 @@ static void icon_draw_rect(float x, float y, int w, int h, float UNUSED(aspect),
}
/* draw */
GPUBuiltinShader shader;
eGPUBuiltinShader shader;
if (desaturate != 0.0f) {
shader = GPU_SHADER_2D_IMAGE_DESATURATE_COLOR;
}

View File

@ -123,7 +123,7 @@ int GPU_batch_vertbuf_add_ex(GPUBatch *, GPUVertBuf *, bool own_vbo);
void GPU_batch_program_set_no_use(GPUBatch *, uint32_t program, const GPUShaderInterface *);
void GPU_batch_program_set(GPUBatch *, uint32_t program, const GPUShaderInterface *);
void GPU_batch_program_set_builtin(GPUBatch *batch, GPUBuiltinShader shader_id);
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id);
/* Entire batch draws with one shader program, but can be redrawn later with another program. */
/* Vertex shader's inputs must be compatible with the batch's vertex format. */

View File

@ -63,7 +63,7 @@ void GPU_code_generate_glsl_lib(void);
/* GPU Types */
typedef enum GPUDeviceType {
typedef enum eGPUDeviceType {
GPU_DEVICE_NVIDIA = (1 << 0),
GPU_DEVICE_ATI = (1 << 1),
GPU_DEVICE_INTEL = (1 << 2),
@ -71,23 +71,23 @@ typedef enum GPUDeviceType {
GPU_DEVICE_SOFTWARE = (1 << 4),
GPU_DEVICE_UNKNOWN = (1 << 5),
GPU_DEVICE_ANY = (0xff),
} GPUDeviceType;
} eGPUDeviceType;
typedef enum GPUOSType {
typedef enum eGPUOSType {
GPU_OS_WIN = (1 << 8),
GPU_OS_MAC = (1 << 9),
GPU_OS_UNIX = (1 << 10),
GPU_OS_ANY = (0xff00),
} GPUOSType;
} eGPUOSType;
typedef enum GPUDriverType {
typedef enum eGPUDriverType {
GPU_DRIVER_OFFICIAL = (1 << 16),
GPU_DRIVER_OPENSOURCE = (1 << 17),
GPU_DRIVER_SOFTWARE = (1 << 18),
GPU_DRIVER_ANY = (0xff0000),
} GPUDriverType;
} eGPUDriverType;
bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver);
bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver);
#ifdef __cplusplus
}

View File

@ -43,11 +43,11 @@ typedef struct GPUAttachment {
int mip, layer;
} GPUAttachment;
typedef enum GPUFrameBufferBits {
typedef enum eGPUFrameBufferBits {
GPU_COLOR_BIT = (1 << 0),
GPU_DEPTH_BIT = (1 << 1),
GPU_STENCIL_BIT = (1 << 2),
} GPUFrameBufferBits;
} eGPUFrameBufferBits;
typedef struct GPUFrameBuffer GPUFrameBuffer;
typedef struct GPUOffScreen GPUOffScreen;
@ -140,7 +140,7 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *fb, const GPUAttachment *confi
void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h);
void GPU_framebuffer_clear(
GPUFrameBuffer *fb, GPUFrameBufferBits buffers,
GPUFrameBuffer *fb, eGPUFrameBufferBits buffers,
const float clear_col[4], float clear_depth, unsigned int clear_stencil);
#define GPU_framebuffer_clear_color(fb, col) \
@ -168,7 +168,7 @@ void GPU_framebuffer_read_color(
void GPU_framebuffer_blit(
GPUFrameBuffer *fb_read, int read_slot,
GPUFrameBuffer *fb_write, int write_slot,
GPUFrameBufferBits blit_buffers);
eGPUFrameBufferBits blit_buffers);
void GPU_framebuffer_recursive_downsample(
GPUFrameBuffer *fb, int max_lvl,
@ -195,7 +195,7 @@ void GPU_offscreen_viewport_data_get(
GPUFrameBuffer **r_fb, struct GPUTexture **r_color, struct GPUTexture **r_depth);
void GPU_clear_color(float red, float green, float blue, float alpha);
void GPU_clear(GPUFrameBufferBits flags);
void GPU_clear(eGPUFrameBufferBits flags);
#ifdef __cplusplus
}

View File

@ -128,7 +128,7 @@ void immUniformColor4ubv(const unsigned char rgba[4]);
/* Extend immBindProgram to use Blenders library of built-in shader programs.
* Use immUnbindProgram() when done. */
void immBindBuiltinProgram(GPUBuiltinShader shader_id);
void immBindBuiltinProgram(eGPUBuiltinShader shader_id);
/* Extend immUniformColor to take Blender's themes */
void immUniformThemeColor(int color_id);

View File

@ -68,7 +68,7 @@ typedef struct GPUParticleInfo GPUParticleInfo;
/* Functions to create GPU Materials nodes */
typedef enum GPUType {
typedef enum eGPUType {
/* Keep in sync with GPU_DATATYPE_STR */
/* The value indicates the number of elements in each type */
GPU_NONE = 0,
@ -91,9 +91,9 @@ typedef enum GPUType {
/* Opengl Attributes */
GPU_ATTRIB = 3001,
} GPUType;
} eGPUType;
typedef enum GPUBuiltin {
typedef enum eGPUBuiltin {
GPU_VIEW_MATRIX = (1 << 0),
GPU_OBJECT_MATRIX = (1 << 1),
GPU_INVERSE_VIEW_MATRIX = (1 << 2),
@ -115,26 +115,26 @@ typedef enum GPUBuiltin {
GPU_VOLUME_TEMPERATURE = (1 << 18),
GPU_BARYCENTRIC_TEXCO = (1 << 19),
GPU_BARYCENTRIC_DIST = (1 << 20),
} GPUBuiltin;
} eGPUBuiltin;
typedef enum GPUMatFlag {
typedef enum eGPUMatFlag {
GPU_MATFLAG_DIFFUSE = (1 << 0),
GPU_MATFLAG_GLOSSY = (1 << 1),
GPU_MATFLAG_REFRACT = (1 << 2),
GPU_MATFLAG_SSS = (1 << 3),
} GPUMatFlag;
} eGPUMatFlag;
typedef enum GPUBlendMode {
typedef enum eGPUBlendMode {
GPU_BLEND_SOLID = 0,
GPU_BLEND_ADD = 1,
GPU_BLEND_ALPHA = 2,
GPU_BLEND_CLIP = 4,
GPU_BLEND_ALPHA_SORT = 8,
GPU_BLEND_ALPHA_TO_COVERAGE = 16,
} GPUBlendMode;
} eGPUBlendMode;
typedef struct GPUNodeStack {
GPUType type;
eGPUType type;
float vec[4];
struct GPUNodeLink *link;
bool hasinput;
@ -143,18 +143,18 @@ typedef struct GPUNodeStack {
bool end;
} GPUNodeStack;
typedef enum GPUMaterialStatus {
typedef enum eGPUMaterialStatus {
GPU_MAT_FAILED = 0,
GPU_MAT_QUEUED,
GPU_MAT_SUCCESS,
} GPUMaterialStatus;
} eGPUMaterialStatus;
GPUNodeLink *GPU_attribute(CustomDataType type, const char *name);
GPUNodeLink *GPU_constant(float *num);
GPUNodeLink *GPU_uniform(float *num);
GPUNodeLink *GPU_image(struct Image *ima, struct ImageUser *iuser, bool is_data);
GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *layer);
GPUNodeLink *GPU_builtin(GPUBuiltin builtin);
GPUNodeLink *GPU_builtin(eGPUBuiltin builtin);
bool GPU_link(GPUMaterial *mat, const char *name, ...);
bool GPU_stack_link(GPUMaterial *mat, struct bNode *node, const char *name, GPUNodeStack *in, GPUNodeStack *out, ...);
@ -163,7 +163,7 @@ GPUNodeLink *GPU_uniformbuffer_link_out(
struct GPUNodeStack *stack, const int index);
void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link);
GPUBuiltin GPU_get_material_builtins(GPUMaterial *material);
eGPUBuiltin GPU_get_material_builtins(GPUMaterial *material);
void GPU_material_sss_profile_create(GPUMaterial *material, float radii[3], short *falloff_type, float *sharpness);
struct GPUUniformBuffer *GPU_material_sss_profile_get(
@ -183,7 +183,7 @@ void GPU_materials_free(struct Main *bmain);
struct Scene *GPU_material_scene(GPUMaterial *material);
struct GPUPass *GPU_material_get_pass(GPUMaterial *material);
struct ListBase *GPU_material_get_inputs(GPUMaterial *material);
GPUMaterialStatus GPU_material_status(GPUMaterial *mat);
eGPUMaterialStatus GPU_material_status(GPUMaterial *mat);
struct GPUUniformBuffer *GPU_material_uniform_buffer_get(GPUMaterial *material);
void GPU_material_uniform_buffer_create(GPUMaterial *material, ListBase *inputs);
@ -197,8 +197,8 @@ bool GPU_material_do_color_management(GPUMaterial *mat);
bool GPU_material_use_domain_surface(GPUMaterial *mat);
bool GPU_material_use_domain_volume(GPUMaterial *mat);
void GPU_material_flag_set(GPUMaterial *mat, GPUMatFlag flag);
bool GPU_material_flag_get(GPUMaterial *mat, GPUMatFlag flag);
void GPU_material_flag_set(GPUMaterial *mat, eGPUMatFlag flag);
bool GPU_material_flag_get(GPUMaterial *mat, eGPUMatFlag flag);
void GPU_pass_cache_init(void);
void GPU_pass_cache_garbage_collect(void);

View File

@ -44,12 +44,12 @@ struct GPUUniformBuffer;
* - only for fragment shaders now
* - must call texture bind before setting a texture as uniform! */
typedef enum GPUShaderTFBType {
typedef enum eGPUShaderTFBType {
GPU_SHADER_TFB_NONE = 0, /* Transform feedback unsupported. */
GPU_SHADER_TFB_POINTS = 1,
GPU_SHADER_TFB_LINES = 2,
GPU_SHADER_TFB_TRIANGLES = 3,
} GPUShaderTFBType;
} eGPUShaderTFBType;
GPUShader *GPU_shader_create(
const char *vertexcode,
@ -64,7 +64,7 @@ GPUShader *GPU_shader_create_ex(
const char *geocode,
const char *libcode,
const char *defines,
const GPUShaderTFBType tf_type,
const eGPUShaderTFBType tf_type,
const char **tf_names,
const int tf_count,
const char *shader_name);
@ -100,7 +100,7 @@ void GPU_shader_uniform_int(GPUShader *shader, int location, int value);
int GPU_shader_get_attribute(GPUShader *shader, const char *name);
/* Builtin/Non-generated shaders */
typedef enum GPUBuiltinShader {
typedef enum eGPUBuiltinShader {
/* specialized drawing */
GPU_SHADER_TEXT,
GPU_SHADER_TEXT_SIMPLE,
@ -358,22 +358,22 @@ typedef enum GPUBuiltinShader {
GPU_SHADER_3D_UNIFORM_SELECT_ID,
GPU_NUM_BUILTIN_SHADERS /* (not an actual shader) */
} GPUBuiltinShader;
} eGPUBuiltinShader;
/** Keep these in sync with:
* - `gpu_shader_image_interlace_frag.glsl`
* - `gpu_shader_image_rect_interlace_frag.glsl`
*/
typedef enum GPUInterlaceShader {
typedef enum eGPUInterlaceShader {
GPU_SHADER_INTERLACE_ROW = 0,
GPU_SHADER_INTERLACE_COLUMN = 1,
GPU_SHADER_INTERLACE_CHECKER = 2,
} GPUInterlaceShader;
} eGPUInterlaceShader;
GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader);
GPUShader *GPU_shader_get_builtin_shader(eGPUBuiltinShader shader);
void GPU_shader_get_builtin_shader_code(
GPUBuiltinShader shader,
eGPUBuiltinShader shader,
const char **r_vert, const char **r_frag,
const char **r_geom, const char **r_defines);

View File

@ -28,25 +28,25 @@
#define __GPU_STATE_H__
/* These map directly to the GL_ blend functions, to minimize API add as needed*/
typedef enum GPUBlendFunction {
typedef enum eGPUBlendFunction {
GPU_ONE,
GPU_SRC_ALPHA,
GPU_ONE_MINUS_SRC_ALPHA,
GPU_DST_COLOR,
GPU_ZERO,
} GPUBlendFunction;
} eGPUBlendFunction;
/* These map directly to the GL_ filter functions, to minimize API add as needed*/
typedef enum GPUFilterFunction {
typedef enum eGPUFilterFunction {
GPU_NEAREST,
GPU_LINEAR
} GPUFilterFunction;
} eGPUFilterFunction;
void GPU_blend(bool enable);
void GPU_blend_set_func(GPUBlendFunction sfactor, GPUBlendFunction dfactor);
void GPU_blend_set_func(eGPUBlendFunction sfactor, eGPUBlendFunction dfactor);
void GPU_blend_set_func_separate(
GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb,
GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha);
eGPUBlendFunction src_rgb, eGPUBlendFunction dst_rgb,
eGPUBlendFunction src_alpha, eGPUBlendFunction dst_alpha);
void GPU_depth_range(float near, float far);
void GPU_depth_test(bool enable);
bool GPU_depth_test_enabled(void);

View File

@ -63,7 +63,7 @@ typedef struct GPUTexture GPUTexture;
* are not supported by renderbuffers. All of the following formats
* are part of the OpenGL 3.3 core
* specification. */
typedef enum GPUTextureFormat {
typedef enum eGPUTextureFormat {
/* Formats texture & renderbuffer */
GPU_RGBA8UI,
GPU_RGBA8I,
@ -142,57 +142,57 @@ typedef enum GPUTextureFormat {
GPU_DEPTH_COMPONENT32F,
GPU_DEPTH_COMPONENT24,
GPU_DEPTH_COMPONENT16,
} GPUTextureFormat;
} eGPUTextureFormat;
typedef enum GPUDataFormat {
typedef enum eGPUDataFormat {
GPU_DATA_FLOAT,
GPU_DATA_INT,
GPU_DATA_UNSIGNED_INT,
GPU_DATA_UNSIGNED_BYTE,
GPU_DATA_UNSIGNED_INT_24_8,
GPU_DATA_10_11_11_REV,
} GPUDataFormat;
} eGPUDataFormat;
unsigned int GPU_texture_memory_usage_get(void);
/* TODO make it static function again. (create function with GPUDataFormat exposed) */
/* TODO make it static function again. (create function with eGPUDataFormat exposed) */
GPUTexture *GPU_texture_create_nD(
int w, int h, int d, int n, const void *pixels,
GPUTextureFormat tex_format, GPUDataFormat gpu_data_format, int samples,
eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format, int samples,
const bool can_rescale, char err_out[256]);
GPUTexture *GPU_texture_create_1D(
int w, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
int w, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_1D_array(
int w, int h, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
int w, int h, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_2D(
int w, int h, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
int w, int h, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_2D_multisample(
int w, int h, GPUTextureFormat data_type, const float *pixels, int samples, char err_out[256]);
int w, int h, eGPUTextureFormat data_type, const float *pixels, int samples, char err_out[256]);
GPUTexture *GPU_texture_create_2D_array(
int w, int h, int d, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
int w, int h, int d, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_3D(
int w, int h, int d, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
int w, int h, int d, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_cube(
int w, GPUTextureFormat data_type, const float *pixels, char err_out[256]);
int w, eGPUTextureFormat data_type, const float *pixels, char err_out[256]);
GPUTexture *GPU_texture_create_from_vertbuf(
struct GPUVertBuf *vert);
GPUTexture *GPU_texture_create_buffer(
GPUTextureFormat data_type, const uint buffer);
eGPUTextureFormat data_type, const uint buffer);
GPUTexture *GPU_texture_from_bindcode(int textarget, int bindcode);
GPUTexture *GPU_texture_from_blender(
struct Image *ima, struct ImageUser *iuser, int textarget, bool is_data, double time);
GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap);
void GPU_texture_add_mipmap(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl, const void *pixels);
void GPU_texture_add_mipmap(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl, const void *pixels);
void GPU_texture_update(GPUTexture *tex, GPUDataFormat data_format, const void *pixels);
void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *pixels);
void GPU_texture_update_sub(
GPUTexture *tex, GPUDataFormat gpu_data_format, const void *pixels,
GPUTexture *tex, eGPUDataFormat gpu_data_format, const void *pixels,
int offset_x, int offset_y, int offset_z, int width, int height, int depth);
void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl);
void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl);
void GPU_invalid_tex_init(void);
void GPU_invalid_tex_bind(int mode);
@ -210,7 +210,7 @@ void GPU_texture_compare_mode(GPUTexture *tex, bool use_compare);
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter);
void GPU_texture_mipmap_mode(GPUTexture *tex, bool use_mipmap, bool use_filter);
void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat);
void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter);
void GPU_texture_filters(GPUTexture *tex, eGPUFilterFunction min_filter, eGPUFilterFunction mag_filter);
void GPU_texture_attach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb, int attachment);
int GPU_texture_detach_framebuffer(GPUTexture *tex, struct GPUFrameBuffer *fb);
@ -219,7 +219,7 @@ int GPU_texture_target(const GPUTexture *tex);
int GPU_texture_width(const GPUTexture *tex);
int GPU_texture_height(const GPUTexture *tex);
int GPU_texture_layers(const GPUTexture *tex);
GPUTextureFormat GPU_texture_format(const GPUTexture *tex);
eGPUTextureFormat GPU_texture_format(const GPUTexture *tex);
int GPU_texture_samples(const GPUTexture *tex);
bool GPU_texture_cube(const GPUTexture *tex);
bool GPU_texture_depth(const GPUTexture *tex);

View File

@ -670,7 +670,7 @@ void GPU_draw_primitive(GPUPrimType prim_type, int v_count)
/** \name Utilities
* \{ */
void GPU_batch_program_set_builtin(GPUBatch *batch, GPUBuiltinShader shader_id)
void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id)
{
GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
GPU_batch_program_set(batch, shader->program, shader->interface);

View File

@ -146,12 +146,12 @@ typedef enum {
typedef struct GPUFunction {
char name[MAX_FUNCTION_NAME];
GPUType paramtype[MAX_PARAMETER];
eGPUType paramtype[MAX_PARAMETER];
GPUFunctionQual paramqual[MAX_PARAMETER];
int totparam;
} GPUFunction;
/* Indices match the GPUType enum */
/* Indices match the eGPUType enum */
static const char *GPU_DATATYPE_STR[17] = {
"", "float", "vec2", "vec3", "vec4",
NULL, NULL, NULL, NULL, "mat3", NULL, NULL, NULL, NULL, NULL, NULL, "mat4"
@ -215,7 +215,7 @@ static char *gpu_str_skip_token(char *str, char *token, int max)
static void gpu_parse_functions_string(GHash *hash, char *code)
{
GPUFunction *function;
GPUType type;
eGPUType type;
GPUFunctionQual qual;
int i;
@ -442,7 +442,7 @@ static void codegen_convert_datatype(DynStr *ds, int from, int to, const char *t
}
}
static void codegen_print_datatype(DynStr *ds, const GPUType type, float *data)
static void codegen_print_datatype(DynStr *ds, const eGPUType type, float *data)
{
int i;
@ -465,7 +465,7 @@ static int codegen_input_has_texture(GPUInput *input)
return (input->source == GPU_SOURCE_TEX);
}
const char *GPU_builtin_name(GPUBuiltin builtin)
const char *GPU_builtin_name(eGPUBuiltin builtin)
{
if (builtin == GPU_VIEW_MATRIX)
return "unfviewmat";
@ -1321,7 +1321,7 @@ static GPUNode *GPU_node_begin(const char *name)
return node;
}
static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType type)
static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const eGPUType type)
{
GPUInput *input;
GPUNode *outnode;
@ -1474,7 +1474,7 @@ static void gpu_node_input_socket(GPUMaterial *material, bNode *bnode, GPUNode *
}
}
static void gpu_node_output(GPUNode *node, const GPUType type, GPUNodeLink **link)
static void gpu_node_output(GPUNode *node, const eGPUType type, GPUNodeLink **link)
{
GPUOutput *output = MEM_callocN(sizeof(GPUOutput), "GPUOutput");
@ -1627,7 +1627,7 @@ GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *ro
return link;
}
GPUNodeLink *GPU_builtin(GPUBuiltin builtin)
GPUNodeLink *GPU_builtin(eGPUBuiltin builtin)
{
GPUNodeLink *link = GPU_node_link_create();
link->link_type = GPU_NODE_LINK_BUILTIN;

View File

@ -51,7 +51,7 @@ struct PreviewImage;
* at the end if used.
*/
typedef enum GPUDataSource {
typedef enum eGPUDataSource {
GPU_SOURCE_OUTPUT,
GPU_SOURCE_CONSTANT,
GPU_SOURCE_UNIFORM,
@ -59,7 +59,7 @@ typedef enum GPUDataSource {
GPU_SOURCE_BUILTIN,
GPU_SOURCE_STRUCT,
GPU_SOURCE_TEX,
} GPUDataSource;
} eGPUDataSource;
typedef enum {
GPU_NODE_LINK_NONE = 0,
@ -94,7 +94,7 @@ struct GPUNodeLink {
/* GPU_NODE_LINK_CONSTANT | GPU_NODE_LINK_UNIFORM */
float *data;
/* GPU_NODE_LINK_BUILTIN */
GPUBuiltin builtin;
eGPUBuiltin builtin;
/* GPU_NODE_LINK_COLORBAND */
struct GPUTexture **coba;
/* GPU_NODE_LINK_OUTPUT */
@ -117,7 +117,7 @@ typedef struct GPUOutput {
struct GPUOutput *next, *prev;
GPUNode *node;
GPUType type; /* data type = length of vector/matrix */
eGPUType type; /* data type = length of vector/matrix */
GPUNodeLink *link; /* output link */
int id; /* unique id as created by code generator */
} GPUOutput;
@ -126,21 +126,21 @@ typedef struct GPUInput {
struct GPUInput *next, *prev;
GPUNode *node;
GPUType type; /* datatype */
eGPUType type; /* datatype */
GPUNodeLink *link;
int id; /* unique id as created by code generator */
GPUDataSource source; /* data source */
eGPUDataSource source; /* data source */
int shaderloc; /* id from opengl */
char shadername[32]; /* name in shader */
/* Content based on GPUDataSource */
/* Content based on eGPUDataSource */
union {
/* GPU_SOURCE_CONSTANT | GPU_SOURCE_UNIFORM */
float vec[16]; /* vector data */
/* GPU_SOURCE_BUILTIN */
GPUBuiltin builtin; /* builtin uniform */
eGPUBuiltin builtin; /* builtin uniform */
/* GPU_SOURCE_TEX */
struct {
struct GPUTexture **coba; /* input texture, only set at runtime */
@ -149,7 +149,7 @@ typedef struct GPUInput {
bool image_isdata; /* image does not contain color data */
bool bindtex; /* input is responsible for binding the texture? */
int texid; /* number for multitexture, starting from zero */
GPUType textype; /* texture type (2D, 1D Array ...) */
eGPUType textype; /* texture type (2D, 1D Array ...) */
};
/* GPU_SOURCE_ATTRIB */
struct {
@ -200,7 +200,7 @@ void gpu_codegen_exit(void);
/* Material calls */
const char *GPU_builtin_name(GPUBuiltin builtin);
const char *GPU_builtin_name(eGPUBuiltin builtin);
void gpu_material_add_node(struct GPUMaterial *material, struct GPUNode *node);
struct GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, float *pixels, float *row);

View File

@ -916,7 +916,7 @@ static GPUTexture *create_density_texture(SmokeDomainSettings *sds, int highres)
int cell_count = (highres) ? smoke_turbulence_get_cells(sds->wt) : sds->total_cells;
const bool has_color = (highres) ? smoke_turbulence_has_colors(sds->wt) : smoke_has_colors(sds->fluid);
int *dim = (highres) ? sds->res_wt : sds->res;
GPUTextureFormat format = (has_color) ? GPU_RGBA8 : GPU_R8;
eGPUTextureFormat format = (has_color) ? GPU_RGBA8 : GPU_R8;
if (has_color) {
data = MEM_callocN(sizeof(float) * cell_count * 4, "smokeColorTexture");

View File

@ -77,9 +77,9 @@ static struct GPUGlobal {
GLint maxubobinds;
int colordepth;
int samples_color_texture_max;
GPUDeviceType device;
GPUOSType os;
GPUDriverType driver;
eGPUDeviceType device;
eGPUOSType os;
eGPUDriverType driver;
float line_width_range[2];
/* workaround for different calculation of dfdy factors on GPUs. Some GPUs/drivers
* calculate dfdy in shader differently when drawing to an offscreen buffer. First
@ -132,7 +132,7 @@ static void gpu_detect_mip_render_workaround(void)
/* GPU Types */
bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver)
bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver)
{
return (GG.device & device) && (GG.os & os) && (GG.driver & driver);
}

View File

@ -108,7 +108,7 @@ static GPUAttachmentType attachment_type_from_tex(GPUTexture *tex, int slot)
}
}
static GLenum convert_buffer_bits_to_gl(GPUFrameBufferBits bits)
static GLenum convert_buffer_bits_to_gl(eGPUFrameBufferBits bits)
{
GLbitfield mask = 0;
mask |= (bits & GPU_DEPTH_BIT) ? GL_DEPTH_BUFFER_BIT : 0;
@ -576,7 +576,7 @@ void GPU_framebuffer_viewport_set(GPUFrameBuffer *fb, int x, int y, int w, int h
}
void GPU_framebuffer_clear(
GPUFrameBuffer *fb, GPUFrameBufferBits buffers,
GPUFrameBuffer *fb, eGPUFrameBufferBits buffers,
const float clear_col[4], float clear_depth, uint clear_stencil)
{
CHECK_FRAMEBUFFER_IS_BOUND(fb);
@ -630,7 +630,7 @@ void GPU_framebuffer_read_color(
void GPU_framebuffer_blit(
GPUFrameBuffer *fb_read, int read_slot,
GPUFrameBuffer *fb_write, int write_slot,
GPUFrameBufferBits blit_buffers)
eGPUFrameBufferBits blit_buffers)
{
BLI_assert(blit_buffers != 0);
@ -967,7 +967,7 @@ void GPU_clear_color(float red, float green, float blue, float alpha)
glClearColor(red, green, blue, alpha);
}
void GPU_clear(GPUFrameBufferBits flags)
void GPU_clear(eGPUFrameBufferBits flags)
{
glClear(convert_buffer_bits_to_gl(flags));
}

View File

@ -154,7 +154,7 @@ void immBindProgram(GLuint program, const GPUShaderInterface *shaderface)
GPU_matrix_bind(shaderface);
}
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
{
GPUShader *shader = GPU_shader_get_builtin_shader(shader_id);
immBindProgram(shader->program, shader->interface);

View File

@ -70,7 +70,7 @@ struct GPUMaterial {
Scene *scene; /* DEPRECATED was only useful for lamps */
Material *ma;
GPUMaterialStatus status;
eGPUMaterialStatus status;
const void *engine_type; /* attached engine type */
int options; /* to identify shader variations (shadow, probe, world background...) */
@ -215,7 +215,7 @@ void GPU_material_free(ListBase *gpumaterial)
BLI_freelistN(gpumaterial);
}
GPUBuiltin GPU_get_material_builtins(GPUMaterial *material)
eGPUBuiltin GPU_get_material_builtins(GPUMaterial *material)
{
return material->builtins;
}
@ -586,7 +586,7 @@ void gpu_material_add_node(GPUMaterial *material, GPUNode *node)
}
/* Return true if the material compilation has not yet begin or begin. */
GPUMaterialStatus GPU_material_status(GPUMaterial *mat)
eGPUMaterialStatus GPU_material_status(GPUMaterial *mat)
{
return mat->status;
}
@ -611,12 +611,12 @@ bool GPU_material_use_domain_volume(GPUMaterial *mat)
return (mat->domain & GPU_DOMAIN_VOLUME);
}
void GPU_material_flag_set(GPUMaterial *mat, GPUMatFlag flag)
void GPU_material_flag_set(GPUMaterial *mat, eGPUMatFlag flag)
{
mat->flag |= flag;
}
bool GPU_material_flag_get(GPUMaterial *mat, GPUMatFlag flag)
bool GPU_material_flag_get(GPUMaterial *mat, eGPUMatFlag flag)
{
return (mat->flag & flag);
}

View File

@ -339,7 +339,7 @@ GPUShader *GPU_shader_create_ex(
const char *geocode,
const char *libcode,
const char *defines,
const GPUShaderTFBType tf_type,
const eGPUShaderTFBType tf_type,
const char **tf_names,
const int tf_count,
const char *shname)
@ -971,7 +971,7 @@ static const GPUShaderStages builtin_shader_stages[GPU_NUM_BUILTIN_SHADERS] = {
/* just a few special cases */
static const char *gpu_shader_get_builtin_shader_defines(
GPUBuiltinShader shader)
eGPUBuiltinShader shader)
{
switch (shader) {
case GPU_SHADER_2D_IMAGE_MULTISAMPLE_2:
@ -1036,7 +1036,7 @@ static const char *gpu_shader_get_builtin_shader_defines(
}
}
GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
GPUShader *GPU_shader_get_builtin_shader(eGPUBuiltinShader shader)
{
BLI_assert(shader != GPU_NUM_BUILTIN_SHADERS); /* don't be a troll */
@ -1072,7 +1072,7 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
}
void GPU_shader_get_builtin_shader_code(
GPUBuiltinShader shader,
eGPUBuiltinShader shader,
const char **r_vert, const char **r_frag,
const char **r_geom, const char **r_defines)
{

View File

@ -31,7 +31,7 @@
#include "GPU_state.h"
#include "GPU_extensions.h"
static GLenum gpu_get_gl_blendfunction(GPUBlendFunction blend)
static GLenum gpu_get_gl_blendfunction(eGPUBlendFunction blend)
{
switch (blend) {
case GPU_ONE:
@ -60,14 +60,14 @@ void GPU_blend(bool enable)
}
}
void GPU_blend_set_func(GPUBlendFunction sfactor, GPUBlendFunction dfactor)
void GPU_blend_set_func(eGPUBlendFunction sfactor, eGPUBlendFunction dfactor)
{
glBlendFunc(gpu_get_gl_blendfunction(sfactor), gpu_get_gl_blendfunction(dfactor));
}
void GPU_blend_set_func_separate(
GPUBlendFunction src_rgb, GPUBlendFunction dst_rgb,
GPUBlendFunction src_alpha, GPUBlendFunction dst_alpha)
eGPUBlendFunction src_rgb, eGPUBlendFunction dst_rgb,
eGPUBlendFunction src_alpha, eGPUBlendFunction dst_alpha)
{
glBlendFuncSeparate(
gpu_get_gl_blendfunction(src_rgb),

View File

@ -57,7 +57,7 @@ static struct GPUTextureGlobal {
/* Maximum number of FBOs a texture can be attached to. */
#define GPU_TEX_MAX_FBO_ATTACHED 10
typedef enum GPUTextureFormatFlag {
typedef enum eGPUTextureFormatFlag {
GPU_FORMAT_DEPTH = (1 << 0),
GPU_FORMAT_STENCIL = (1 << 1),
GPU_FORMAT_INTEGER = (1 << 2),
@ -68,7 +68,7 @@ typedef enum GPUTextureFormatFlag {
GPU_FORMAT_3D = (1 << 12),
GPU_FORMAT_CUBE = (1 << 13),
GPU_FORMAT_ARRAY = (1 << 14),
} GPUTextureFormatFlag;
} eGPUTextureFormatFlag;
/* GPUTexture */
struct GPUTexture {
@ -80,8 +80,8 @@ struct GPUTexture {
* use it for unbinding */
GLuint bindcode; /* opengl identifier for texture */
GPUTextureFormat format;
GPUTextureFormatFlag format_flag;
eGPUTextureFormat format;
eGPUTextureFormatFlag format_flag;
uint bytesize; /* number of byte for one pixel */
int components; /* number of color/alpha channels */
@ -178,7 +178,7 @@ static const char *gl_enum_to_str(GLenum e)
return enum_strings[e];
}
static int gpu_get_component_count(GPUTextureFormat format)
static int gpu_get_component_count(eGPUTextureFormat format)
{
switch (format) {
case GPU_RGBA8:
@ -203,7 +203,7 @@ static int gpu_get_component_count(GPUTextureFormat format)
}
/* Definitely not complete, edit according to the gl specification. */
static void gpu_validate_data_format(GPUTextureFormat tex_format, GPUDataFormat data_format)
static void gpu_validate_data_format(eGPUTextureFormat tex_format, eGPUDataFormat data_format)
{
(void)data_format;
@ -245,7 +245,7 @@ static void gpu_validate_data_format(GPUTextureFormat tex_format, GPUDataFormat
}
}
static GPUDataFormat gpu_get_data_format_from_tex_format(GPUTextureFormat tex_format)
static eGPUDataFormat gpu_get_data_format_from_tex_format(eGPUTextureFormat tex_format)
{
if (ELEM(tex_format,
GPU_DEPTH_COMPONENT24,
@ -285,7 +285,7 @@ static GPUDataFormat gpu_get_data_format_from_tex_format(GPUTextureFormat tex_fo
}
/* Definitely not complete, edit according to the gl specification. */
static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormatFlag *format_flag)
static GLenum gpu_get_gl_dataformat(eGPUTextureFormat data_type, eGPUTextureFormatFlag *format_flag)
{
if (ELEM(data_type,
GPU_DEPTH_COMPONENT24,
@ -335,7 +335,7 @@ static GLenum gpu_get_gl_dataformat(GPUTextureFormat data_type, GPUTextureFormat
return GL_RGBA;
}
static uint gpu_get_bytesize(GPUTextureFormat data_type)
static uint gpu_get_bytesize(eGPUTextureFormat data_type)
{
switch (data_type) {
case GPU_RGBA32F:
@ -379,7 +379,7 @@ static uint gpu_get_bytesize(GPUTextureFormat data_type)
}
}
static GLenum gpu_get_gl_internalformat(GPUTextureFormat format)
static GLenum gpu_get_gl_internalformat(eGPUTextureFormat format)
{
/* You can add any of the available type to this list
* For available types see GPU_texture.h */
@ -424,7 +424,7 @@ static GLenum gpu_get_gl_internalformat(GPUTextureFormat format)
}
}
static GLenum gpu_get_gl_datatype(GPUDataFormat format)
static GLenum gpu_get_gl_datatype(eGPUDataFormat format)
{
switch (format) {
case GPU_DATA_FLOAT:
@ -592,7 +592,7 @@ static bool gpu_texture_try_alloc(
GPUTexture *GPU_texture_create_nD(
int w, int h, int d, int n, const void *pixels,
GPUTextureFormat tex_format, GPUDataFormat gpu_data_format, int samples,
eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format, int samples,
const bool can_rescale, char err_out[256])
{
if (samples) {
@ -765,7 +765,7 @@ static GPUTexture *GPU_texture_cube_create(
int w, int d,
const float *fpixels_px, const float *fpixels_py, const float *fpixels_pz,
const float *fpixels_nx, const float *fpixels_ny, const float *fpixels_nz,
GPUTextureFormat tex_format, GPUDataFormat gpu_data_format,
eGPUTextureFormat tex_format, eGPUDataFormat gpu_data_format,
char err_out[256])
{
GPUTexture *tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
@ -851,7 +851,7 @@ static GPUTexture *GPU_texture_cube_create(
}
/* Special buffer textures. tex_format must be compatible with the buffer content. */
GPUTexture *GPU_texture_create_buffer(GPUTextureFormat tex_format, const GLuint buffer)
GPUTexture *GPU_texture_create_buffer(eGPUTextureFormat tex_format, const GLuint buffer)
{
GPUTexture *tex = MEM_callocN(sizeof(GPUTexture), "GPUTexture");
tex->number = -1;
@ -992,49 +992,49 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
}
GPUTexture *GPU_texture_create_1D(
int w, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
int w, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, 0, 0, 1, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_1D_array(
int w, int h, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, 0, 1, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_2D(
int w, int h, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
int w, int h, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_2D_multisample(
int w, int h, GPUTextureFormat tex_format, const float *pixels, int samples, char err_out[256])
int w, int h, eGPUTextureFormat tex_format, const float *pixels, int samples, char err_out[256])
{
GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, 0, 2, pixels, tex_format, data_format, samples, false, err_out);
}
GPUTexture *GPU_texture_create_2D_array(
int w, int h, int d, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, d, 2, pixels, tex_format, data_format, 0, false, err_out);
}
GPUTexture *GPU_texture_create_3D(
int w, int h, int d, GPUTextureFormat tex_format, const float *pixels, char err_out[256])
int w, int h, int d, eGPUTextureFormat tex_format, const float *pixels, char err_out[256])
{
GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex_format);
return GPU_texture_create_nD(w, h, d, 3, pixels, tex_format, data_format, 0, true, err_out);
}
GPUTexture *GPU_texture_create_cube(
int w, GPUTextureFormat tex_format, const float *fpixels, char err_out[256])
int w, eGPUTextureFormat tex_format, const float *fpixels, char err_out[256])
{
const float *fpixels_px, *fpixels_py, *fpixels_pz, *fpixels_nx, *fpixels_ny, *fpixels_nz;
const int channels = gpu_get_component_count(tex_format);
@ -1075,7 +1075,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert)
BLI_assert(is_uint || byte_per_comp <= 2);
}
GPUTextureFormat data_type;
eGPUTextureFormat data_type;
switch (attr->fetch_mode) {
case GPU_FETCH_FLOAT:
switch (attr->comp_len) {
@ -1126,7 +1126,7 @@ GPUTexture *GPU_texture_create_from_vertbuf(GPUVertBuf *vert)
}
void GPU_texture_add_mipmap(
GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl, const void *pixels)
GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl, const void *pixels)
{
BLI_assert((int)tex->format > -1);
BLI_assert(tex->components > -1);
@ -1166,7 +1166,7 @@ void GPU_texture_add_mipmap(
}
void GPU_texture_update_sub(
GPUTexture *tex, GPUDataFormat gpu_data_format, const void *pixels,
GPUTexture *tex, eGPUDataFormat gpu_data_format, const void *pixels,
int offset_x, int offset_y, int offset_z, int width, int height, int depth)
{
BLI_assert((int)tex->format > -1);
@ -1211,7 +1211,7 @@ void GPU_texture_update_sub(
glBindTexture(tex->target, 0);
}
void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplvl)
void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat gpu_data_format, int miplvl)
{
int size[3] = {0, 0, 0};
GPU_texture_get_mipmap_size(tex, miplvl, size);
@ -1265,7 +1265,7 @@ void *GPU_texture_read(GPUTexture *tex, GPUDataFormat gpu_data_format, int miplv
return buf;
}
void GPU_texture_update(GPUTexture *tex, GPUDataFormat data_format, const void *pixels)
void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *pixels)
{
GPU_texture_update_sub(tex, data_format, pixels, 0, 0, 0, tex->w, tex->h, tex->d);
}
@ -1370,7 +1370,7 @@ void GPU_texture_generate_mipmap(GPUTexture *tex)
* In this case we just create a complete texture with mipmaps manually without downsampling.
* You must initialize the texture levels using other methods like GPU_framebuffer_recursive_downsample(). */
int levels = 1 + floor(log2(max_ii(tex->w, tex->h)));
GPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex->format);
eGPUDataFormat data_format = gpu_get_data_format_from_tex_format(tex->format);
for (int i = 1; i < levels; ++i) {
GPU_texture_add_mipmap(tex, data_format, i, NULL);
}
@ -1441,7 +1441,7 @@ void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat)
glTexParameteri(tex->target_base, GL_TEXTURE_WRAP_R, repeat);
}
static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter)
static GLenum gpu_get_gl_filterfunction(eGPUFilterFunction filter)
{
switch (filter) {
case GPU_NEAREST:
@ -1454,7 +1454,7 @@ static GLenum gpu_get_gl_filterfunction(GPUFilterFunction filter)
}
}
void GPU_texture_filters(GPUTexture *tex, GPUFilterFunction min_filter, GPUFilterFunction mag_filter)
void GPU_texture_filters(GPUTexture *tex, eGPUFilterFunction min_filter, eGPUFilterFunction mag_filter)
{
WARN_NOT_BOUND(tex);
@ -1515,7 +1515,7 @@ int GPU_texture_layers(const GPUTexture *tex)
return tex->d;
}
GPUTextureFormat GPU_texture_format(const GPUTexture *tex)
eGPUTextureFormat GPU_texture_format(const GPUTexture *tex)
{
return tex->format;
}

View File

@ -42,21 +42,21 @@
#include "GPU_material.h"
#include "GPU_uniformbuffer.h"
typedef enum GPUUniformBufferFlag {
typedef enum eGPUUniformBufferFlag {
GPU_UBO_FLAG_INITIALIZED = (1 << 0),
GPU_UBO_FLAG_DIRTY = (1 << 1),
} GPUUniformBufferFlag;
} eGPUUniformBufferFlag;
typedef enum GPUUniformBufferType {
typedef enum eGPUUniformBufferType {
GPU_UBO_STATIC = 0,
GPU_UBO_DYNAMIC = 1,
} GPUUniformBufferType;
} eGPUUniformBufferType;
struct GPUUniformBuffer {
int size; /* in bytes */
GLuint bindcode; /* opengl identifier for UBO */
int bindpoint; /* current binding point */
GPUUniformBufferType type;
eGPUUniformBufferType type;
};
#define GPUUniformBufferStatic GPUUniformBuffer
@ -68,7 +68,7 @@ typedef struct GPUUniformBufferDynamic {
} GPUUniformBufferDynamic;
/* Prototypes */
static GPUType get_padded_gpu_type(struct LinkData *link);
static eGPUType get_padded_gpu_type(struct LinkData *link);
static void gpu_uniformbuffer_inputs_sort(struct ListBase *inputs);
/* Only support up to this type, if you want to extend it, make sure the
@ -148,7 +148,7 @@ GPUUniformBuffer *GPU_uniformbuffer_dynamic_create(ListBase *inputs, char err_ou
gpu_uniformbuffer_inputs_sort(inputs);
for (LinkData *link = inputs->first; link; link = link->next) {
const GPUType gputype = get_padded_gpu_type(link);
const eGPUType gputype = get_padded_gpu_type(link);
ubo->buffer.size += gputype * sizeof(float);
}
@ -231,10 +231,10 @@ void GPU_uniformbuffer_dynamic_update(GPUUniformBuffer *ubo_)
* We need to pad some data types (vec3) on the C side
* To match the GPU expected memory block alignment.
*/
static GPUType get_padded_gpu_type(LinkData *link)
static eGPUType get_padded_gpu_type(LinkData *link)
{
GPUInput *input = link->data;
GPUType gputype = input->type;
eGPUType gputype = input->type;
/* Unless the vec3 is followed by a float we need to treat it as a vec4. */
if (gputype == GPU_VEC3 &&
@ -269,7 +269,7 @@ static void gpu_uniformbuffer_inputs_sort(ListBase *inputs)
/* Creates a lookup table for the different types; */
LinkData *inputs_lookup[MAX_UBO_GPU_TYPE + 1] = {NULL};
GPUType cur_type = MAX_UBO_GPU_TYPE + 1;
eGPUType cur_type = MAX_UBO_GPU_TYPE + 1;
for (LinkData *link = inputs->first; link; link = link->next) {
GPUInput *input = link->data;

View File

@ -64,7 +64,7 @@ static int bpygpu_ParseBultinShaderEnum(PyObject *o, void *p)
} \
} ((void)0)
GPUBuiltinShader mode;
eGPUBuiltinShader mode;
MATCH_ID(2D_UNIFORM_COLOR);
MATCH_ID(2D_FLAT_COLOR);
MATCH_ID(2D_SMOOTH_COLOR);
@ -80,7 +80,7 @@ static int bpygpu_ParseBultinShaderEnum(PyObject *o, void *p)
return 0;
success:
(*(GPUBuiltinShader *)p) = mode;
(*(eGPUBuiltinShader *)p) = mode;
return 1;
}
@ -720,7 +720,7 @@ static PyObject *bpygpu_shader_from_builtin(PyObject *UNUSED(self), PyObject *ar
{
BPYGPU_IS_INIT_OR_ERROR_OBJ;
GPUBuiltinShader shader_id;
eGPUBuiltinShader shader_id;
if (!bpygpu_ParseBultinShaderEnum(arg, &shader_id)) {
return NULL;
@ -750,7 +750,7 @@ PyDoc_STRVAR(bpygpu_shader_code_from_builtin_doc,
);
static PyObject *bpygpu_shader_code_from_builtin(BPyGPUShader *UNUSED(self), PyObject *arg)
{
GPUBuiltinShader shader_id;
eGPUBuiltinShader shader_id;
const char *vert;
const char *frag;

View File

@ -65,7 +65,7 @@
#include "UI_interface.h"
#include "UI_resources.h"
static GPUInterlaceShader interlace_gpu_id_from_type(eStereo3dInterlaceType interlace_type)
static eGPUInterlaceShader interlace_gpu_id_from_type(eStereo3dInterlaceType interlace_type)
{
switch (interlace_type) {
case S3D_INTERLACE_ROW: