Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c20
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c10
-rw-r--r--source/blender/gpu/intern/gpu_draw.c33
-rw-r--r--source/blender/gpu/intern/gpu_extensions.c4
-rw-r--r--source/blender/gpu/intern/gpu_material.c27
5 files changed, 48 insertions, 46 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index d3353e68d0b..7902d092cac 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -1353,7 +1353,7 @@ struct GPU_PBVH_Buffers {
* smooth-shaded or all faces are flat-shaded */
int smooth;
- int show_diffuse_color;
+ bool show_diffuse_color;
float diffuse_color[4];
};
typedef enum {
@@ -1582,7 +1582,7 @@ GPU_PBVH_Buffers *GPU_build_pbvh_mesh_buffers(int (*face_vert_indices)[4],
buffers->index_type = GL_UNSIGNED_SHORT;
buffers->smooth = mface[face_indices[0]].flag & ME_SMOOTH;
- buffers->show_diffuse_color = FALSE;
+ buffers->show_diffuse_color = false;
/* Count the number of visible triangles */
for (i = 0, tottri = 0; i < totface; ++i) {
@@ -1652,7 +1652,7 @@ GPU_PBVH_Buffers *GPU_build_pbvh_mesh_buffers(int (*face_vert_indices)[4],
void GPU_update_grid_pbvh_buffers(GPU_PBVH_Buffers *buffers, CCGElem **grids,
const DMFlagMat *grid_flag_mats, int *grid_indices,
- int totgrid, const CCGKey *key, int show_diffuse_color)
+ int totgrid, const CCGKey *key, bool show_diffuse_color)
{
VertexBufferFormat *vert_data;
int i, j, k, x, y;
@@ -1902,7 +1902,7 @@ GPU_PBVH_Buffers *GPU_build_grid_pbvh_buffers(int *grid_indices, int totgrid,
buffers->grid_hidden = grid_hidden;
buffers->totgrid = totgrid;
- buffers->show_diffuse_color = FALSE;
+ buffers->show_diffuse_color = false;
/* Count the number of quads */
totquad = gpu_count_grid_quads(grid_hidden, grid_indices, totgrid, gridsize);
@@ -2188,7 +2188,7 @@ GPU_PBVH_Buffers *GPU_build_bmesh_pbvh_buffers(int smooth_shading)
if (smooth_shading)
glGenBuffersARB(1, &buffers->index_buf);
glGenBuffersARB(1, &buffers->vert_buf);
- buffers->use_bmesh = TRUE;
+ buffers->use_bmesh = true;
buffers->smooth = smooth_shading;
return buffers;
@@ -2393,7 +2393,7 @@ static void gpu_draw_buffers_legacy_grids(GPU_PBVH_Buffers *buffers)
}
void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
- int wireframe)
+ bool wireframe)
{
/* sets material from the first face, to solve properly face would need to
* be sorted in buckets by materials */
@@ -2485,15 +2485,15 @@ void GPU_draw_pbvh_buffers(GPU_PBVH_Buffers *buffers, DMSetMaterial setMaterial,
}
}
-int GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, int show_diffuse_color)
+bool GPU_pbvh_buffers_diffuse_changed(GPU_PBVH_Buffers *buffers, bool show_diffuse_color)
{
float diffuse_color[4];
if (buffers->show_diffuse_color != show_diffuse_color)
- return TRUE;
+ return true;
- if (buffers->show_diffuse_color == FALSE)
- return FALSE;
+ if (buffers->show_diffuse_color == false)
+ return false;
if (buffers->mface) {
MFace *f = buffers->mface + buffers->face_indices[0];
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 68cf51f10d3..20e65028495 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1136,14 +1136,14 @@ GPUNodeLink *GPU_dynamic_uniform(float *num, int dynamictype, void *data)
return link;
}
-GPUNodeLink *GPU_image(Image *ima, ImageUser *iuser, int isdata)
+GPUNodeLink *GPU_image(Image *ima, ImageUser *iuser, bool is_data)
{
GPUNodeLink *link = GPU_node_link_create(0);
- link->image= LINK_IMAGE_BLENDER;
- link->ptr1= ima;
- link->ptr2= iuser;
- link->image_isdata= isdata;
+ link->image = LINK_IMAGE_BLENDER;
+ link->ptr1 = ima;
+ link->ptr2 = iuser;
+ link->image_isdata = is_data;
return link;
}
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 40ee745db23..fba7e028830 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -460,7 +460,7 @@ static void gpu_verify_reflection(Image *ima)
}
}
-int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int mipmap, bool is_data)
+int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, bool compare, bool mipmap, bool is_data)
{
ImBuf *ibuf = NULL;
unsigned int *bind = NULL;
@@ -470,7 +470,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
float *srgb_frect = NULL;
short texwindx, texwindy, texwinsx, texwinsy;
/* flag to determine whether high resolution format is used */
- int use_high_bit_depth = FALSE, do_color_management = FALSE;
+ bool use_high_bit_depth = false, do_color_management = false;
/* initialize tile mode and number of repeats */
GTS.ima = ima;
@@ -526,12 +526,12 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
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 */
- use_high_bit_depth = TRUE;
+ use_high_bit_depth = true;
}
/* TODO unneeded when float images are correctly treated as linear always */
if (!is_data)
- do_color_management = TRUE;
+ do_color_management = true;
if (ibuf->rect==NULL)
IMB_rect_from_float(ibuf);
@@ -573,7 +573,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
if (do_color_management) {
srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(float)*4, "floar_buf_col_cor");
IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float,
- ibuf->channels, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, TRUE,
+ ibuf->channels, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, true,
ibuf->x, ibuf->y, ibuf->x, ibuf->x);
IMB_buffer_float_unpremultiply(srgb_frect, ibuf->x, ibuf->y);
/* clamp buffer colors to 1.0 to avoid artifacts due to glu for hdr images */
@@ -599,7 +599,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
if (do_color_management) {
frect = srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(*srgb_frect)*4, "floar_buf_col_cor");
IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float,
- ibuf->channels, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, TRUE,
+ ibuf->channels, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, true,
ibuf->x, ibuf->y, ibuf->x, ibuf->x);
IMB_buffer_float_unpremultiply(srgb_frect, ibuf->x, ibuf->y);
/* clamp buffer colors to 1.0 to avoid artifacts due to glu for hdr images */
@@ -682,7 +682,8 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int
}
/* Image *ima can be NULL */
-void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float *frect, int rectw, int recth, int mipmap, int use_high_bit_depth, Image *ima)
+void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float *frect, int rectw, int recth,
+ bool mipmap, bool use_high_bit_depth, Image *ima)
{
unsigned int *scalerect = NULL;
float *fscalerect = NULL;
@@ -760,9 +761,9 @@ void GPU_create_gl_tex(unsigned int *bind, unsigned int *pix, float *frect, int
/**
* GPU_upload_dxt_texture() assumes that the texture is already bound and ready to go.
* This is so the viewport and the BGE can share some code.
- * Returns FALSE if the provided ImBuf doesn't have a supported DXT compression format
+ * Returns false if the provided ImBuf doesn't have a supported DXT compression format
*/
-int GPU_upload_dxt_texture(ImBuf *ibuf)
+bool GPU_upload_dxt_texture(ImBuf *ibuf)
{
#ifdef WITH_DDS
GLint format = 0;
@@ -782,12 +783,12 @@ int GPU_upload_dxt_texture(ImBuf *ibuf)
if (format == 0) {
printf("Unable to find a suitable DXT compression, falling back to uncompressed\n");
- return FALSE;
+ return false;
}
if (!is_power_of_2_resolution(width, height)) {
printf("Unable to load non-power-of-two DXT image resolution, falling back to uncompressed\n");
- return FALSE;
+ return false;
}
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gpu_get_mipmap_filter(0));
@@ -818,10 +819,10 @@ int GPU_upload_dxt_texture(ImBuf *ibuf)
/* set number of mipmap levels we have, needed in case they don't go down to 1x1 */
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, i-1);
- return TRUE;
+ return true;
#else
(void)ibuf;
- return FALSE;
+ return false;
#endif
}
@@ -873,7 +874,7 @@ int GPU_set_tpage(MTFace *tface, int mipmap, int alphablend)
gpu_verify_alpha_blend(alphablend);
gpu_verify_reflection(ima);
- if (GPU_verify_image(ima, NULL, tface->tile, 1, mipmap, FALSE)) {
+ if (GPU_verify_image(ima, NULL, tface->tile, 1, mipmap, false)) {
GTS.curtile= GTS.tile;
GTS.curima= GTS.ima;
GTS.curtilemode= GTS.tilemode;
@@ -1424,7 +1425,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
* - 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->transp != FALSE);
+ GMS.is_alpha_pass = (v3d->transp != false);
if (GMS.use_alpha_pass)
*do_alpha_after = false;
@@ -1495,7 +1496,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
}
}
- /* setting 'do_alpha_after = TRUE' indicates this object needs to be
+ /* setting 'do_alpha_after = true' indicates this object needs to be
* drawn in a second alpha pass for improved blending */
if (do_alpha_after && !GMS.is_alpha_pass)
if (ELEM3(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ADD, GPU_BLEND_ALPHA_SORT))
diff --git a/source/blender/gpu/intern/gpu_extensions.c b/source/blender/gpu/intern/gpu_extensions.c
index e8fd8eb49d6..5c3bf6eb8e2 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -555,7 +555,7 @@ GPUTexture *GPU_texture_create_3D(int w, int h, int depth, int channels, float *
return tex;
}
-GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int isdata, double time, int mipmap)
+GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, bool is_data, double time, int mipmap)
{
GPUTexture *tex;
GLint w, h, border, lastbindcode, bindcode;
@@ -564,7 +564,7 @@ GPUTexture *GPU_texture_from_blender(Image *ima, ImageUser *iuser, int isdata, d
GPU_update_image_time(ima, time);
/* this binds a texture, so that's why to restore it with lastbindcode */
- bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap, isdata);
+ bindcode = GPU_verify_image(ima, iuser, 0, 0, mipmap, is_data);
if (ima->gputexture) {
ima->gputexture->bindcode = bindcode;
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c
index 608c498bd1e..f73c98f9123 100644
--- a/source/blender/gpu/intern/gpu_material.c
+++ b/source/blender/gpu/intern/gpu_material.c
@@ -393,10 +393,10 @@ void gpu_material_add_node(GPUMaterial *material, GPUNode *node)
/* Code generation */
-int GPU_material_do_color_management(GPUMaterial *mat)
+bool GPU_material_do_color_management(GPUMaterial *mat)
{
if (!BKE_scene_check_color_management_enabled(mat->scene))
- return FALSE;
+ return false;
return !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT));
}
@@ -653,7 +653,7 @@ static void shade_light_textures(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **
GPU_link(mat, "shade_light_texture",
GPU_builtin(GPU_VIEW_POSITION),
- GPU_image(mtex->tex->ima, &mtex->tex->iuser, FALSE),
+ GPU_image(mtex->tex->ima, &mtex->tex->iuser, false),
GPU_dynamic_uniform((float*)lamp->dynpersmat, GPU_DYNAMIC_LAMP_DYNPERSMAT, lamp->ob),
&tex_rgb);
texture_rgb_blend(mat, tex_rgb, *rgb, GPU_uniform(&one), GPU_uniform(&mtex->colfac), mtex->blendtype, rgb);
@@ -976,7 +976,8 @@ static void do_material_tex(GPUShadeInput *shi)
/*char *lastuvname = NULL;*/ /*UNUSED*/
float one = 1.0f, norfac, ofs[3];
int tex_nr, rgbnor, talpha;
- int init_done = FALSE, iBumpSpacePrev = 0; /* Not necessary, quiting gcc warning. */
+ bool init_done = false;
+ int iBumpSpacePrev = 0; /* Not necessary, quiting gcc warning. */
GPUNodeLink *vNorg, *vNacc, *fPrevMagnitude;
int iFirstTimeNMap=1;
int found_deriv_map = 0;
@@ -1046,7 +1047,7 @@ static void do_material_tex(GPUShadeInput *shi)
talpha = 0;
if (tex && tex->type == TEX_IMAGE && tex->ima) {
- GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser, FALSE), &tin, &trgb);
+ GPU_link(mat, "mtex_image", texco, GPU_image(tex->ima, &tex->iuser, false), &tin, &trgb);
rgbnor= TEX_RGB;
talpha = ((tex->imaflag & TEX_USEALPHA) && tex->ima && (tex->ima->flag & IMA_IGNORE_ALPHA) == 0);
@@ -1121,7 +1122,7 @@ static void do_material_tex(GPUShadeInput *shi)
if (tex->imaflag & TEX_NORMALMAP) {
/* normalmap image */
- GPU_link(mat, "mtex_normal", texco, GPU_image(tex->ima, &tex->iuser, TRUE), &tnor);
+ GPU_link(mat, "mtex_normal", texco, GPU_image(tex->ima, &tex->iuser, true), &tnor);
if (mtex->norfac < 0.0f)
GPU_link(mat, "mtex_negate_texnormal", tnor, &tnor);
@@ -1219,7 +1220,7 @@ static void do_material_tex(GPUShadeInput *shi)
// copy shi->vn to vNorg and vNacc, set magnitude to 1
GPU_link(mat, "mtex_bump_normals_init", shi->vn, &vNorg, &vNacc, &fPrevMagnitude);
iBumpSpacePrev = 0;
- init_done = TRUE;
+ init_done = true;
}
// find current bump space
@@ -1261,26 +1262,26 @@ static void do_material_tex(GPUShadeInput *shi)
if (found_deriv_map) {
GPU_link(mat, "mtex_bump_deriv",
- texco, GPU_image(tex->ima, &tex->iuser, TRUE), GPU_uniform(&ima_x), GPU_uniform(&ima_y), tnorfac,
+ texco, GPU_image(tex->ima, &tex->iuser, true), GPU_uniform(&ima_x), GPU_uniform(&ima_y), tnorfac,
&dBs, &dBt );
}
else if ( mtex->texflag & MTEX_3TAP_BUMP)
GPU_link(mat, "mtex_bump_tap3",
- texco, GPU_image(tex->ima, &tex->iuser, TRUE), tnorfac,
+ texco, GPU_image(tex->ima, &tex->iuser, true), tnorfac,
&dBs, &dBt );
else if ( mtex->texflag & MTEX_5TAP_BUMP)
GPU_link(mat, "mtex_bump_tap5",
- texco, GPU_image(tex->ima, &tex->iuser, TRUE), tnorfac,
+ texco, GPU_image(tex->ima, &tex->iuser, true), tnorfac,
&dBs, &dBt );
else if ( mtex->texflag & MTEX_BICUBIC_BUMP ) {
if (GPU_bicubic_bump_support()) {
GPU_link(mat, "mtex_bump_bicubic",
- texco, GPU_image(tex->ima, &tex->iuser, TRUE), tnorfac,
+ texco, GPU_image(tex->ima, &tex->iuser, true), tnorfac,
&dBs, &dBt);
}
else {
GPU_link(mat, "mtex_bump_tap5",
- texco, GPU_image(tex->ima, &tex->iuser, TRUE), tnorfac,
+ texco, GPU_image(tex->ima, &tex->iuser, true), tnorfac,
&dBs, &dBt);
}
}
@@ -1290,7 +1291,7 @@ static void do_material_tex(GPUShadeInput *shi)
float imag_tspace_dimension_y = aspect*imag_tspace_dimension_x;
GPU_link(mat, "mtex_bump_apply_texspace",
fDet, dBs, dBt, vR1, vR2,
- GPU_image(tex->ima, &tex->iuser, TRUE), texco,
+ GPU_image(tex->ima, &tex->iuser, true), texco,
GPU_uniform(&imag_tspace_dimension_x), GPU_uniform(&imag_tspace_dimension_y), vNacc,
&vNacc, &shi->vn );
}