Cleanup: strip trailing space in GPU module
authorCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jun 2018 07:09:12 +0000 (09:09 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jun 2018 07:09:12 +0000 (09:09 +0200)
17 files changed:
source/blender/gpu/GPU_buffers.h
source/blender/gpu/GPU_draw.h
source/blender/gpu/GPU_texture.h
source/blender/gpu/intern/gpu_basic_shader.c
source/blender/gpu/intern/gpu_buffers.c
source/blender/gpu/intern/gpu_codegen.c
source/blender/gpu/intern/gpu_draw.c
source/blender/gpu/intern/gpu_framebuffer.c
source/blender/gpu/intern/gpu_material.c
source/blender/gpu/intern/gpu_select_pick.c
source/blender/gpu/intern/gpu_select_sample_query.c
source/blender/gpu/intern/gpu_shader.c
source/blender/gpu/intern/gpu_texture.c
source/blender/gpu/shaders/gpu_shader_basic_vert.glsl
source/blender/gpu/shaders/gpu_shader_fx_dof_hq_vert.glsl
source/blender/gpu/shaders/gpu_shader_material.glsl
source/blender/gpu/shaders/gpu_shader_vertex.glsl

index 6ffaa29ead63ef45b73a09abec9c1f28c4b778c0..8fd34348f037528fcd880bbab5a19a82ffbafa9b 100644 (file)
@@ -108,17 +108,17 @@ typedef struct GPUDrawObject {
        struct GPUVertPointLink *vert_points_mem;
        int vert_points_usage;
 #endif
-       
+
        int colType;
 
        GPUBufferMaterial *materials;
        int totmaterial;
-       
+
        unsigned int tot_triangle_point;
        unsigned int tot_loose_point;
        /* different than total loops since ngons get tesselated still */
        unsigned int tot_loop_verts;
-       
+
        /* caches of the original DerivedMesh values */
        unsigned int totvert;
        unsigned int totedge;
index 90b65af87c8cf9e5538d9426e76a078006a85452..245a10a38c2b5fe8680125d678ece924695651d1 100644 (file)
@@ -66,7 +66,7 @@ void GPU_state_init(void);
  *   GPU_object_material_bind returns 0 if drawing should be skipped
  * - after drawing, the material must be disabled again */
 
-void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d, 
+void GPU_begin_object_materials(struct View3D *v3d, struct RegionView3D *rv3d,
                                 struct Scene *scene, struct Object *ob, bool glsl, bool *do_alpha_after);
 void GPU_end_object_materials(void);
 bool GPU_object_materials_check(void);
index 756fe79151b42550fc66740ce4841a2b09e63f73..1ae3d73991e50c5098e46f6f7e92914fb4d8ff8c 100644 (file)
@@ -39,7 +39,7 @@ extern "C" {
 struct Image;
 struct ImageUser;
 struct PreviewImage;
-       
+
 struct GPUFrameBuffer;
 typedef struct GPUTexture GPUTexture;
 
index 8505bd847a0c53a4d81280abe8637fabfb004c48..5d23de78451ef2d07cc580efa9b21fdb5c905baa 100644 (file)
@@ -295,7 +295,7 @@ void GPU_basic_shaders_init(void)
 void GPU_basic_shaders_exit(void)
 {
        int i;
-       
+
        for (i = 0; i < GPU_SHADER_OPTION_COMBINATIONS; i++)
                if (GPU_MATERIAL_STATE.cached_shaders[i])
                        GPU_shader_free(GPU_MATERIAL_STATE.cached_shaders[i]);
@@ -336,7 +336,7 @@ static int detect_options()
        glGetIntegerv(GL_LIGHT_MODEL_TWO_SIDE, &two_sided);
        if (two_sided == GL_TRUE)
                options |= GPU_SHADER_TWO_SIDED;
-       
+
        return options;
 }
 #endif
@@ -389,7 +389,7 @@ static GPUShader *gpu_basic_shader(int options)
                        geom_glsl,
                        NULL,
                        defines, 0, 0, 0);
-               
+
                if (shader) {
                        /* set texture map to first texture unit */
                        if (options & (GPU_SHADER_TEXTURE_2D | GPU_SHADER_TEXTURE_RECT)) {
index 38e847da967e00afd2db22de4ef56eba95d8fb92..a35f678f8dcbfddd8ca0987deb813c785a376d5b 100644 (file)
@@ -222,7 +222,7 @@ static void gpu_buffer_pool_free(GPUBufferPool *pool)
 {
        if (!pool)
                return;
-       
+
        while (pool->totbuf)
                gpu_buffer_pool_delete_last(pool);
 
@@ -236,7 +236,7 @@ static void gpu_buffer_pool_free_unused(GPUBufferPool *pool)
                return;
 
        BLI_mutex_lock(&buffer_mutex);
-       
+
        while (pool->totbuf)
                gpu_buffer_pool_delete_last(pool);
 
@@ -294,7 +294,7 @@ static GPUBuffer *gpu_buffer_alloc_intern(size_t size)
         * twice as big */
        for (i = 0; i < pool->totbuf; i++) {
                bufsize = pool->buffers[i]->size;
-               
+
                /* check for an exact size match */
                if (bufsize == size) {
                        bestfit = i;
@@ -621,7 +621,7 @@ void GPU_vertex_setup(DerivedMesh *dm)
        glEnableClientState(GL_VERTEX_ARRAY);
        glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->points->id);
        glVertexPointer(3, GL_FLOAT, 0, 0);
-       
+
        GLStates |= GPU_BUFFER_VERTEX_STATE;
 }
 
@@ -716,7 +716,7 @@ void GPU_edge_setup(DerivedMesh *dm)
        glEnableClientState(GL_VERTEX_ARRAY);
        glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->points->id);
        glVertexPointer(3, GL_FLOAT, 0, 0);
-       
+
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dm->drawObject->edges->id);
 
        GLStates |= (GPU_BUFFER_VERTEX_STATE | GPU_BUFFER_ELEMENT_STATE);
@@ -730,7 +730,7 @@ void GPU_uvedge_setup(DerivedMesh *dm)
        glEnableClientState(GL_VERTEX_ARRAY);
        glBindBuffer(GL_ARRAY_BUFFER, dm->drawObject->uvedges->id);
        glVertexPointer(2, GL_FLOAT, 0, 0);
-       
+
        GLStates |= GPU_BUFFER_VERTEX_STATE;
 }
 
@@ -792,7 +792,7 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
                elementsize = element_size;
 
        glBindBuffer(GL_ARRAY_BUFFER, buffer->id);
-       
+
        for (i = 0; i < numdata; i++) {
                glEnableVertexAttribArray(data[i].index);
                int info = 0;
@@ -804,13 +804,13 @@ void GPU_interleaved_attrib_setup(GPUBuffer *buffer, GPUAttrib data[], int numda
                glVertexAttribPointer(data[i].index, data[i].size, data[i].type,
                                         GL_TRUE, elementsize, BUFFER_OFFSET(offset));
                offset += data[i].size * gpu_typesize(data[i].type);
-               
+
                attribData[i].index = data[i].index;
                attribData[i].size = data[i].size;
                attribData[i].type = data[i].type;
        }
-       
-       attribData[numdata].index = -1; 
+
+       attribData[numdata].index = -1;
 }
 
 void GPU_interleaved_attrib_unbind(void)
@@ -952,7 +952,7 @@ typedef struct {
         * boundary; drastically increases viewport performance on my
         * drivers (Gallium/Radeon) --nicholasbishop */
        char pad[2];
-       
+
        unsigned char color[3];
 } VertexBufferFormat;
 
@@ -1283,7 +1283,7 @@ void GPU_pbvh_grid_buffers_update(
                                for (y = 0; y < key->grid_size; y++) {
                                        for (x = 0; x < key->grid_size; x++) {
                                                CCGElem *elem = CCG_grid_elem(key, grid, x, y);
-                                               
+
                                                copy_v3_v3(vd->co, CCG_elem_co(key, elem));
                                                if (buffers->smooth) {
                                                        normal_float_to_short_v3(vd->no, CCG_elem_no(key, elem));
@@ -1301,7 +1301,7 @@ void GPU_pbvh_grid_buffers_update(
                                                vd++;
                                        }
                                }
-                               
+
                                if (!buffers->smooth) {
                                        /* for flat shading, recalc normals and set the last vertex of
                                         * each triangle in the index buffer to have the flat normal as
@@ -1739,7 +1739,7 @@ void GPU_pbvh_bmesh_buffers_update(
                                                fmask += BM_ELEM_CD_GET_FLOAT(v[i], cd_vert_mask_offset);
                                        }
                                        fmask /= 3.0f;
-                                       
+
                                        for (i = 0; i < 3; i++) {
                                                gpu_bmesh_vert_to_buffer_copy(v[i], vert_data,
                                                                              &v_index, f->no, &fmask,
index b5512aa108d7e4531f789df3e5b468f9980d9dea..a9cef0b5ad31cb224218b32e50b0ef3a15f092be 100644 (file)
@@ -109,7 +109,7 @@ static int gpu_str_prefix(const char *str, const char *prefix)
                str++;
                prefix++;
        }
-       
+
        return (*prefix == '\0');
 }
 
@@ -221,7 +221,7 @@ static char *gpu_generate_function_prototyps(GHash *hash)
        GPUFunction *function;
        char *name, *prototypes;
        int a;
-       
+
        /* automatically generate function prototypes to add to the top of the
         * generated code, to avoid have to add the actual code & recompile all */
        ghi = BLI_ghashIterator_new(hash);
@@ -610,7 +610,7 @@ static void codegen_call_functions(DynStr *ds, ListBase *nodes, GPUOutput *final
 
        for (node = nodes->first; node; node = node->next) {
                BLI_dynstr_appendf(ds, "\t%s(", node->name);
-               
+
                for (input = node->inputs.first; input; input = input->next) {
                        if (input->source == GPU_SOURCE_TEX) {
                                BLI_dynstr_appendf(ds, "samp%d", input->texid);
@@ -740,7 +740,7 @@ static char *code_generate_vertex(ListBase *nodes, const GPUMatType type)
        GPUInput *input;
        char *code;
        char *vertcode = NULL;
-       
+
        for (node = nodes->first; node; node = node->next) {
                for (input = node->inputs.first; input; input = input->next) {
                        if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
@@ -781,7 +781,7 @@ static char *code_generate_vertex(ListBase *nodes, const GPUMatType type)
        }
 
        BLI_dynstr_append(ds, vertcode);
-       
+
        for (node = nodes->first; node; node = node->next)
                for (input = node->inputs.first; input; input = input->next)
                        if (input->source == GPU_SOURCE_ATTRIB && input->attribfirst) {
@@ -1084,7 +1084,7 @@ void GPU_pass_unbind(GPUPass *pass)
                if (input->ima || input->prv)
                        input->tex = NULL;
        }
-       
+
        GPU_shader_unbind();
 }
 
@@ -1105,7 +1105,7 @@ static void gpu_node_link_free(GPUNodeLink *link)
 
        if (link->users < 0)
                fprintf(stderr, "GPU_node_link_free: negative refcount\n");
-       
+
        if (link->users == 0) {
                if (link->output)
                        link->output->link = NULL;
@@ -1146,7 +1146,7 @@ static void gpu_node_input_link(GPUNode *node, GPUNodeLink *link, const GPUType
                        return;
                }
        }
-       
+
        input = MEM_callocN(sizeof(GPUInput), "GPUInput");
        input->node = node;
 
@@ -1372,7 +1372,7 @@ static void gpu_nodes_get_builtin_flag(ListBase *nodes, int *builtin)
 {
        GPUNode *node;
        GPUInput *input;
-       
+
        *builtin = 0;
 
        for (node = nodes->first; node; node = node->next)
@@ -1443,10 +1443,10 @@ GPUNodeLink *GPU_cube_map(Image *ima, ImageUser *iuser, bool is_data)
 GPUNodeLink *GPU_image_preview(PreviewImage *prv)
 {
        GPUNodeLink *link = GPU_node_link_create();
-       
+
        link->image = GPU_NODE_LINK_IMAGE_PREVIEW;
        link->ptr1 = prv;
-       
+
        return link;
 }
 
@@ -1550,7 +1550,7 @@ bool GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNod
                        totin++;
                }
        }
-       
+
        if (out) {
                for (i = 0; out[i].type != GPU_NONE; i++) {
                        gpu_node_output(node, out[i].type, &out[i].link);
@@ -1583,7 +1583,7 @@ bool GPU_stack_link(GPUMaterial *mat, const char *name, GPUNodeStack *in, GPUNod
        va_end(params);
 
        gpu_material_add_node(mat, node);
-       
+
        return true;
 }
 
@@ -1621,7 +1621,7 @@ static void gpu_nodes_tag(GPUNodeLink *link)
        node = link->output->node;
        if (node->tag)
                return;
-       
+
        node->tag = true;
        for (input = node->inputs.first; input; input = input->next)
                if (input->link)
@@ -1704,7 +1704,7 @@ GPUPass *GPU_generate_pass(
                gpu_nodes_free(nodes);
                return NULL;
        }
-       
+
        /* create pass */
        pass = MEM_callocN(sizeof(GPUPass), "GPUPass");
 
index 514f2f71bd7de4d5cde20078687af6d9dd9c6259..947cd43d27b0e846b4494017771a2159d1b6af56 100644 (file)
@@ -122,10 +122,10 @@ void GPU_render_text(
                Image *ima = (Image *)mtexpoly->tpage;
                const size_t textlen_st = textlen;
                float centerx, centery, sizex, sizey, transx, transy, movex, movey, advance;
-               
+
                /* multiline */
                float line_start = 0.0f, line_height;
-               
+
                if (v4)
                        line_height = max_ffff(v1[1], v2[1], v3[1], v4[2]) - min_ffff(v1[1], v2[1], v3[1], v4[2]);
                else
@@ -133,7 +133,7 @@ void GPU_render_text(
                line_height *= 1.2f; /* could be an option? */
                /* end multiline */
 
-               
+
                /* color has been set */
                if (mtexpoly->mode & TF_OBCOL)
                        col = NULL;
@@ -141,22 +141,22 @@ void GPU_render_text(
                        glColor3f(1.0f, 1.0f, 1.0f);
 
                glPushMatrix();
-               
+
                /* get the tab width */
                ImBuf *first_ibuf = BKE_image_get_first_ibuf(ima);
                matrixGlyph(first_ibuf, ' ', &centerx, &centery,
                        &sizex, &sizey, &transx, &transy, &movex, &movey, &advance);
-               
+
                float advance_tab = advance * 4; /* tab width could also be an option */
-               
-               
+
+
                for (size_t index = 0; index < textlen_st; ) {
                        unsigned int character;
                        float uv[4][2];
 
                        /* lets calculate offset stuff */
                        character = BLI_str_utf8_as_unicode_and_size_safe(textstr + index, &index);
-                       
+
                        if (character == '\n') {
                                glTranslatef(line_start, -line_height, 0.0f);
                                line_start = 0.0f;
@@ -166,13 +166,13 @@ void GPU_render_text(
                                glTranslatef(advance_tab, 0.0f, 0.0f);
                                line_start -= advance_tab; /* so we can go back to the start of the line */
                                continue;
-                               
+
                        }
                        else if (character > USHRT_MAX) {
                                /* not much we can do here bmfonts take ushort */
                                character = '?';
                        }
-                       
+
                        /* space starts at offset 1 */
                        /* character = character - ' ' + 1; */
                        matrixGlyph(first_ibuf, character, & centerx, &centery,
@@ -184,13 +184,13 @@ void GPU_render_text(
                        uv[1][1] = (uv_quad[1][1] - centery) * sizey + transy;
                        uv[2][0] = (uv_quad[2][0] - centerx) * sizex + transx;
                        uv[2][1] = (uv_quad[2][1] - centery) * sizey + transy;
-                       
+
                        glBegin(GL_POLYGON);
                        if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[0]);
                        else glTexCoord2fv(uv[0]);
                        if (col) gpu_mcol(col[0]);
                        glVertex3f(sizex * v1[0] + movex, sizey * v1[1] + movey, v1[2]);
-                       
+
                        if (glattrib >= 0) glVertexAttrib2fv(glattrib, uv[1]);
                        else glTexCoord2fv(uv[1]);
                        if (col) gpu_mcol(col[1]);
@@ -419,7 +419,7 @@ void GPU_clear_tpage(bool force)
 {
        if (GTS.lasttface == NULL && !force)
                return;
-       
+
        GTS.lasttface = NULL;
        GTS.curtile = 0;
        GTS.curima = NULL;
@@ -432,7 +432,7 @@ void GPU_clear_tpage(bool force)
        GTS.curtileXRep = 0;
        GTS.curtileYRep = 0;
        GTS.alphablend = -1;
-       
+
        glDisable(GL_BLEND);
        glDisable(GL_TEXTURE_2D);
        glDisable(GL_TEXTURE_GEN_S);
@@ -460,7 +460,7 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend)
 
                /* for OpenGL render we use the alpha channel, this makes alpha blend correct */
                glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
-               
+
                /* if U.glalphaclip == 1.0, some cards go bonkers...
                 * turn off alpha test in this case */
 
@@ -652,29 +652,29 @@ int GPU_verify_image(
                GPU_free_image(ima);
                ima->tpageflag &= ~IMA_TPAGE_REFRESH;
        }
-       
+
        if (GTS.tilemode) {
                /* tiled mode */
                if (ima->repbind == NULL) gpu_make_repbind(ima);
                if (GTS.tile >= ima->totbind) GTS.tile = 0;
-               
+
                /* this happens when you change repeat buttons */
                if (ima->repbind && textarget == GL_TEXTURE_2D) bind = &ima->repbind[GTS.tile];
                else bind = gpu_get_image_bindcode(ima, textarget);
-               
+
                if (*bind == 0) {
                        short texwindx = ibuf->x / ima->xrep;
                        short texwindy = ibuf->y / ima->yrep;
-                       
+
                        if (GTS.tile >= ima->xrep * ima->yrep)
                                GTS.tile = ima->xrep * ima->yrep - 1;
-       
+
                        short texwinsy = GTS.tile / ima->xrep;
                        short texwinsx = GTS.tile - texwinsy * ima->xrep;
-       
+
                        texwinsx *= texwindx;
                        texwinsy *= texwindy;
-       
+
                        tpx = texwindx;
                        tpy = texwindy;
 
@@ -748,7 +748,7 @@ int GPU_verify_image(
 
                                memcpy(tilerectrow, rectrow, tpx * sizeof(*rectrow));
                        }
-                       
+
                        rect = tilerect;
                }
        }
@@ -759,13 +759,13 @@ int GPU_verify_image(
        else
 #endif
                GPU_create_gl_tex(bind, rect, frect, rectw, recth, textarget, mipmap, use_high_bit_depth, ima);
-       
+
        /* mark as non-color data texture */
        if (*bind) {
                if (is_data)
-                       ima->tpageflag |= IMA_GLBIND_IS_DATA;   
+                       ima->tpageflag |= IMA_GLBIND_IS_DATA;
                else
-                       ima->tpageflag &= ~IMA_GLBIND_IS_DATA;  
+                       ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
        }
 
        /* clean up */
@@ -859,7 +859,7 @@ void GPU_create_gl_tex(
        int tpy = recth;
 
        /* 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
         * Then don't bother scaling for hardware that supports NPOT textures! */
        if (textarget == GL_TEXTURE_2D &&
            ((!GPU_full_non_power_of_two_support() && !is_power_of_2_resolution(rectw, recth)) ||
@@ -1130,7 +1130,7 @@ int GPU_set_tpage(MTexPoly *mtexpoly, int mipmap, int alphablend)
        }
        else {
                glDisable(GL_TEXTURE_2D);
-               
+
                GTS.curtile = 0;
                GTS.curima = NULL;
                GTS.curtilemode = 0;
@@ -1139,9 +1139,9 @@ int GPU_set_tpage(MTexPoly *mtexpoly, int mipmap, int alphablend)
 
                return 0;
        }
-       
+
        gpu_verify_repeat(ima);
-       
+
        /* Did this get lost in the image recode? */
        /* BKE_image_tag_time(ima);*/
 
@@ -1296,7 +1296,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
                        float *buffer = MEM_mallocN(w * h * sizeof(float) * 4, "temp_texpaint_float_buf");
                        bool is_data = (ima->tpageflag & IMA_GLBIND_IS_DATA) != 0;
                        IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h, is_data);
-                       
+
                        if (gpu_check_scaled_image(ibuf, ima, buffer, x, y, w, h)) {
                                MEM_freeN(buffer);
                                BKE_image_release_ibuf(ima, ibuf, NULL);
@@ -1361,9 +1361,9 @@ void GPU_update_images_framechange(void)
                if (ima->tpageflag & IMA_TWINANIM) {
                        if (ima->twend >= ima->xrep * ima->yrep)
                                ima->twend = ima->xrep * ima->yrep - 1;
-               
+
                        /* check: is bindcode not in the array? free. (to do) */
-                       
+
                        ima->lastframe++;
                        if (ima->lastframe > ima->twend)
                                ima->lastframe = ima->twsta;
@@ -1386,9 +1386,9 @@ int GPU_update_image_time(Image *ima, double time)
 
        if (ima->tpageflag & IMA_TWINANIM) {
                if (ima->twend >= ima->xrep * ima->yrep) ima->twend = ima->xrep * ima->yrep - 1;
-               
+
                /* check: is the bindcode not in the array? Then free. (still to do) */
-               
+
                float diff = (float)((float)time - ima->lastupdate);
                inc = (int)(diff * (float)ima->animspeed);
 
@@ -1528,7 +1528,7 @@ void GPU_free_image(Image *ima)
        /* free repeated image binding */
        if (ima->repbind) {
                glDeleteTextures(ima->totbind, (GLuint *)ima->repbind);
-       
+
                MEM_freeN(ima->repbind);
                ima->repbind = NULL;
        }
@@ -1601,7 +1601,7 @@ typedef struct GPUMaterialFixed {
        float spec[3];
        int hard;
        float alpha;
-} GPUMaterialFixed; 
+} GPUMaterialFixed;
 
 static struct GPUMaterialState {
        GPUMaterialFixed (*matbuf);
@@ -1657,12 +1657,12 @@ static void gpu_material_to_fixed(
                copy_v3_v3(smat->spec, &bmat->specr);
                smat->alpha = 1.0f;
                smat->hard = CLAMPIS(bmat->har, 0, 128);
-               
+
                if (dimdown) {
                        mul_v3_fl(smat->diff, 0.8f);
                        mul_v3_fl(smat->spec, 0.5f);
                }
-               
+
                if (gamma) {
                        linearrgb_to_srgb_v3_v3(smat->diff, smat->diff);
                        linearrgb_to_srgb_v3_v3(smat->spec, smat->spec);
@@ -1673,7 +1673,7 @@ static void gpu_material_to_fixed(
 
                if (bmat->shade_flag & MA_OBCOLOR)
                        mul_v3_v3(smat->diff, ob->col);
-               
+
                mul_v3_v3fl(smat->spec, &bmat->specr, bmat->spec);
                smat->hard = CLAMPIS(bmat->har, 1, 128);
                smat->alpha = 1.0f;
@@ -1789,7 +1789,7 @@ void GPU_begin_object_materials(
        GMS.is_alpha_pass = (v3d->transp != false);
        if (GMS.use_alpha_pass)
                *do_alpha_after = false;
-       
+
        if (GMS.totmat > FIXEDMAT) {
                GMS.matbuf = MEM_callocN(sizeof(GPUMaterialFixed) * GMS.totmat, "GMS.matbuf");
                GMS.gmatbuf = MEM_callocN(sizeof(*GMS.gmatbuf) * GMS.totmat, "GMS.matbuf");
@@ -1808,11 +1808,11 @@ void GPU_begin_object_materials(
 
                /* do material 1 too, for displists! */
                memcpy(&GMS.matbuf[1], &GMS.matbuf[0], sizeof(GPUMaterialFixed));
-       
+
                GMS.alphablend[0] = GPU_BLEND_SOLID;
        }
        else {
-       
+
                /* no materials assigned? */
                if (ob->totcol == 0) {
                        gpu_material_to_fixed(&GMS.matbuf[0], &defmaterial, 0, ob, new_shading_nodes, true);
@@ -1827,7 +1827,7 @@ void GPU_begin_object_materials(
 
                        GMS.alphablend[0] = GPU_BLEND_SOLID;
                }
-               
+
                /* setup materials */
                for (a = 1; a <= ob->totcol; a++) {
                        /* find a suitable material */
@@ -1986,7 +1986,7 @@ int GPU_object_material_bind(int nr, void *attribs)
                        if (GMS.dob) {
                                gpu_get_particle_info(&partile_info);
                        }
-                       
+
                        if (GPU_get_material_builtins(gpumat) & GPU_OBJECT_INFO) {
                                GPU_get_object_info(object_info, mat);
                        }
@@ -2064,7 +2064,7 @@ void GPU_set_material_alpha_blend(int alphablend)
 {
        if (GMS.lastalphablend == alphablend)
                return;
-       
+
        gpu_set_alpha_blend(alphablend);
        GMS.lastalphablend = alphablend;
 }
@@ -2155,13 +2155,13 @@ int GPU_default_lights(void)
                U.light[0].col[0] = 0.8; U.light[0].col[1] = 0.8; U.light[0].col[2] = 0.8;
                U.light[0].spec[0] = 0.5; U.light[0].spec[1] = 0.5; U.light[0].spec[2] = 0.5;
                U.light[0].spec[3] = 1.0;
-               
+
                U.light[1].flag = 0;
                U.light[1].vec[0] = 0.5; U.light[1].vec[1] = 0.5; U.light[1].vec[2] = 0.1;
                U.light[1].col[0] = 0.4; U.light[1].col[1] = 0.4; U.light[1].col[2] = 0.8;
                U.light[1].spec[0] = 0.3; U.light[1].spec[1] = 0.3; U.light[1].spec[2] = 0.5;
                U.light[1].spec[3] = 1.0;
-       
+
                U.light[2].flag = 0;
                U.light[2].vec[0] = 0.3; U.light[2].vec[1] = -0.3; U.light[2].vec[2] = -0.2;
                U.light[2].col[0] = 0.8; U.light[2].col[1] = 0.5; U.light[2].col[2] = 0.4;
@@ -2199,7 +2199,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][
        /* disable all lights */
        for (int count = 0; count < 8; count++)
                GPU_basic_shader_light_set(count, NULL);
-       
+
        /* view direction for specular is not computed correct by default in
         * opengl, so we set the settings ourselves */
        GPU_basic_shader_light_set_viewer(!ortho);
@@ -2214,11 +2214,11 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][
                        continue;
 
                Lamp *la = base->object->data;
-               
+
                /* setup lamp transform */
                glPushMatrix();
                glLoadMatrixf((float *)viewmat);
-               
+
                /* setup light */
                GPULightData light = {0};
 
@@ -2237,7 +2237,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][
                        light.constant_attenuation = 1.0f;
                        light.linear_attenuation = la->att1 / la->dist;
                        light.quadratic_attenuation = la->att2 / (la->dist * la->dist);
-                       
+
                        if (la->type == LA_SPOT) {
                                light.type = GPU_LIGHT_SPOT;
                                negate_v3_v3(light.direction, base->object->obmat[2]);
@@ -2248,11 +2248,11 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[4][
                        else
                                light.type = GPU_LIGHT_POINT;
                }
-               
+
                GPU_basic_shader_light_set(count, &light);
-               
+
                glPopMatrix();
-               
+
                count++;
                if (count == 8)
                        break;
@@ -2301,7 +2301,7 @@ void GPU_state_init(void)
 {
        float mat_ambient[] = { 0.0, 0.0, 0.0, 0.0 };
        float mat_specular[] = { 0.5, 0.5, 0.5, 1.0 };
-       
+
        glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, mat_ambient);
        glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, mat_specular);
        glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, mat_specular);
@@ -2309,7 +2309,7 @@ void GPU_state_init(void)
        glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
 
        GPU_default_lights();
-       
+
        glDepthFunc(GL_LEQUAL);
        /* scaling matrices */
        glEnable(GL_NORMALIZE);
@@ -2331,7 +2331,7 @@ void GPU_state_init(void)
        glDisableClientState(GL_NORMAL_ARRAY);
        glDisableClientState(GL_COLOR_ARRAY);
        glDisableClientState(GL_TEXTURE_COORD_ARRAY);
-       
+
        glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
        glPixelTransferi(GL_RED_SCALE, 1);
        glPixelTransferi(GL_RED_BIAS, 0);
@@ -2341,7 +2341,7 @@ void GPU_state_init(void)
        glPixelTransferi(GL_BLUE_BIAS, 0);
        glPixelTransferi(GL_ALPHA_SCALE, 1);
        glPixelTransferi(GL_ALPHA_BIAS, 0);
-       
+
        glPixelTransferi(GL_DEPTH_BIAS, 0);
        glPixelTransferi(GL_DEPTH_SCALE, 1);
        glDepthRange(0.0, 1.0);
index e7a8beae5cc93aa5b36760221f1f9fe429787326..eafa29e6739c50cbed0c1b5a1e9ff88c3f5add67 100644 (file)
@@ -106,7 +106,7 @@ GPUFrameBuffer *GPU_framebuffer_create(void)
        {
                return NULL;
        }
-       
+
        fb = MEM_callocN(sizeof(GPUFrameBuffer), "GPUFrameBuffer");
        glGenFramebuffersEXT(1, &fb->object);
 
@@ -122,7 +122,7 @@ GPUFrameBuffer *GPU_framebuffer_create(void)
        glReadBuffer(GL_NONE);
        glDrawBuffer(GL_NONE);
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
-       
+
        return fb;
 }
 
@@ -157,7 +157,7 @@ int GPU_framebuffer_texture_attach(GPUFrameBuffer *fb, GPUTexture *tex, int slot
        /* Clean glError buffer. */
        while (glGetError() != GL_NO_ERROR) {}
 
-       glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment, 
+       glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, attachment,
                GPU_texture_target(tex), GPU_texture_opengl_bindcode(tex), 0);
 
        error = glGetError();
@@ -233,7 +233,7 @@ void GPU_texture_bind_as_framebuffer(GPUTexture *tex)
                glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + fb_attachment);
                glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + fb_attachment);
        }
-       
+
        if (GPU_texture_target(tex) == GL_TEXTURE_2D_MULTISAMPLE) {
                glEnable(GL_MULTISAMPLE);
        }
@@ -252,19 +252,19 @@ void GPU_framebuffer_slots_bind(GPUFrameBuffer *fb, int slot)
 {
        int numslots = 0, i;
        GLenum attachments[4];
-       
+
        if (!fb->colortex[slot]) {
                fprintf(stderr, "Error, framebuffer slot empty!\n");
                return;
        }
-       
+
        for (i = 0; i < 4; i++) {
                if (fb->colortex[i]) {
                        attachments[numslots] = GL_COLOR_ATTACHMENT0_EXT + i;
                        numslots++;
                }
        }
-       
+
        /* push attributes */
        glPushAttrib(GL_ENABLE_BIT | GL_VIEWPORT_BIT);
        glDisable(GL_SCISSOR_TEST);
@@ -320,21 +320,21 @@ bool GPU_framebuffer_bound(GPUFrameBuffer *fb)
 bool GPU_framebuffer_check_valid(GPUFrameBuffer *fb, char err_out[256])
 {
        GLenum status;
-       
+
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb->object);
        GG.currentfb = fb->object;
-       
+
        /* Clean glError buffer. */
        while (glGetError() != GL_NO_ERROR) {}
-       
+
        status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
-       
+
        if (status != GL_FRAMEBUFFER_COMPLETE_EXT) {
                GPU_framebuffer_restore();
                gpu_print_framebuffer_error(status, err_out);
                return false;
        }
-       
+
        return true;
 }
 
@@ -385,14 +385,14 @@ void GPU_framebuffer_blur(
 
        scale_uniform = GPU_shader_get_uniform(blur_shader, "ScaleU");
        texture_source_uniform = GPU_shader_get_uniform(blur_shader, "textureSource");
-               
+
        /* Blurring horizontally */
 
        /* We do the bind ourselves rather than using GPU_framebuffer_texture_bind() to avoid
         * pushing unnecessary matrices onto the OpenGL stack. */
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, blurfb->object);
        glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
-       
+
        /* avoid warnings from texture binding */
        GG.currentfb = blurfb->object;
 
@@ -425,9 +425,9 @@ void GPU_framebuffer_blur(
 
        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb->object);
        glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
-       
+
        GG.currentfb = fb->object;
-       
+
        glViewport(0, 0, GPU_texture_width(tex), GPU_texture_height(tex));
        GPU_shader_uniform_vector(blur_shader, scale_uniform, 2, 1, scalev);
        GPU_shader_uniform_texture(blur_shader, texture_source_uniform, blurtex);
@@ -499,11 +499,11 @@ GPUOffScreen *GPU_offscreen_create(int width, int height, int samples, char err_
                GPU_offscreen_free(ofs);
                return NULL;
        }
-       
+
        /* check validity at the very end! */
        if (!GPU_framebuffer_check_valid(ofs->fb, err_out)) {
                GPU_offscreen_free(ofs);
-               return NULL;            
+               return NULL;
        }
 
        GPU_framebuffer_restore();
@@ -519,7 +519,7 @@ void GPU_offscreen_free(GPUOffScreen *ofs)
                GPU_texture_free(ofs->color);
        if (ofs->depth)
                GPU_texture_free(ofs->depth);
-       
+
        MEM_freeN(ofs);
 }
 
index b67b50d97fb367a3f05f6eee1322bb0ba0412e5b..40ff9ca629b8ac69d614c510060dc4687a62ac25 100644 (file)
@@ -98,7 +98,7 @@ struct GPUMaterial {
        /* material for mesh surface, worlds or something else.
         * some code generation is done differently depending on the use case */
        int type;
-       
+
        /* for creating the material */
        ListBase nodes;
        GPUNodeLink *outlink;
@@ -198,7 +198,7 @@ static void gpu_material_set_attrib_id(GPUMaterial *material)
                attribs->totlayer = 0;
                return;
        }
-       
+
        GPUShader *shader = GPU_pass_shader(pass);
        if (!shader) {
                attribs->totlayer = 0;
@@ -241,7 +241,7 @@ static int gpu_material_construct_end(GPUMaterial *material, const char *passnam
                        return 0;
 
                gpu_material_set_attrib_id(material);
-               
+
                GPUShader *shader = GPU_pass_shader(material->pass);
 
                if (material->builtins & GPU_VIEW_MATRIX)
@@ -294,7 +294,7 @@ void GPU_material_free(ListBase *gpumaterial)
 
                        if (material->ma) {
                                Material *ma = material->ma;
-                               
+
                                LinkData *next = NULL;
                                for (LinkData *mlink = lamp->materials.first; mlink; mlink = next) {
                                        next = mlink->next;
@@ -303,7 +303,7 @@ void GPU_material_free(ListBase *gpumaterial)
                                }
                        }
                }
-               
+
                BLI_freelistN(&material->lamps);
 
                MEM_freeN(material);
@@ -339,7 +339,7 @@ void GPU_material_bind(
                if (material->type == GPU_MATERIAL_TYPE_MESH) {
                        for (LinkData *nlink = material->lamps.first; nlink; nlink = nlink->next) {
                                GPULamp *lamp = nlink->data;
-                               
+
                                if ((lamp->lay & viewlay) && (!(lamp->mode & LA_LAYER) || (lamp->lay & oblay)) &&
                                    GPU_lamp_visible(lamp, srl, material->ma))
                                {
@@ -350,23 +350,23 @@ void GPU_material_bind(
                                        lamp->dynenergy = 0.0f;
                                        lamp->dyncol[0] = lamp->dyncol[1] = lamp->dyncol[2] = 0.0f;
                                }
-                               
+
                                if (material->dynproperty & DYN_LAMP_VEC) {
                                        copy_v3_v3(lamp->dynvec, lamp->vec);
                                        normalize_v3(lamp->dynvec);
                                        negate_v3(lamp->dynvec);
                                        mul_mat3_m4_v3(viewmat, lamp->dynvec);
                                }
-                               
+
                                if (material->dynproperty & DYN_LAMP_CO) {
                                        copy_v3_v3(lamp->dynco, lamp->co);
                                        mul_m4_v3(viewmat, lamp->dynco);
                                }
-                               
+
                                if (material->dynproperty & DYN_LAMP_IMAT) {
                                        mul_m4_m4m4(lamp->dynimat, lamp->imat, viewinv);
                                }
-                               
+
                                if (material->dynproperty & DYN_LAMP_PERSMAT) {
                                        /* The lamp matrices are already updated if we're using shadow buffers */
                                        if (!GPU_lamp_has_shadow_buffer(lamp)) {
@@ -376,7 +376,7 @@ void GPU_material_bind(
                                }
                        }
                }
-               
+
                /* note material must be bound before setting uniforms */
                GPU_pass_bind(material->pass, time, mipmap);
 
@@ -620,7 +620,7 @@ static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNode
                                GPU_dynamic_uniform((float *)lamp->dynimat, GPU_DYNAMIC_LAMP_DYNIMAT, lamp->ob),
                                GPU_dynamic_uniform((float *)lamp->spotvec, GPU_DYNAMIC_LAMP_SPOTSCALE, lamp->ob), *lv, &inpr);
                        }
-                       
+
                        GPU_link(mat, "lamp_visibility_spot",
                                 GPU_dynamic_uniform(&lamp->spotsi, GPU_DYNAMIC_LAMP_SPOTSIZE, lamp->ob),
                                 GPU_dynamic_uniform(&lamp->spotbl, GPU_DYNAMIC_LAMP_SPOTBLEND, lamp->ob),
@@ -709,7 +709,7 @@ static void ramp_diffuse_result(GPUShadeInput *shi, GPUNodeLink **diff)
                        if (ma->rampin_col == MA_RAMP_IN_RESULT) {
                                GPUNodeLink *fac;
                                GPU_link(mat, "ramp_rgbtobw", *diff, &fac);
-                               
+
                                /* colorband + blend */
                                BKE_colorband_eval_blend(mat, ma->ramp_col, fac, ma->rampfac_col, ma->rampblend_col, *diff, diff);
                        }
@@ -722,7 +722,7 @@ static void add_to_diffuse(
         GPUNodeLink **r_diff)
 {
        GPUNodeLink *fac, *tmp, *addcol;
-       
+
        if (!(mat->scene->gm.flag & GAME_GLSL_NO_RAMPS) &&
            ma->ramp_col && (ma->mode & MA_RAMP_COL))
        {
@@ -768,7 +768,7 @@ static void ramp_spec_result(GPUShadeInput *shi, GPUNodeLink **spec)
        {
                GPUNodeLink *fac;
                GPU_link(mat, "ramp_rgbtobw", *spec, &fac);
-               
+
                /* colorband + blend */
                BKE_colorband_eval_blend(mat, ma->ramp_spec, fac, ma->rampfac_spec, ma->rampblend_spec, *spec, spec);
        }
@@ -784,7 +784,7 @@ static void do_specular_ramp(GPUShadeInput *shi, GPUNodeLink *is, GPUNodeLink *t
 
        /* MA_RAMP_IN_RESULT is exception */
        if (ma->ramp_spec && (ma->rampin_spec != MA_RAMP_IN_RESULT)) {
-               
+
                /* input */
                switch (ma->rampin_spec) {
                        case MA_RAMP_IN_ENERGY:
@@ -800,7 +800,7 @@ static void do_specular_ramp(GPUShadeInput *shi, GPUNodeLink *is, GPUNodeLink *t
                                GPU_link(mat, "set_value_zero", &fac);
                                break;
                }
-               
+
                /* colorband + blend */
                BKE_colorband_eval_blend(mat, ma->ramp_spec, fac, ma->rampfac_spec, ma->rampblend_spec, *spec, spec);
        }
@@ -844,7 +844,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
 
        if ((lamp->mode & LA_ONLYSHADOW) && !(ma->mode & MA_SHADOW))
                return;
-       
+
        GPUNodeLink *vn = shi->vn;
        GPUNodeLink *view = shi->view;
 
@@ -854,7 +854,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        if (ma->mode & MA_TANGENT_V)
                GPU_link(mat, "shade_tangent_v", lv, GPU_attribute(CD_TANGENT, ""), &vn);
 #endif
-       
+
        GPU_link(mat, "shade_inp", vn, lv, &inp);
 
        if (lamp->mode & LA_NO_DIFF) {
@@ -898,10 +898,10 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADERS))
                if (ma->shade_flag & MA_CUBIC)
                        GPU_link(mat, "shade_cubic", is, &is);
-       
+
        i = is;
        GPU_link(mat, "shade_visifac", i, visifac, shi->refl, &i);
-       
+
        GPU_link(mat, "set_rgb", GPU_dynamic_uniform(lamp->dyncol, GPU_DYNAMIC_LAMP_DYNCOL, lamp->ob), &lcol);
        shade_light_textures(mat, lamp, &lcol);
        GPU_link(mat, "shade_mul_value_v3",
@@ -918,7 +918,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
        if ((ma->mode & MA_SHADOW) && GPU_lamp_has_shadow_buffer(lamp)) {
                if (!(mat->scene->gm.flag & GAME_GLSL_NO_SHADOWS)) {
                        mat->dynproperty |= DYN_LAMP_PERSMAT;
-                       
+
                        if (lamp->la->shadowmap_type == LA_SHADMAP_VARIANCE) {
                                GPU_link(mat, "test_shadowbuf_vsm",
                                         GPU_builtin(GPU_VIEW_POSITION),
@@ -933,13 +933,13 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                                         GPU_dynamic_uniform((float *)lamp->dynpersmat, GPU_DYNAMIC_LAMP_DYNPERSMAT, lamp->ob),
                                         GPU_uniform(&lamp->bias), inp, &shadfac);
                        }
-                       
+
                        if (lamp->mode & LA_ONLYSHADOW) {
                                GPUNodeLink *shadrgb;
                                GPU_link(mat, "shade_only_shadow", i, shadfac,
                                        GPU_dynamic_uniform(&lamp->dynenergy, GPU_DYNAMIC_LAMP_DYNENERGY, lamp->ob),
                                        GPU_uniform(lamp->shadow_color), &shadrgb);
-                               
+
                                if (!(lamp->mode & LA_NO_DIFF)) {
                                        GPU_link(mat, "shade_only_shadow_diffuse", shadrgb, shi->rgb,
                                                 shr->diff, &shr->diff);
@@ -949,7 +949,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                                        GPU_link(mat, "shade_only_shadow_specular", shadrgb, shi->specrgb,
                                                 shr->spec, &shr->spec);
                                }
-                               
+
                                add_user_list(&mat->lamps, lamp);
                                add_user_list(&lamp->materials, shi->gpumat->ma);
                                return;
@@ -1009,7 +1009,7 @@ static void shade_one_light(GPUShadeInput *shi, GPUShadeResult *shr, GPULamp *la
                        if (lamp->type == LA_AREA)
                                GPU_link(mat, "shade_spec_area_inp", specfac, inp, &specfac);
 
-                       GPU_link(mat, "shade_spec_t", shadfac, shi->spec, visifac, specfac, &t); 
+                       GPU_link(mat, "shade_spec_t", shadfac, shi->spec, visifac, specfac, &t);
 
                        if (ma->mode & MA_RAMP_SPEC) {
                                GPUNodeLink *spec;
@@ -1032,7 +1032,7 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
 {
        Base *base;
        Scene *sce_iter;
-       
+
        for (SETLOOPER(shi->gpumat->scene, sce_iter, base)) {
                Object *ob = base->object;
 
@@ -1044,7 +1044,7 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
 
                if (ob->transflag & OB_DUPLI) {
                        ListBase *lb = object_duplilist(G.main->eval_ctx, shi->gpumat->scene, ob);
-                       
+
                        for (DupliObject *dob = lb->first; dob; dob = dob->next) {
                                Object *ob_iter = dob->ob;
 
@@ -1060,7 +1060,7 @@ static void material_lights(GPUShadeInput *shi, GPUShadeResult *shr)
                                        copy_m4_m4(ob_iter->obmat, omat);
                                }
                        }
-                       
+
                        free_object_duplilist(lb);
                }
        }
@@ -1204,10 +1204,10 @@ static void do_material_tex(GPUShadeInput *shi)
        for (int tex_nr = 0; tex_nr < MAX_MTEX; tex_nr++) {
                /* separate tex switching */
                if (ma->septex & (1 << tex_nr)) continue;
-               
+
                if (ma->mtex[tex_nr]) {
                        mtex = ma->mtex[tex_nr];
-                       
+
                        tex = mtex->tex;
                        if (tex == NULL) continue;
 
@@ -1319,7 +1319,7 @@ static void do_material_tex(GPUShadeInput *shi)
                                                GPU_link(mat, "srgb_to_linearrgb", tcol, &tcol);
                                        }
                                }
-                               
+
                                if (mtex->mapto & MAP_COL) {
                                        GPUNodeLink *colfac;
 
@@ -1328,7 +1328,7 @@ static void do_material_tex(GPUShadeInput *shi)
 
                                        texture_rgb_blend(mat, tcol, shi->rgb, tin, colfac, mtex->blendtype, &shi->rgb);
                                }
-                               
+
                                if (!(mat->scene->gm.flag & GAME_GLSL_NO_EXTRA_TEX) && (mtex->mapto & MAP_COLSPEC)) {
                                        GPUNodeLink *colspecfac;
 
@@ -1360,7 +1360,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);
-                                               
+
                                                if (mtex->norfac < 0.0f)
                                                        GPU_link(mat, "mtex_negate_texnormal", tnor, &tnor);
 
@@ -1391,21 +1391,21 @@ static void do_material_tex(GPUShadeInput *shi)
                                                        /* no transform, normal in camera space */
                                                        newnor = tnor;
                                                }
-                                               
+
                                                float norfac = min_ff(fabsf(mtex->norfac), 1.0f);
-                                               
+
                                                if (norfac == 1.0f && !GPU_link_changed(stencil)) {
                                                        shi->vn = newnor;
                                                }
                                                else {
                                                        tnorfac = GPU_uniform(&norfac);
-       
+
                                                        if (GPU_link_changed(stencil))
                                                                GPU_link(mat, "math_multiply", tnorfac, stencil, &tnorfac);
-       
+
                                                        GPU_link(mat, "mtex_blend_normal", tnorfac, shi->vn, newnor, &shi->vn);
                                                }
-                                               
+
                                        }
                                        else if (found_deriv_map ||
                                                 (mtex->texflag & (MTEX_3TAP_BUMP | MTEX_5TAP_BUMP | MTEX_BICUBIC_BUMP)))
@@ -1416,7 +1416,7 @@ static void do_material_tex(GPUShadeInput *shi)
 
                                                float imag_tspace_dimension_x = 1024.0f; /* only used for texture space variant */
                                                float aspect = 1.0f;
-                                               
+
                                                GPUNodeLink *vR1, *vR2;
                                                GPUNodeLink *dBs, *dBt, *fDet;
 
@@ -1452,17 +1452,17 @@ static void do_material_tex(GPUShadeInput *shi)
 
                                                if (found_deriv_map)
                                                        GPU_link(mat, "math_multiply", tnorfac, GPU_builtin(GPU_AUTO_BUMPSCALE), &tnorfac);
-                                               
+
                                                if (GPU_link_changed(stencil))
                                                        GPU_link(mat, "math_multiply", tnorfac, stencil, &tnorfac);
-                                               
+
                                                if (!init_done) {
                                                        /* 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;
                                                }
-                                               
+
                                                // find current bump space
                                                if (mtex->texflag & MTEX_BUMP_OBJECTSPACE)
                                                        iBumpSpace = 1;
@@ -1470,7 +1470,7 @@ static void do_material_tex(GPUShadeInput *shi)
                                                        iBumpSpace = 2;
                                                else
                                                        iBumpSpace = 4; /* ViewSpace */
-                                               
+
                                                /* re-initialize if bump space changed */
                                                if (iBumpSpacePrev != iBumpSpace) {
                                                        GPUNodeLink *surf_pos = GPU_builtin(GPU_VIEW_POSITION);
@@ -1485,25 +1485,25 @@ static void do_material_tex(GPUShadeInput *shi)
                                                                         fPrevMagnitude, vNacc,
                                                                         &fPrevMagnitude, &vNacc,
                                                                         &vR1, &vR2, &fDet);
-                                                               
+
                                                        else if (mtex->texflag & MTEX_BUMP_TEXTURESPACE)
                                                                GPU_link(mat, "mtex_bump_init_texturespace",
                                                                         surf_pos, vNorg,
                                                                         fPrevMagnitude, vNacc,
                                                                         &fPrevMagnitude, &vNacc,
                                                                         &vR1, &vR2, &fDet);
-                                                               
+
                                                        else
                                                                GPU_link(mat, "mtex_bump_init_viewspace",
                                                                         surf_pos, vNorg,
                                                                         fPrevMagnitude, vNacc,
                                                                         &fPrevMagnitude, &vNacc,
                                                                         &vR1, &vR2, &fDet);
-                                                       
+
                                                        iBumpSpacePrev = iBumpSpace;
                                                }
-                                               
-                                               
+
+
                                                if (found_deriv_map) {
                                                        GPU_link(mat, "mtex_bump_deriv",
                                                                 texco, GPU_image(tex->ima, &tex->iuser, true),
@@ -1530,8 +1530,8 @@ static void do_material_tex(GPUShadeInput *shi)
                                                                         &dBs, &dBt);
                                                        }
                                                }
-                                               
-                                               
+
+
                                                if (mtex->texflag & MTEX_BUMP_TEXTURESPACE) {
                                                        float imag_tspace_dimension_y = aspect * imag_tspace_dimension_x;
                                                        GPU_link(mat, "mtex_bump_apply_texspace",
@@ -1545,10 +1545,10 @@ static void do_material_tex(GPUShadeInput *shi)
                                                        GPU_link(mat, "mtex_bump_apply",
                                                                 fDet, dBs, dBt, vR1, vR2, vNacc,
                                                                 &vNacc, &shi->vn);
-                                               
+
                                        }
                                }
-                               
+
                                GPU_link(mat, "vec_math_negate", shi->vn, &orn);
                        }
 
@@ -1863,14 +1863,14 @@ static GPUNodeLink *gpu_material_diffuse_bsdf(GPUMaterial *mat, Material *ma)
 static GPUNodeLink *gpu_material_preview_matcap(GPUMaterial *mat, Material *ma)
 {
        GPUNodeLink *outlink;
-       
+
        /* some explanations here:
         * matcap normal holds the normal remapped to the 0.0 - 1.0 range. To take advantage of flat shading, we abuse
         * the built in secondary color of opengl. Color is just the regular color, which should include mask value too.
         * This also needs flat shading so we use the primary opengl color built-in */
        GPU_link(mat, "material_preview_matcap", GPU_uniform(&ma->r), GPU_image_preview(ma->preview),
                 GPU_opengl_builtin(GPU_MATCAP_NORMAL), GPU_opengl_builtin(GPU_COLOR), &outlink);
-       
+
        return outlink;
 }
 
@@ -1880,7 +1880,7 @@ GPUMaterial *GPU_material_matcap(Scene *scene, Material *ma, bool use_opensubdiv
        GPUMaterial *mat;
        GPUNodeLink *outlink;
        LinkData *link;
-       
+
        for (link = ma->gpumaterial.first; link; link = link->next) {
                GPUMaterial *current_material = (GPUMaterial *)link->data;
                if (current_material->scene == scene &&
@@ -1889,7 +1889,7 @@ GPUMaterial *GPU_material_matcap(Scene *scene, Material *ma, bool use_opensubdiv
                        return current_material;
                }
        }
-       
+
        /* allocate material */
        mat = GPU_material_construct_begin(ma);
        mat->scene = scene;
@@ -1902,19 +1902,19 @@ GPUMaterial *GPU_material_matcap(Scene *scene, Material *ma, bool use_opensubdiv
        else {
                outlink = gpu_material_diffuse_bsdf(mat, ma);
        }
-               
+
        GPU_material_output_link(mat, outlink);
 
        gpu_material_construct_end(mat, "matcap_pass");
-       
+
        /* 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 */
-       
+
        link = MEM_callocN(sizeof(LinkData), "GPUMaterialLink");
        link->data = mat;
        BLI_addtail(&ma->gpumaterial, link);
-       
+
        return mat;
 }
 
@@ -2124,7 +2124,7 @@ GPUMaterial *GPU_material_world(struct Scene *scene, struct World *wo)
        mat = GPU_material_construct_begin(NULL);
        mat->scene = scene;
        mat->type = GPU_MATERIAL_TYPE_WORLD;
-       
+
        /* create nodes */
        if (BKE_scene_use_new_shading_nodes(scene) && wo->nodetree && wo->use_nodes) {
                ntreeGPUMaterialNodes(wo->nodetree, mat, NODE_NEW_SHADING);
@@ -2138,7 +2138,7 @@ GPUMaterial *GPU_material_world(struct Scene *scene, struct World *wo)
                        GPU_link(mat, "linearrgb_to_srgb", mat->outlink, &mat->outlink);
 
        gpu_material_construct_end(mat, wo->id.name);
-       
+
        /* 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 */
@@ -2228,7 +2228,7 @@ void GPU_materials_free(void)
 
        for (wo = G.main->world.first; wo; wo = wo->id.next)
                GPU_material_free(&wo->gpumaterial);
-       
+
        GPU_material_free(&defmaterial.gpumaterial);
 
        for (ob = G.main->object.first; ob; ob = ob->id.next)
@@ -2423,7 +2423,7 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
-               
+
                        if (!GPU_framebuffer_texture_attach(lamp->fb, lamp->depthtex, 0, NULL)) {
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
@@ -2443,9 +2443,9 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
 
                        if (!GPU_framebuffer_check_valid(lamp->fb, NULL)) {
                                gpu_lamp_shadow_free(lamp);
-                               return lamp;                            
+                               return lamp;
                        }
-                       
+
                        /* FBO and texture for blurring */
                        lamp->blurfb = GPU_framebuffer_create();
                        if (!lamp->blurfb) {
@@ -2458,20 +2458,20 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
-               
+
                        if (!GPU_framebuffer_texture_attach(lamp->blurfb, lamp->blurtex, 0, NULL)) {
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
-                       
+
                        /* we need to properly bind to test for completeness */
                        GPU_texture_bind_as_framebuffer(lamp->blurtex);
-                       
+
                        if (!GPU_framebuffer_check_valid(lamp->blurfb, NULL)) {
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
-                       
+
                        GPU_framebuffer_texture_unbind(lamp->blurfb, lamp->blurtex);
                }
                else {
@@ -2485,11 +2485,11 @@ GPULamp *GPU_lamp_from_blender(Scene *scene, Object *ob, Object *par)
                                gpu_lamp_shadow_free(lamp);
                                return lamp;
                        }
-                       
+
                        if (!GPU_framebuffer_check_valid(lamp->fb, NULL)) {
                                gpu_lamp_shadow_free(lamp);
-                               return lamp;                            
-                       }                                               
+                               return lamp;
+                       }
                }
 
                GPU_framebuffer_restore();
index 3e65e2987e6e87ee786ef04a0c68a6194654f8be..b31a527a2ad51a4c2899cf928288e9f4f22760d3 100644 (file)
@@ -34,7 +34,7 @@
 #include "GPU_select.h"
 #include "GPU_extensions.h"
 #include "GPU_glew.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "BLI_rect.h"
index 9bb96ea67a23a8d05d2f59c6a63b9bd35e6798ef..b934dbf7aa856461cf2bd4d09bcaa6aa7128edf5 100644 (file)
@@ -35,7 +35,7 @@
 #include "GPU_select.h"
 #include "GPU_extensions.h"
 #include "GPU_glew.h"
+
 #include "MEM_guardedalloc.h"
 
 #include "BLI_rect.h"
index d43b2f257e82692beea9ceb8c2c0a41009aabaa9..331af47d56071e687909cb6256f5e0220a4208d8 100644 (file)
@@ -112,11 +112,11 @@ static void shader_print_errors(const char *task, const char *log, const char **
                                c = pos + 1;
                                line++;
                        }
-                       
+
                        fprintf(stderr, "%s", c);
                }
        }
-       
+
        fprintf(stderr, "%s\n", log);
 }
 
@@ -461,7 +461,7 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
                        GPU_shader_free(shader);
                        return NULL;
                }
-               
+
                if (!use_opensubdiv) {
                        GPU_shader_geometry_stage_primitive_io(shader, input, output, number);
                }
@@ -620,7 +620,7 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUText
                fprintf(stderr, "Not enough texture slots.\n");
                return;
        }
-               
+
        if (number == -1)
                return;
 
@@ -646,7 +646,7 @@ void GPU_shader_uniform_texture(GPUShader *UNUSED(shader), int location, GPUText
 int GPU_shader_get_attribute(GPUShader *shader, const char *name)
 {
        int index;
-       
+
        GPU_CHECK_ERRORS_AROUND(index = glGetAttribLocation(shader->program, name));
 
        return index;
index f50465189b22c6b61db908b818f80c095a09f740..6c4ab395b6b0c613aed9c4f9a2e5884775547fe1 100644 (file)
@@ -87,7 +87,7 @@ static void gpu_glTexSubImageEmpty(GLenum target, GLenum format, int x, int y, i
                glTexSubImage1D(target, 0, x, w, format, GL_UNSIGNED_BYTE, pixels);
        else
                glTexSubImage2D(target, 0, x, y, w, h, format, GL_UNSIGNED_BYTE, pixels);
-       
+
        MEM_freeN(pixels);
 }
 
@@ -432,10 +432,10 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
 {
        GPUTexture *tex = prv->gputexture[0];
        GLuint bindcode = 0;
-       
+
        if (tex)
                bindcode = tex->bindcode;
-       
+
        /* this binds a texture, so that's why we restore it to 0 */
        if (bindcode == 0) {
                GPU_create_gl_tex(&bindcode, prv->rect[0], NULL, prv->w[0], prv->h[0], GL_TEXTURE_2D, mipmap, 0, NULL);
@@ -452,9 +452,9 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
        tex->refcount = 1;
        tex->target = GL_TEXTURE_2D;
        tex->target_base = GL_TEXTURE_2D;
-       
+
        prv->gputexture[0] = tex;
-       
+
        if (!glIsTexture(tex->bindcode)) {
                GPU_ASSERT_NO_GL_ERRORS("Blender Texture Not Loaded");
        }
@@ -464,13 +464,13 @@ GPUTexture *GPU_texture_from_preview(PreviewImage *prv, int mipmap)
                glBindTexture(GL_TEXTURE_2D, tex->bindcode);
                glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
                glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
-               
+
                tex->w = w;
                tex->h = h;
        }
-       
+
        glBindTexture(GL_TEXTURE_2D, 0);
-       
+
        return tex;
 
 }
@@ -481,7 +481,7 @@ GPUTexture *GPU_texture_create_1D(int w, const float *fpixels, char err_out[256]
 
        if (tex)
                GPU_texture_unbind(tex);
-       
+
        return tex;
 }
 
@@ -491,7 +491,7 @@ GPUTexture *GPU_texture_create_2D(int w, int h, const float *fpixels, GPUHDRType
 
        if (tex)
                GPU_texture_unbind(tex);
-       
+
        return tex;
 }
 GPUTexture *GPU_texture_create_2D_multisample(
@@ -511,7 +511,7 @@ GPUTexture *GPU_texture_create_depth(int w, int h, char err_out[256])
 
        if (tex)
                GPU_texture_unbind(tex);
-       
+
        return tex;
 }
 GPUTexture *GPU_texture_create_depth_multisample(int w, int h, int samples, char err_out[256])
@@ -653,7 +653,7 @@ void GPU_texture_unbind(GPUTexture *tex)
 
        if (tex->number == -1)
                return;
-       
+
        GPU_ASSERT_NO_GL_ERRORS("Pre Texture Unbind");
 
        GLenum arbnumber = (GLenum)((GLuint)GL_TEXTURE0 + tex->number);
@@ -713,7 +713,7 @@ void GPU_texture_free(GPUTexture *tex)
 
        if (tex->refcount < 0)
                fprintf(stderr, "GPUTexture: negative refcount\n");
-       
+
        if (tex->refcount == 0) {
                if (tex->fb)
                        GPU_framebuffer_texture_detach(tex);
index 42fbdadf1d1edf7dd0ce793d08a2c593ee049a74..fd7d794b4effc472b480987380140839c4f8cbc3 100644 (file)
@@ -54,8 +54,8 @@ void main()
 #elif !defined(GPU_ATI)
        // Setting gl_ClipVertex is necessary to get glClipPlane working on NVIDIA
        // graphic cards, while on ATI it can cause a software fallback.
-       gl_ClipVertex = co; 
-#endif 
+       gl_ClipVertex = co;
+#endif
 
 #ifdef USE_COLOR
 #ifdef DRAW_LINE
index 09a0c75facc10ccd8780afa9e6bfc2b0fa8e6d77..eea4385578f5b895bcf08e8ef2fc607ac962c7a3 100644 (file)
@@ -55,4 +55,4 @@ void main()
 #else
        vert_dof_final();
 #endif
-}
\ No newline at end of file
+}
index aace5e951694b58c7d898f6db40f6092791513d7..ba8f33f75be2a009d3f7d53ec2d715c6650346fc 100644 (file)
@@ -3887,7 +3887,7 @@ void material_preview_matcap(vec4 color, sampler2D ima, vec4 N, vec4 mask, out v
 {
        vec3 normal;
        vec2 tex;
-       
+
 #ifndef USE_OPENSUBDIV
        /* remap to 0.0 - 1.0 range. This is done because OpenGL 2.0 clamps colors
         * between shader stages and we want the full range of the normal */
index db0068d2f3d3050f4ad33935b6b4296a4af170db..2c5bcd54b33edc8d3c0adee9ead25ceb7a21fd64 100644 (file)
@@ -102,8 +102,8 @@ void main()
 #elif !defined(GPU_ATI)
        // Setting gl_ClipVertex is necessary to get glClipPlane working on NVIDIA
        // graphic cards, while on ATI it can cause a software fallback.
-       gl_ClipVertex = co; 
-#endif 
+       gl_ClipVertex = co;
+#endif
 
 #ifdef USE_OPENSUBDIV
        outpt.v.position = co;