From c0fa864e24c0a80d55cc7a3e3dcc29f6c2c99df7 Mon Sep 17 00:00:00 2001 From: Mike Erwin Date: Mon, 16 Mar 2015 22:57:56 -0400 Subject: Cleanup: bool & const Using bool when we're asking yes/no questions such as whether some GPU feature is supported. Consolidated these simple functions into gpu_extensions.c and grouped them in the header. Const-ified some args where the functions don't modify the pointed-to data. --- source/blender/gpu/GPU_extensions.h | 38 +++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'source/blender/gpu/GPU_extensions.h') diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 228bea14e00..985cebc8687 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -56,14 +56,16 @@ typedef struct GPUShader GPUShader; void GPU_extensions_disable(void); -int GPU_glsl_support(void); -int GPU_non_power_of_two_support(void); -int GPU_vertex_buffer_support(void); -int GPU_display_list_support(void); +bool GPU_glsl_support(void); +bool GPU_non_power_of_two_support(void); +bool GPU_vertex_buffer_support(void); +bool GPU_display_list_support(void); +bool GPU_bicubic_bump_support(void); + +int GPU_max_texture_size(void); int GPU_color_depth(void); + void GPU_code_generate_glsl_lib(void); -int GPU_bicubic_bump_support(void); -int GPU_max_texture_size (void); /* GPU Types */ @@ -91,7 +93,7 @@ typedef enum GPUDriverType { GPU_DRIVER_ANY = (0xff0000) } GPUDriverType; -int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver); +bool GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver); /* GPU Texture * - always returns unsigned char RGBA textures @@ -113,13 +115,13 @@ typedef enum GPUHDRType { GPU_HDR_FULL_FLOAT = (1 << 1), } GPUHDRType; -GPUTexture *GPU_texture_create_1D(int w, float *pixels, char err_out[256]); -GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels, GPUHDRType hdr, char err_out[256]); -GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, float *fpixels); +GPUTexture *GPU_texture_create_1D(int w, const float *pixels, char err_out[256]); +GPUTexture *GPU_texture_create_2D(int w, int h, const float *pixels, GPUHDRType hdr, char err_out[256]); +GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, const float *fpixels); GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256]); GPUTexture *GPU_texture_create_vsm_shadow_map(int size, char err_out[256]); -GPUTexture *GPU_texture_create_2D_procedural(int w, int h, float *pixels, char err_out[256]); -GPUTexture *GPU_texture_create_1D_procedural(int w, float *pixels, char err_out[256]); +GPUTexture *GPU_texture_create_2D_procedural(int w, int h, const float *pixels, char err_out[256]); +GPUTexture *GPU_texture_create_1D_procedural(int w, const float *pixels, char err_out[256]); GPUTexture *GPU_texture_from_blender(struct Image *ima, struct ImageUser *iuser, bool is_data, double time, int mipmap); GPUTexture *GPU_texture_from_preview(struct PreviewImage *prv, int mipmap); @@ -138,10 +140,10 @@ void GPU_depth_texture_mode(GPUTexture *tex, bool compare, bool use_filter); GPUFrameBuffer *GPU_texture_framebuffer(GPUTexture *tex); -int GPU_texture_target(GPUTexture *tex); -int GPU_texture_opengl_width(GPUTexture *tex); -int GPU_texture_opengl_height(GPUTexture *tex); -int GPU_texture_opengl_bindcode(GPUTexture *tex); +int GPU_texture_target(const GPUTexture *tex); +int GPU_texture_opengl_width(const GPUTexture *tex); +int GPU_texture_opengl_height(const GPUTexture *tex); +int GPU_texture_opengl_bindcode(const GPUTexture *tex); /* GPU Framebuffer * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice @@ -174,8 +176,8 @@ void GPU_offscreen_free(GPUOffScreen *ofs); void GPU_offscreen_bind(GPUOffScreen *ofs, bool save); void GPU_offscreen_unbind(GPUOffScreen *ofs, bool restore); void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels); -int GPU_offscreen_width(GPUOffScreen *ofs); -int GPU_offscreen_height(GPUOffScreen *ofs); +int GPU_offscreen_width(const GPUOffScreen *ofs); +int GPU_offscreen_height(const GPUOffScreen *ofs); /* GPU Shader * - only for fragment shaders now -- cgit v1.2.3