Blender V2.61 - r43446
Classes | Functions | Variables

gpu_extensions.c File Reference

#include "GL/glew.h"
#include "DNA_image_types.h"
#include "MEM_guardedalloc.h"
#include "BKE_global.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "BLI_math_base.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
#include "gpu_codegen.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "BLI_winstuff.h"

Go to the source code of this file.

Classes

struct  GPUGlobal
struct  GPUTexture
struct  GPUFrameBuffer
struct  GPUOffScreen
struct  GPUShader

Functions

int GPU_type_matches (GPUDeviceType device, GPUOSType os, GPUDriverType driver)
void GPU_extensions_disable (void)
void GPU_extensions_init (void)
void GPU_extensions_exit (void)
int GPU_glsl_support (void)
int GPU_non_power_of_two_support (void)
int GPU_color_depth (void)
int GPU_print_error (const char *str)
static void GPU_print_framebuffer_error (GLenum status, char err_out[256])
static unsigned char * GPU_texture_convert_pixels (int length, float *fpixels)
static void GPU_glTexSubImageEmpty (GLenum target, GLenum format, int x, int y, int w, int h)
static GPUTextureGPU_texture_create_nD (int w, int h, int n, float *fpixels, int depth, char err_out[256])
GPUTextureGPU_texture_create_3D (int w, int h, int depth, float *fpixels)
GPUTextureGPU_texture_from_blender (Image *ima, ImageUser *iuser, double time, int mipmap)
GPUTextureGPU_texture_create_1D (int w, float *fpixels, char err_out[256])
GPUTextureGPU_texture_create_2D (int w, int h, float *fpixels, char err_out[256])
GPUTextureGPU_texture_create_depth (int w, int h, char err_out[256])
void GPU_texture_bind (GPUTexture *tex, int number)
void GPU_texture_unbind (GPUTexture *tex)
void GPU_texture_free (GPUTexture *tex)
void GPU_texture_ref (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)
GPUFrameBufferGPU_texture_framebuffer (GPUTexture *tex)
GPUFrameBufferGPU_framebuffer_create (void)
int GPU_framebuffer_texture_attach (GPUFrameBuffer *fb, GPUTexture *tex, char err_out[256])
void GPU_framebuffer_texture_detach (GPUFrameBuffer *fb, GPUTexture *tex)
void GPU_framebuffer_texture_bind (GPUFrameBuffer *UNUSED(fb), GPUTexture *tex, int w, int h)
void GPU_framebuffer_texture_unbind (GPUFrameBuffer *UNUSED(fb), GPUTexture *UNUSED(tex))
void GPU_framebuffer_free (GPUFrameBuffer *fb)
void GPU_framebuffer_restore (void)
GPUOffScreenGPU_offscreen_create (int width, int height, char err_out[256])
void GPU_offscreen_free (GPUOffScreen *ofs)
void GPU_offscreen_bind (GPUOffScreen *ofs)
void GPU_offscreen_unbind (GPUOffScreen *ofs)
void GPU_offscreen_read_pixels (GPUOffScreen *ofs, int type, void *pixels)
static void shader_print_errors (const char *task, char *log, const char *code)
GPUShaderGPU_shader_create (const char *vertexcode, const char *fragcode, const char *libcode)
void GPU_shader_bind (GPUShader *shader)
void GPU_shader_unbind (GPUShader *UNUSED(shader))
void GPU_shader_free (GPUShader *shader)
int GPU_shader_get_uniform (GPUShader *shader, const char *name)
void GPU_shader_uniform_vector (GPUShader *UNUSED(shader), int location, int length, int arraysize, float *value)
void GPU_shader_uniform_texture (GPUShader *UNUSED(shader), int location, GPUTexture *tex)
int GPU_shader_get_attribute (GPUShader *shader, const char *name)

Variables

static struct GPUGlobal GG
static int gpu_extensions_init = 0

Detailed Description

Definition in file gpu_extensions.c.


Function Documentation

int GPU_color_depth ( void  )
void GPU_extensions_disable ( void  )

Definition at line 91 of file gpu_extensions.c.

References GPUGlobal::extdisabled, and GG.

Referenced by no_glsl().

void GPU_extensions_exit ( void  )

Definition at line 192 of file gpu_extensions.c.

References GPU_codegen_exit(), and gpu_extensions_init.

Referenced by GPG_Application::exitEngine(), and WM_exit_ext().

void GPU_extensions_init ( void  )
GPUFrameBuffer* GPU_framebuffer_create ( void  )
void GPU_framebuffer_free ( GPUFrameBuffer fb)
void GPU_framebuffer_restore ( void  )
int GPU_framebuffer_texture_attach ( GPUFrameBuffer fb,
GPUTexture tex,
char  err_out[256] 
)
void GPU_framebuffer_texture_bind ( GPUFrameBuffer UNUSEDfb,
GPUTexture tex,
int  w,
int  h 
)

Definition at line 784 of file gpu_extensions.c.

References GPUGlobal::currentfb, GPUTexture::fb, GG, and GPUFrameBuffer::object.

void GPU_framebuffer_texture_detach ( GPUFrameBuffer fb,
GPUTexture tex 
)
void GPU_framebuffer_texture_unbind ( GPUFrameBuffer UNUSEDfb,
GPUTexture UNUSEDtex 
)

Definition at line 806 of file gpu_extensions.c.

int GPU_glsl_support ( void  )
static void GPU_glTexSubImageEmpty ( GLenum  target,
GLenum  format,
int  x,
int  y,
int  w,
int  h 
) [static]

Definition at line 305 of file gpu_extensions.c.

References MEM_callocN(), and MEM_freeN().

