diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-09 22:28:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-09 22:28:30 +0400 |
commit | 89a963fb7fdff543b77de790355b9dac3019bd33 (patch) | |
tree | 4e1d2245e20f8c21625e99d771776f66c233a0de /source/blender/gpu | |
parent | de4bd55e01bc574c13977537ace1a0901dcfcaf0 (diff) |
style cleanup: comment blocks
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/GPU_buffers.h | 30 | ||||
-rw-r--r-- | source/blender/gpu/GPU_extensions.h | 42 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.h | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 34 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.c | 24 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 11 |
7 files changed, 80 insertions, 73 deletions
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 9aa9b6fe857..09314351078 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -62,20 +62,20 @@ typedef struct GPUBufferMaterial { } GPUBufferMaterial; /* meshes are split up by material since changing materials requires - GL state changes that can't occur in the middle of drawing an - array. - - some simplifying assumptions are made: - * all quads are treated as two triangles. - * no vertex sharing is used; each triangle gets its own copy of the - vertices it uses (this makes it easy to deal with a vertex used - by faces with different properties, such as smooth/solid shading, - different MCols, etc.) - - to avoid confusion between the original MVert vertices and the - arrays of OpenGL vertices, the latter are referred to here and in - the source as `points'. similarly, the OpenGL triangles generated - for MFaces are referred to as triangles rather than faces. + * GL state changes that can't occur in the middle of drawing an + * array. + * + * some simplifying assumptions are made: + * - all quads are treated as two triangles. + * - no vertex sharing is used; each triangle gets its own copy of the + * vertices it uses (this makes it easy to deal with a vertex used + * by faces with different properties, such as smooth/solid shading, + * different MCols, etc.) + * + * to avoid confusion between the original MVert vertices and the + * arrays of OpenGL vertices, the latter are referred to here and in + * the source as `points'. similarly, the OpenGL triangles generated + * for MFaces are referred to as triangles rather than faces. */ typedef struct GPUDrawObject { GPUBuffer *points; @@ -107,7 +107,7 @@ typedef struct GPUDrawObject { int totedge; /* if there was a failure allocating some buffer, use old - rendering code */ + * rendering code */ int legacy; } GPUDrawObject; diff --git a/source/blender/gpu/GPU_extensions.h b/source/blender/gpu/GPU_extensions.h index 5ec373802a3..5f541e2e8e6 100644 --- a/source/blender/gpu/GPU_extensions.h +++ b/source/blender/gpu/GPU_extensions.h @@ -92,18 +92,18 @@ typedef enum GPUDriverType { int GPU_type_matches(GPUDeviceType device, GPUOSType os, GPUDriverType driver); /* GPU Texture - - always returns unsigned char RGBA textures - - if texture with non square dimensions is created, depending on the - graphics card capabilities the texture may actually be stored in a - larger texture with power of two dimensions. the actual dimensions - may be queried with GPU_texture_opengl_width/height. GPU_texture_coord_2f - calls glTexCoord2f with the coordinates adjusted for this. - - can use reference counting: - - reference counter after GPU_texture_create is 1 - - GPU_texture_ref increases by one - - GPU_texture_free decreases by one, and frees if 0 - - if created with from_blender, will not free the texture -*/ + * - always returns unsigned char RGBA textures + * - if texture with non square dimensions is created, depending on the + * graphics card capabilities the texture may actually be stored in a + * larger texture with power of two dimensions. the actual dimensions + * may be queried with GPU_texture_opengl_width/height. GPU_texture_coord_2f + * calls glTexCoord2f with the coordinates adjusted for this. + * - can use reference counting: + * - reference counter after GPU_texture_create is 1 + * - GPU_texture_ref increases by one + * - GPU_texture_free decreases by one, and frees if 0 + * - if created with from_blender, will not free the texture + */ GPUTexture *GPU_texture_create_1D(int w, float *pixels, char err_out[256]); GPUTexture *GPU_texture_create_2D(int w, int h, float *pixels, char err_out[256]); @@ -126,11 +126,11 @@ int GPU_texture_opengl_height(GPUTexture *tex); int GPU_texture_opengl_bindcode(GPUTexture *tex); /* GPU Framebuffer - - this is a wrapper for an OpenGL framebuffer object (FBO). in practice - multiple FBO's may be created, to get around limitations on the number - of attached textures and the dimension requirements. - - after any of the GPU_framebuffer_* functions, GPU_framebuffer_restore must - be called before rendering to the window framebuffer again */ + * - this is a wrapper for an OpenGL framebuffer object (FBO). in practice + * multiple FBO's may be created, to get around limitations on the number + * of attached textures and the dimension requirements. + * - after any of the GPU_framebuffer_* functions, GPU_framebuffer_restore must + * be called before rendering to the window framebuffer again */ GPUFrameBuffer *GPU_framebuffer_create(void); int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, char err_out[256]); @@ -142,8 +142,8 @@ void GPU_framebuffer_free(GPUFrameBuffer *fb); void GPU_framebuffer_restore(void); /* GPU OffScreen - - wrapper around framebuffer and texture for simple offscreen drawing - - changes size if graphics card can't support it */ + * - wrapper around framebuffer and texture for simple offscreen drawing + * - changes size if graphics card can't support it */ GPUOffScreen *GPU_offscreen_create(int width, int height, char err_out[256]); void GPU_offscreen_free(GPUOffScreen *ofs); @@ -152,8 +152,8 @@ void GPU_offscreen_unbind(GPUOffScreen *ofs); void GPU_offscreen_read_pixels(GPUOffScreen *ofs, int type, void *pixels); /* GPU Shader - - only for fragment shaders now - - must call texture bind before setting a texture as uniform! */ + * - only for fragment shaders now + * - must call texture bind before setting a texture as uniform! */ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, const char *libcode); /*GPUShader *lib);*/ /*GPUShader *GPU_shader_create_lib(const char *code);*/ diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index f6db4f6e735..07d7568ab95 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -72,8 +72,8 @@ static const char* GPU_DATATYPE_STR[17] = {"", "float", "vec2", "vec3", "vec4", * These are stored in a hash for lookup when creating a material. */ static GHash *FUNCTION_HASH= NULL; -/*static char *FUNCTION_PROTOTYPES= NULL; -static GPUShader *FUNCTION_LIB= NULL;*/ +/* static char *FUNCTION_PROTOTYPES= NULL; + * static GPUShader *FUNCTION_LIB= NULL;*/ static int gpu_str_prefix(const char *str, const char *prefix) { diff --git a/source/blender/gpu/intern/gpu_codegen.h b/source/blender/gpu/intern/gpu_codegen.h index 85bf65232c1..db334b8bf19 100644 --- a/source/blender/gpu/intern/gpu_codegen.h +++ b/source/blender/gpu/intern/gpu_codegen.h @@ -61,10 +61,10 @@ typedef struct GPUFunction { GPUFunction *GPU_lookup_function(const char *name); /* Pass Generation - - Takes a list of nodes and a desired output, and makes a pass. This - will take ownership of the nodes and free them early if unused or - at the end if used. -*/ + * - Takes a list of nodes and a desired output, and makes a pass. This + * will take ownership of the nodes and free them early if unused or + * at the end if used. + */ typedef enum GPUDataSource { GPU_SOURCE_VEC_UNIFORM, diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 526f293d0b9..a5d6c374a42 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -193,9 +193,11 @@ static int is_pow2_limit(int num) { /* take texture clamping into account */ - /* XXX: texturepaint not global! + /* XXX: texturepaint not global! */ +#if 0 if (G.f & G_TEXTUREPAINT) return 1;*/ +#endif if (U.glreslimit != 0 && num > U.glreslimit) return 0; @@ -205,10 +207,12 @@ static int is_pow2_limit(int num) static int smaller_pow2_limit(int num) { - /* XXX: texturepaint not global! + /* XXX: texturepaint not global! */ +#if 0 if (G.f & G_TEXTUREPAINT) return 1;*/ - +#endif + /* take texture clamping into account */ if (U.glreslimit != 0 && num > U.glreslimit) return U.glreslimit; @@ -467,7 +471,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int if(ibuf->rect_float) { if(U.use_16bit_textures) { /* use high precision textures. This is relatively harmless because OpenGL gives us - a high precision format only if it is available */ + * a high precision format only if it is available */ use_high_bit_depth = TRUE; } @@ -593,7 +597,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int } /* scale if not a power of two. this is not strictly necessary for newer - GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures */ + * GPUs (OpenGL version >= 2.0) since they support non-power-of-two-textures */ if (!is_pow2_limit(rectw) || !is_pow2_limit(recth)) { rectw= smaller_pow2_limit(rectw); recth= smaller_pow2_limit(recth); @@ -714,9 +718,9 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend) } /* these two functions are called on entering and exiting texture paint mode, - temporary disabling/enabling mipmapping on all images for quick texture - updates with glTexSubImage2D. images that didn't change don't have to be - re-uploaded to OpenGL */ + * temporary disabling/enabling mipmapping on all images for quick texture + * updates with glTexSubImage2D. images that didn't change don't have to be + * re-uploaded to OpenGL */ void GPU_paint_set_mipmap(int mipmap) { Image* ima; @@ -1086,10 +1090,10 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O GMS.gviewinv= rv3d->viewinv; /* alpha pass setup. there's various cases to handle here: - * object transparency on: only solid materials draw in the first pass, - and only transparent in the second 'alpha' pass. - * object transparency off: for glsl we draw both in a single pass, and - for solid we don't use transparency at all. */ + * - object transparency on: only solid materials draw in the first pass, + * and only transparent in the second 'alpha' pass. + * - object transparency off: for glsl we draw both in a single pass, and + * for solid we don't use transparency at all. */ GMS.use_alpha_pass = (do_alpha_after != NULL); GMS.is_alpha_pass = (v3d && v3d->transp); if(GMS.use_alpha_pass) @@ -1236,7 +1240,7 @@ int GPU_enable_material(int nr, void *attribs) GMS.gboundmat= mat; /* for glsl use alpha blend mode, unless it's set to solid and - we are already drawing in an alpha pass */ + * we are already drawing in an alpha pass */ if(mat->game.alpha_blend != GPU_BLEND_SOLID) alphablend= mat->game.alpha_blend; @@ -1525,8 +1529,8 @@ void GPU_state_init(void) glDisable(GL_CULL_FACE); /* calling this makes drawing very slow when AA is not set up in ghost - on Linux/NVIDIA. - glDisable(GL_MULTISAMPLE); */ + * on Linux/NVIDIA. */ + // glDisable(GL_MULTISAMPLE); } /* debugging aid */ diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c index ea47e67c1e6..e1d6f64f661 100644 --- a/source/blender/gpu/intern/gpu_extensions.c +++ b/source/blender/gpu/intern/gpu_extensions.c @@ -56,14 +56,14 @@ /* Extensions support */ /* extensions used: - - texture border clamp: 1.3 core - - fragement shader: 2.0 core - - framebuffer object: ext specification - - multitexture 1.3 core - - arb non power of two: 2.0 core - - pixel buffer objects? 2.1 core - - arb draw buffers? 2.0 core -*/ + * - texture border clamp: 1.3 core + * - fragement shader: 2.0 core + * - framebuffer object: ext specification + * - multitexture 1.3 core + * - arb non power of two: 2.0 core + * - pixel buffer objects? 2.1 core + * - arb draw buffers? 2.0 core + */ static struct GPUGlobal { GLint maxtextures; @@ -850,7 +850,7 @@ struct GPUOffScreen { GPUTexture *depth; /* requested width/height, may be smaller than actual texture size due - to missing non-power of two support, so we compensate for that */ + * to missing non-power of two support, so we compensate for that */ int w, h; }; @@ -1021,8 +1021,10 @@ GPUShader *GPU_shader_create(const char *vertexcode, const char *fragcode, /*GPU } } - /*if(lib && lib->lib) - glAttachObjectARB(shader->object, lib->lib);*/ +#if 0 + if(lib && lib->lib) + glAttachObjectARB(shader->object, lib->lib); +#endif glLinkProgramARB(shader->object); glGetObjectParameterivARB(shader->object, GL_OBJECT_LINK_STATUS_ARB, &status); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index c59af3cc7fb..89b3a7d5f3f 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -672,9 +672,10 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la i = is; GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i); - - /*if(ma->mode & MA_TANGENT_VN) - GPU_link(mat, "shade_tangent_v_spec", GPU_attribute(CD_TANGENT, ""), &vn);*/ +#if 0 + if(ma->mode & MA_TANGENT_VN) + GPU_link(mat, "shade_tangent_v_spec", GPU_attribute(CD_TANGENT, ""), &vn); +#endif /* this replaces if(i > 0.0) conditional until that is supported */ // done in shade_visifac now, GPU_link(mat, "mtex_value_clamp_positive", i, &i); @@ -1461,8 +1462,8 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma) GPU_material_construct_end(mat); /* note that even if building the shader fails in some way, we still keep - it to avoid trying to compile again and again, and simple do not use - the actual shader on drawing */ + * it to avoid trying to compile again and again, and simple do not use + * the actual shader on drawing */ link = MEM_callocN(sizeof(LinkData), "GPUMaterialLink"); link->data = mat; |