Commit: ca4618bdbff4ff8d9f74318d9927bff8db3e2dd5
Author: Clément Foucault
Date:   Fri Jan 6 14:39:34 2017 +0100
Branches: clay-engine
https://developer.blender.org/rBca4618bdbff4ff8d9f74318d9927bff8db3e2dd5

Apply changes GPU_texture change.

===================================================================

M       source/blender/draw/engines/clay/clay.c
M       source/blender/draw/intern/draw_manager.c
M       source/blender/gpu/intern/gpu_viewport.c

===================================================================

diff --git a/source/blender/draw/engines/clay/clay.c 
b/source/blender/draw/engines/clay/clay.c
index 00e4fd66f6..0d8da2a165 100644
--- a/source/blender/draw/engines/clay/clay.c
+++ b/source/blender/draw/engines/clay/clay.c
@@ -87,6 +87,7 @@ typedef struct CLAY_PassList{
 } CLAY_PassList;
 
 /* Functions */
+
 static void add_icon_to_rect(PreviewImage *prv, float *final_rect, int layer)
 {
        int image_size = prv->w[0] * prv->h[0];
@@ -139,7 +140,42 @@ static int matcap_to_index(int matcap)
        else if (matcap == ICON_MATCAP_24) return 23;
        return 0;
 }
+#if 0
+static GPUTexture *create_spiral_sample_texture(int numsaples)
+{
+       GPUTexture *tex;
+       float (*texels)[2] = MEM_mallocN(sizeof(float[2]) * numsaples, 
"concentric_tex");
+       const float numsaples_inv = 1.0f / numsaples;
+       int i;
+       /* arbitrary number to ensure we don't get conciding samples every 
circle */
+       const float spirals = 7.357;
+
+       for (i = 0; i < numsaples; i++) {
+               float r = (i + 0.5f) * numsaples_inv;
+               float phi = r * spirals * (float)(2.0 * M_PI);
+               texels[i][0] = r * cosf(phi);
+               texels[i][1] = r * sinf(phi);
+       }
 
+       tex = GPU_texture_create_1D_procedural(numsaples, (float *)texels, 
NULL);
+       MEM_freeN(texels);
+       return tex;
+}
+
+static GPUTexture * create_jitter_texture(void)
+{
+       float jitter[64 * 64][2];
+       int i;
+
+       for (i = 0; i < 64 * 64; i++) {
+               jitter[i][0] = 2.0f * BLI_frand() - 1.0f;
+               jitter[i][1] = 2.0f * BLI_frand() - 1.0f;
+               normalize_v2(jitter[i]);
+       }
+
+       return GPU_texture_create_2D_procedural(64, 64, &jitter[0][0], true, 
NULL);
+}
+#endif
 static void clay_engine_init(void)
 {
        static bool done = false;
@@ -179,7 +215,11 @@ static void clay_engine_init(void)
 
                load_matcaps(prv, 24);
        }
-
+#if 0
+       /* AO Textures */
+       data.random_tx = 
+       data.random_tx = 
+#endif
        /* Depth prepass */
        data.depth_sh = DRW_shader_create_3D_depth_only();
 
diff --git a/source/blender/draw/intern/draw_manager.c 
b/source/blender/draw/intern/draw_manager.c
index ccd5ec1217..ccae2b5651 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -128,7 +128,7 @@ static bool fs_quad_init = false;
 
 GPUTexture *DRW_texture_create_2D_array(int w, int h, int d, const float 
*fpixels)
 {
-       return GPU_texture_create_2D_array(w, h, d, fpixels);
+       return GPU_texture_create_2D_array(w, h, d, fpixels, NULL);
 }
 
 void DRW_texture_free(GPUTexture *tex)
@@ -417,7 +417,8 @@ static void draw_batch(DRWBatch *batch, const bool 
fullscreen)
                        case DRW_UNIFORM_BUFFER:
                                /* restore index from lenght we abused */
                                
GPU_texture_bind(DST.current_txl->textures[uni->length], uni->bindloc);
-                               
GPU_texture_filter_mode(DST.current_txl->textures[uni->length], false, false);
+                               
GPU_texture_compare_mode(DST.current_txl->textures[uni->length], false);
+                               
GPU_texture_filter_mode(DST.current_txl->textures[uni->length], false);
                                
                                bound_tex = 
MEM_callocN(sizeof(DRWBoundTexture), "DRWBoundTexture");
                                bound_tex->tex = 
DST.current_txl->textures[uni->length];
@@ -595,10 +596,11 @@ void DRW_framebuffer_init(struct GPUFrameBuffer **fb, int 
width, int height, DRW
                                if (fbotex.format == DRW_BUF_DEPTH_16 ||
                                        fbotex.format == DRW_BUF_DEPTH_24) {
                                        *fbotex.tex = 
GPU_texture_create_depth(width, height, NULL);
-                                       GPU_texture_filter_mode(*fbotex.tex, 
false, false);
+                                       GPU_texture_compare_mode(*fbotex.tex, 
false);
+                                       GPU_texture_filter_mode(*fbotex.tex, 
false);
                                }
                                else {
-                                       *fbotex.tex = 
GPU_texture_create_2D(width, height, NULL, GPU_HDR_NONE, NULL);
+                                       *fbotex.tex = 
GPU_texture_create_2D(width, height, NULL, NULL);
                                        ++color_attachment;
                                }
                        }
@@ -643,7 +645,6 @@ void DRW_viewport_init(const bContext *C, void **buffers, 
void **textures, void
 
        /* Save context for all later needs */
        DST.context = C;
-
        GPU_viewport_get_engine_data(viewport, buffers, textures, passes);
 
        /* Refresh DST.size */
@@ -687,6 +688,4 @@ void DRW_engines_free(void)
        clay_engine_free();
 
        BLI_remlink(&R_engines, &viewport_clay_type);
-}
-
-/* TODO Free memory */
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/source/blender/gpu/intern/gpu_viewport.c 
b/source/blender/gpu/intern/gpu_viewport.c
index 1fbf8bfe7b..1f09552149 100644
--- a/source/blender/gpu/intern/gpu_viewport.c
+++ b/source/blender/gpu/intern/gpu_viewport.c
@@ -105,7 +105,7 @@ void GPU_viewport_bind(GPUViewport *viewport, const rcti 
*rect)
 
                /* Color */
                /* No multi samples for now */
-               viewport->txl->color = GPU_texture_create_2D(rect_w, rect_h, 
NULL, GPU_HDR_NONE, NULL);
+               viewport->txl->color = GPU_texture_create_2D(rect_w, rect_h, 
NULL, NULL);
                if (!viewport->txl->color) {
                        GPU_viewport_free(viewport);
                        return;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to