Referenced by GPU_texture_create_nD().

int GPU_non_power_of_two_support ( void  )
void GPU_offscreen_bind ( GPUOffScreen ofs)
GPUOffScreen* GPU_offscreen_create ( int  width,
int  height,
char  err_out[256] 
)
void GPU_offscreen_free ( GPUOffScreen ofs)
void GPU_offscreen_read_pixels ( GPUOffScreen ofs,
int  type,
void *  pixels 
)
void GPU_offscreen_unbind ( GPUOffScreen ofs)
int GPU_print_error ( const char *  str)
static void GPU_print_framebuffer_error ( GLenum  status,
char  err_out[256] 
) [static]

Definition at line 235 of file gpu_extensions.c.

References BLI_snprintf(), and err.

Referenced by GPU_framebuffer_texture_attach().

void GPU_shader_bind ( GPUShader shader)

Definition at line 1082 of file gpu_extensions.c.

References GPU_print_error(), and GPUShader::object.

Referenced by GPU_nodes_extract_dynamic_inputs(), and GPU_pass_bind().

GPUShader* GPU_shader_create ( const char *  vertexcode,
const char *  fragcode,
const char *  libcode 
)
void GPU_shader_free ( GPUShader shader)
int GPU_shader_get_attribute ( GPUShader shader,
const char *  name 
)

Definition at line 1159 of file gpu_extensions.c.

References GPU_print_error(), and GPUShader::object.

Referenced by gpu_material_set_attrib_id().

int GPU_shader_get_uniform ( GPUShader shader,
const char *  name 
)

Definition at line 1109 of file gpu_extensions.c.

References GPUShader::object.

Referenced by GPU_material_construct_end(), and GPU_nodes_extract_dynamic_inputs().

void GPU_shader_unbind ( GPUShader UNUSEDshader)

Definition at line 1089 of file gpu_extensions.c.

References GPU_print_error().

void GPU_shader_uniform_texture ( GPUShader UNUSEDshader,
int  location,
GPUTexture tex 
)
void GPU_shader_uniform_vector ( GPUShader UNUSEDshader,
int  location,
int  length,
int  arraysize,
float *  value 
)

Definition at line 1114 of file gpu_extensions.c.

References GPU_print_error().

void GPU_texture_bind ( GPUTexture tex,
int  number 
)
static unsigned char* GPU_texture_convert_pixels ( int  length,
float *  fpixels 
) [static]

Definition at line 289 of file gpu_extensions.c.

References FTOCHAR, len(), length(), MEM_callocN(), and p.

Referenced by GPU_texture_create_nD().

GPUTexture* GPU_texture_create_1D ( int  w,
float *  fpixels,
char  err_out[256] 
)

Definition at line 559 of file gpu_extensions.c.

References GPU_texture_create_nD(), and GPU_texture_unbind().

GPUTexture* GPU_texture_create_2D ( int  w,
int  h,
float *  fpixels,
char  err_out[256] 
)

Definition at line 569 of file gpu_extensions.c.

References GPU_texture_create_nD(), and GPU_texture_unbind().

Referenced by gpu_node_input_link(), and GPU_offscreen_create().

GPUTexture* GPU_texture_create_3D ( int  w,
int  h,
int  depth,
float *  fpixels 
)
GPUTexture* GPU_texture_create_depth ( int  w,
int  h,
char  err_out[256] 
)

Definition at line 579 of file gpu_extensions.c.

References GPU_texture_create_nD(), GPU_texture_unbind(), and NULL.

Referenced by GPU_lamp_from_blender(), and GPU_offscreen_create().

static GPUTexture* GPU_texture_create_nD ( int  w,
int  h,
int  n,
float *  fpixels,
int  depth,
char  err_out[256] 
) [static]
GPUFrameBuffer* GPU_texture_framebuffer ( GPUTexture tex)

Definition at line 681 of file gpu_extensions.c.

References GPUTexture::fb.

void GPU_texture_free ( GPUTexture tex)
GPUTexture* GPU_texture_from_blender ( Image ima,
ImageUser iuser,
double  time,
int  mipmap 
)
int GPU_texture_opengl_bindcode ( GPUTexture tex)

Definition at line 676 of file gpu_extensions.c.

References GPUTexture::bindcode.

Referenced by GPU_shader_export().

int GPU_texture_opengl_height ( GPUTexture tex)

Definition at line 671 of file gpu_extensions.c.

References GPUTexture::h.

Referenced by GPU_lamp_shadow_buffer_bind(), and GPU_shader_export().

int GPU_texture_opengl_width ( GPUTexture tex)

Definition at line 666 of file gpu_extensions.c.

References GPUTexture::w.

Referenced by GPU_lamp_shadow_buffer_bind(), and GPU_shader_export().

void GPU_texture_ref ( GPUTexture tex)

Definition at line 656 of file gpu_extensions.c.

References GPUTexture::refcount.

int GPU_texture_target ( GPUTexture tex)

Definition at line 661 of file gpu_extensions.c.

References GPUTexture::target.

void GPU_texture_unbind ( GPUTexture tex)
int GPU_type_matches ( GPUDeviceType  device,
GPUOSType  os,
GPUDriverType  driver 
)
static void shader_print_errors ( const char *  task,
char *  log,
const char *  code 
) [static]

Definition at line 940 of file gpu_extensions.c.

References G, G_DEBUG, and strlen().

Referenced by GPU_shader_create().


Variable Documentation

struct GPUGlobal GG [static]
int gpu_extensions_init = 0 [static]

Definition at line 89 of file gpu_extensions.c.

Referenced by GPU_extensions_exit(), and GPU_extensions_init().