Merge branch 'master' into 28
authorCampbell Barton <ideasman42@gmail.com>
Wed, 12 Apr 2017 10:23:30 +0000 (20:23 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 12 Apr 2017 10:23:44 +0000 (20:23 +1000)
source/blender/gpu/intern/gpu_basic_shader.c
source/blender/gpu/intern/gpu_buffers.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_texture.c
source/blender/gpu/intern/gpu_viewport.c
source/blender/imbuf/intern/colormanagement.c

index bbd28c8803d3bc19b502f724cb8579cdca3be4ba..ff385683a1e6ae0e57918f74c6d8dbd9138a9ce5 100644 (file)
@@ -281,7 +281,7 @@ static GPUShader *gpu_basic_shader(int options)
        return shader;
 }
 
-static void GPU_basic_shader_uniform_autoset(GPUShader *shader, int options)
+static void gpu_basic_shader_uniform_autoset(GPUShader *shader, int options)
 {
        if (options & GPU_SHADER_LINE) {
                glGetIntegerv(GL_VIEWPORT, &GPU_MATERIAL_STATE.viewport[0]);
@@ -299,7 +299,7 @@ void GPU_basic_shader_bind(int options)
 
                if (shader) {
                        GPU_shader_bind(shader);
-                       GPU_basic_shader_uniform_autoset(shader, options);
+                       gpu_basic_shader_uniform_autoset(shader, options);
                }
        }
        else {
index 6492cf909294d7eda5f0d7d095199827d5bb428d..054803f468a73442a46593e163c5f07367bca1d6 100644 (file)
@@ -744,7 +744,7 @@ void GPU_triangle_setup(struct DerivedMesh *dm)
        GLStates |= GPU_BUFFER_ELEMENT_STATE;
 }
 
-static int GPU_typesize(int type)
+static int gpu_typesize(int type)
 {
        switch (type) {
                case GL_FLOAT:
@@ -767,7 +767,7 @@ int GPU_attrib_element_size(GPUAttrib data[], int numdata)
        int i, elementsize = 0;
 
        for (i = 0; i < numdata; i++) {
-               int typesize = GPU_typesize(data[i].type);
+               int typesize = gpu_typesize(data[i].type);
                if (typesize != 0)
                        elementsize += typesize * data[i].size;
        }
@@ -804,7 +804,7 @@ 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);
+               offset += data[i].size * gpu_typesize(data[i].type);
                
                attribData[i].index = data[i].index;
                attribData[i].size = data[i].size;
index 6008e32f0fd8fb03ac1dadd6487e5b61ddc03418..3ef0a02718d631278ed9693b552087cba06738bb 100644 (file)
@@ -1175,7 +1175,7 @@ void GPU_paint_set_mipmap(bool mipmap)
 
 
 /* check if image has been downscaled and do scaled partial update */
-static bool GPU_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, int y, int w, int h)
+static bool gpu_check_scaled_image(ImBuf *ibuf, Image *ima, float *frect, int x, int y, int w, int h)
 {
        if (is_over_resolution_limit(GL_TEXTURE_2D, ibuf->x, ibuf->y)) {
                int x_limit = smaller_power_of_2_limit(ibuf->x);
@@ -1266,7 +1266,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
                        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)) {
+                       if (gpu_check_scaled_image(ibuf, ima, buffer, x, y, w, h)) {
                                MEM_freeN(buffer);
                                BKE_image_release_ibuf(ima, ibuf, NULL);
                                return;
@@ -1290,7 +1290,7 @@ void GPU_paint_update_image(Image *ima, ImageUser *iuser, int x, int y, int w, i
                        return;
                }
 
-               if (GPU_check_scaled_image(ibuf, ima, NULL, x, y, w, h)) {
+               if (gpu_check_scaled_image(ibuf, ima, NULL, x, y, w, h)) {
                        BKE_image_release_ibuf(ima, ibuf, NULL);
                        return;
                }
@@ -1851,7 +1851,7 @@ void GPU_begin_object_materials(
        GPU_object_material_unbind();
 }
 
-static int GPU_get_particle_info(GPUParticleInfo *pi)
+static int gpu_get_particle_info(GPUParticleInfo *pi)
 {
        DupliObject *dob = GMS.dob;
        if (dob->particle_system) {
@@ -1946,7 +1946,7 @@ int GPU_object_material_bind(int nr, void *attribs)
                        GPU_material_vertex_attributes(gpumat, gattribs);
 
                        if (GMS.dob)
-                               GPU_get_particle_info(&partile_info);
+                               gpu_get_particle_info(&partile_info);
 
                        GPU_material_bind(
                                gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT),
index fabcf4409da40cd881bc64d339c635213d046a0a..ce3b37b3a662b5f6bafa69902700e47c70430ef4 100644 (file)
@@ -54,7 +54,7 @@ struct GPUFrameBuffer {
        struct GPUStateValues attribs;
 };
 
-static void GPU_print_framebuffer_error(GLenum status, char err_out[256])
+static void gpu_print_framebuffer_error(GLenum status, char err_out[256])
 {
        const char *format = "GPUFrameBuffer: framebuffer status %s\n";
        const char *err = "unknown";
@@ -327,7 +327,7 @@ bool GPU_framebuffer_check_valid(GPUFrameBuffer *fb, char err_out[256])
 
        if (status != GL_FRAMEBUFFER_COMPLETE) {
                GPU_framebuffer_restore();
-               GPU_print_framebuffer_error(status, err_out);
+               gpu_print_framebuffer_error(status, err_out);
                return false;
        }
 
index 153ae8ec8dc06d8abc0dc502a9091ee0194ce30c..db5c3cf2f47bbb78c2e4a4f7345c4c142b01fffa 100644 (file)
@@ -183,7 +183,7 @@ static void gpu_material_set_attrib_id(GPUMaterial *material)
        attribs->totlayer = b;
 }
 
-static int GPU_material_construct_end(GPUMaterial *material, const char *passname)
+static int gpu_material_construct_end(GPUMaterial *material, const char *passname)
 {
        if (material->outlink) {
                GPUNodeLink *outlink = material->outlink;
@@ -1839,7 +1839,7 @@ GPUMaterial *GPU_material_matcap(Scene *scene, Material *ma, bool use_opensubdiv
                
        GPU_material_output_link(mat, outlink);
 
-       GPU_material_construct_end(mat, "matcap_pass");
+       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
@@ -1992,7 +1992,7 @@ static void do_world_tex(GPUShadeInput *shi, struct World *wo, GPUNodeLink **hor
        }
 }
 
-static void GPU_material_old_world(struct GPUMaterial *mat, struct World *wo)
+static void gpu_material_old_world(struct GPUMaterial *mat, struct World *wo)
 {
        GPUShadeInput shi;
        GPUShadeResult shr;
@@ -2060,17 +2060,18 @@ GPUMaterial *GPU_material_world(struct Scene *scene, struct World *wo)
        mat->type = GPU_MATERIAL_TYPE_WORLD;
        
        /* create nodes */
-       if (BKE_scene_use_new_shading_nodes(scene) && wo->nodetree && wo->use_nodes)
+       if (BKE_scene_use_new_shading_nodes(scene) && wo->nodetree && wo->use_nodes) {
                ntreeGPUMaterialNodes(wo->nodetree, mat, NODE_NEW_SHADING);
+       }
        else {
-               GPU_material_old_world(mat, wo);
+               gpu_material_old_world(mat, wo);
        }
 
        if (GPU_material_do_color_management(mat))
                if (mat->outlink)
                        GPU_link(mat, "linearrgb_to_srgb", mat->outlink, &mat->outlink);
 
-       GPU_material_construct_end(mat, wo->id.name);
+       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
@@ -2136,7 +2137,7 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma, bool use_open
                if (mat->outlink)
                        GPU_link(mat, "linearrgb_to_srgb", mat->outlink, &mat->outlink);
 
-       GPU_material_construct_end(mat, ma->id.name);
+       gpu_material_construct_end(mat, ma->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
index 4b3570e3831b57226c4ce218d654f3a684bdcd3b..d0f5a5a5b158aa9c0b8a3ccb44b04057d1e2655c 100644 (file)
@@ -65,7 +65,9 @@ struct GPUTexture {
        bool stencil;       /* is a stencil texture? */
 };
 
-static GLenum GPU_texture_get_format(int components, GPUTextureFormat data_type, GLenum *format, GLenum *data_format, bool *is_depth, bool *is_stencil)
+static GLenum gpu_texture_get_format(
+        int components, GPUTextureFormat data_type,
+        GLenum *format, GLenum *data_format, bool *is_depth, bool *is_stencil)
 {
        if (data_type == GPU_DEPTH_COMPONENT24 ||
            data_type == GPU_DEPTH_COMPONENT16 ||
@@ -159,7 +161,7 @@ static float *GPU_texture_3D_rescale(GPUTexture *tex, int w, int h, int d, int c
 
 /* This tries to allocate video memory for a given texture
  * If alloc fails, lower the resolution until it fits. */
-static bool GPU_texture_try_alloc(
+static bool gpu_texture_try_alloc(
         GPUTexture *tex, GLenum proxy, GLenum internalformat, GLenum format, GLenum data_format,
         int channels, bool try_rescale, const float *fpixels, float **rescaled_fpixels)
 {
@@ -263,7 +265,7 @@ static GPUTexture *GPU_texture_create_nD(
        if (samples && n == 2 && d == 0)
                tex->target = GL_TEXTURE_2D_MULTISAMPLE;
 
-       internalformat = GPU_texture_get_format(components, data_type, &format, &data_format, &tex->depth, &tex->stencil);
+       internalformat = gpu_texture_get_format(components, data_type, &format, &data_format, &tex->depth, &tex->stencil);
 
        /* Generate Texture object */
        glGenTextures(1, &tex->bindcode);
@@ -297,7 +299,7 @@ static GPUTexture *GPU_texture_create_nD(
                proxy = GL_PROXY_TEXTURE_3D;
        }
 
-       valid = GPU_texture_try_alloc(tex, proxy, internalformat, format, data_format, components, can_rescale, fpixels,
+       valid = gpu_texture_try_alloc(tex, proxy, internalformat, format, data_format, components, can_rescale, fpixels,
                                      &rescaled_fpixels);
 
        if (!valid) {
@@ -386,7 +388,7 @@ static GPUTexture *GPU_texture_cube_create(
                // tex->target_base = tex->target = GL_TEXTURE_CUBE_MAP_ARRAY;
        }
 
-       internalformat = GPU_texture_get_format(components, data_type, &format, &data_format, &tex->depth, &tex->stencil);
+       internalformat = gpu_texture_get_format(components, data_type, &format, &data_format, &tex->depth, &tex->stencil);
 
        /* Generate Texture object */
        glGenTextures(1, &tex->bindcode);
index d703b06fa973cf5412ac4c3fa7567de3e903fa76..dc71e030b7ecf2c5e17427b39adf15a4dfaff7a8 100644 (file)
@@ -68,9 +68,9 @@ struct GPUViewport {
        DefaultTextureList *txl;
 };
 
-static void GPU_viewport_buffers_free(FramebufferList *fbl, int fbl_len, TextureList *txl, int txl_len);
-static void GPU_viewport_storage_free(StorageList *stl, int stl_len);
-static void GPU_viewport_passes_free(PassList *psl, int psl_len);
+static void gpu_viewport_buffers_free(FramebufferList *fbl, int fbl_len, TextureList *txl, int txl_len);
+static void gpu_viewport_storage_free(StorageList *stl, int stl_len);
+static void gpu_viewport_passes_free(PassList *psl, int psl_len);
 
 GPUViewport *GPU_viewport_create(void)
 {
@@ -104,7 +104,7 @@ void *GPU_viewport_engine_data_create(GPUViewport *viewport, void *engine_type)
        return data;
 }
 
-static void GPU_viewport_engines_data_free(GPUViewport *viewport)
+static void gpu_viewport_engines_data_free(GPUViewport *viewport)
 {
        int fbl_len, txl_len, psl_len, stl_len;
 
@@ -114,9 +114,9 @@ static void GPU_viewport_engines_data_free(GPUViewport *viewport)
                ViewportEngineData *data = link->data;
                DRW_engine_viewport_data_size_get(data->engine_type, &fbl_len, &txl_len, &psl_len, &stl_len);
 
-               GPU_viewport_buffers_free(data->fbl, fbl_len, data->txl, txl_len);
-               GPU_viewport_passes_free(data->psl, psl_len);
-               GPU_viewport_storage_free(data->stl, stl_len);
+               gpu_viewport_buffers_free(data->fbl, fbl_len, data->txl, txl_len);
+               gpu_viewport_passes_free(data->psl, psl_len);
+               gpu_viewport_storage_free(data->stl, stl_len);
 
                MEM_freeN(data->fbl);
                MEM_freeN(data->txl);
@@ -167,13 +167,13 @@ bool GPU_viewport_cache_validate(GPUViewport *viewport, unsigned int hash)
                        ViewportEngineData *data = link->data;
                        int psl_len;
                        DRW_engine_viewport_data_size_get(data->engine_type, NULL, NULL, &psl_len, NULL);
-                       GPU_viewport_passes_free(data->psl, psl_len);
+                       gpu_viewport_passes_free(data->psl, psl_len);
                }
                dirty = true;
        }
 
        if (viewport->data_hash != hash) {
-               GPU_viewport_engines_data_free(viewport);
+               gpu_viewport_engines_data_free(viewport);
                dirty = true;
        }
 
@@ -194,14 +194,14 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti *rect)
 
        if (dfbl->default_fb) {
                if (rect_w != viewport->size[0] || rect_h != viewport->size[1]) {
-                       GPU_viewport_buffers_free(
+                       gpu_viewport_buffers_free(
                                (FramebufferList *)viewport->fbl, default_fbl_len,
                                (TextureList *)viewport->txl, default_txl_len);
 
                        for (LinkData *link = viewport->data.first; link; link = link->next) {
                                ViewportEngineData *data = link->data;
                                DRW_engine_viewport_data_size_get(data->engine_type, &fbl_len, &txl_len, NULL, NULL);
-                               GPU_viewport_buffers_free(data->fbl, fbl_len, data->txl, txl_len);
+                               gpu_viewport_buffers_free(data->fbl, fbl_len, data->txl, txl_len);
                        }
                }
        }
@@ -313,7 +313,7 @@ void GPU_viewport_unbind(GPUViewport *viewport)
        }
 }
 
-static void GPU_viewport_buffers_free(
+static void gpu_viewport_buffers_free(
         FramebufferList *fbl, int fbl_len,
         TextureList *txl, int txl_len)
 {
@@ -333,7 +333,7 @@ static void GPU_viewport_buffers_free(
        }
 }
 
-static void GPU_viewport_storage_free(StorageList *stl, int stl_len)
+static void gpu_viewport_storage_free(StorageList *stl, int stl_len)
 {
        for (int i = 0; i < stl_len; i++) {
                void *storage = stl->storage[i];
@@ -344,7 +344,7 @@ static void GPU_viewport_storage_free(StorageList *stl, int stl_len)
        }
 }
 
-static void GPU_viewport_passes_free(PassList *psl, int psl_len)
+static void gpu_viewport_passes_free(PassList *psl, int psl_len)
 {
        for (int i = 0; i < psl_len; i++) {
                struct DRWPass *pass = psl->passes[i];
@@ -358,9 +358,9 @@ static void GPU_viewport_passes_free(PassList *psl, int psl_len)
 
 void GPU_viewport_free(GPUViewport *viewport)
 {
-       GPU_viewport_engines_data_free(viewport);
+       gpu_viewport_engines_data_free(viewport);
 
-       GPU_viewport_buffers_free(
+       gpu_viewport_buffers_free(
                (FramebufferList *)viewport->fbl, default_fbl_len,
                (TextureList *)viewport->txl, default_txl_len);
 
index 48cba3e0800310b8383b4c52caa038a3309db00d..0881a24422d04e9d7f15144f6af70039efd315e9 100644 (file)
@@ -1406,7 +1406,7 @@ static void *do_display_buffer_apply_thread(void *handle_v)
        bool is_data = handle->is_data;
 
        if (cm_processor == NULL) {
-               if (display_buffer_byte) {
+               if (display_buffer_byte && display_buffer_byte != handle->byte_buffer) {
                        IMB_buffer_byte_from_byte(display_buffer_byte, handle->byte_buffer, IB_PROFILE_SRGB, IB_PROFILE_SRGB,
                                                  false, width, height, width, width);
                }