[Bf-blender-cvs] [1dbfd266a16] greasepencil-object: Tons of changes to fix GPU_* functions rename
Antonio Vazquez
noreply at git.blender.org
Wed Jul 18 21:44:12 CEST 2018
Commit: 1dbfd266a16e44c5138e3ab696ff5aa4dda0e872
Author: Antonio Vazquez
Date: Wed Jul 18 20:47:52 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB1dbfd266a16e44c5138e3ab696ff5aa4dda0e872
Tons of changes to fix GPU_* functions rename
===================================================================
M source/blender/draw/engines/gpencil/gpencil_cache_utils.c
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/draw/engines/gpencil/gpencil_engine.c
M source/blender/draw/engines/gpencil/gpencil_engine.h
M source/blender/draw/engines/gpencil/gpencil_shader_fx.c
M source/blender/draw/intern/draw_cache.c
M source/blender/draw/intern/draw_cache.h
M source/blender/editors/gpencil/annotate_draw.c
M source/blender/editors/gpencil/annotate_paint.c
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/gpencil/gpencil_utils.c
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
index 029ea7f788f..4e01c42d33d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c
@@ -218,10 +218,10 @@ static void gpencil_batch_cache_clear(GpencilBatchCache *cache, bGPdata *gpd)
if (cache->cache_size > 0) {
for (int i = 0; i < cache->cache_size; i++) {
- GWN_BATCH_DISCARD_SAFE(cache->batch_stroke[i]);
- GWN_BATCH_DISCARD_SAFE(cache->batch_fill[i]);
- GWN_BATCH_DISCARD_SAFE(cache->batch_edit[i]);
- GWN_BATCH_DISCARD_SAFE(cache->batch_edlin[i]);
+ GPU_BATCH_DISCARD_SAFE(cache->batch_stroke[i]);
+ GPU_BATCH_DISCARD_SAFE(cache->batch_fill[i]);
+ GPU_BATCH_DISCARD_SAFE(cache->batch_edit[i]);
+ GPU_BATCH_DISCARD_SAFE(cache->batch_edlin[i]);
}
MEM_SAFE_FREE(cache->batch_stroke);
MEM_SAFE_FREE(cache->batch_fill);
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 5043d0d15b0..ba174ed9f50 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -52,7 +52,7 @@
/* Helper to add stroke point to vbo */
static void gpencil_set_stroke_point(
- Gwn_VertBuf *vbo, float matrix[4][4], const bGPDspoint *pt, int idx,
+ GPUVertBuf *vbo, float matrix[4][4], const bGPDspoint *pt, int idx,
uint pos_id, uint color_id,
uint thickness_id, uint uvdata_id, short thickness,
const float ink[4])
@@ -64,44 +64,44 @@ static void gpencil_set_stroke_point(
float col[4];
ARRAY_SET_ITEMS(col, ink[0], ink[1], ink[2], alpha);
- GWN_vertbuf_attr_set(vbo, color_id, idx, col);
+ GPU_vertbuf_attr_set(vbo, color_id, idx, col);
/* transfer both values using the same shader variable */
float uvdata[2] = { pt->uv_fac, pt->uv_rot };
- GWN_vertbuf_attr_set(vbo, uvdata_id, idx, uvdata);
+ GPU_vertbuf_attr_set(vbo, uvdata_id, idx, uvdata);
/* the thickness of the stroke must be affected by zoom, so a pixel scale is calculated */
mul_v3_m4v3(viewfpt, matrix, &pt->x);
float thick = max_ff(pt->pressure * thickness, 1.0f);
- GWN_vertbuf_attr_set(vbo, thickness_id, idx, &thick);
+ GPU_vertbuf_attr_set(vbo, thickness_id, idx, &thick);
- GWN_vertbuf_attr_set(vbo, pos_id, idx, &pt->x);
+ GPU_vertbuf_attr_set(vbo, pos_id, idx, &pt->x);
}
/* Helper to add a new fill point and texture coordinates to vertex buffer */
static void gpencil_set_fill_point(
- Gwn_VertBuf *vbo, int idx, bGPDspoint *pt, const float fcolor[4], float uv[2],
+ GPUVertBuf *vbo, int idx, bGPDspoint *pt, const float fcolor[4], float uv[2],
uint pos_id, uint color_id, uint text_id)
{
- GWN_vertbuf_attr_set(vbo, pos_id, idx, &pt->x);
- GWN_vertbuf_attr_set(vbo, color_id, idx, fcolor);
- GWN_vertbuf_attr_set(vbo, text_id, idx, uv);
+ GPU_vertbuf_attr_set(vbo, pos_id, idx, &pt->x);
+ GPU_vertbuf_attr_set(vbo, color_id, idx, fcolor);
+ GPU_vertbuf_attr_set(vbo, text_id, idx, uv);
}
/* create batch geometry data for points stroke shader */
-Gwn_Batch *DRW_gpencil_get_point_geom(bGPDstroke *gps, short thickness, const float ink[4])
+GPUBatch *DRW_gpencil_get_point_geom(bGPDstroke *gps, short thickness, const float ink[4])
{
- static Gwn_VertFormat format = { 0 };
+ static GPUVertFormat format = { 0 };
static uint pos_id, color_id, size_id, uvdata_id;
if (format.attr_len == 0) {
- pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- color_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
- size_id = GWN_vertformat_attr_add(&format, "thickness", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
- uvdata_id = GWN_vertformat_attr_add(&format, "uvdata", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+ color_id = GPU_vertformat_attr_add(&format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
+ size_id = GPU_vertformat_attr_add(&format, "thickness", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
+ uvdata_id = GPU_vertformat_attr_add(&format, "uvdata", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
}
- Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
- GWN_vertbuf_data_alloc(vbo, gps->totpoints);
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
+ GPU_vertbuf_data_alloc(vbo, gps->totpoints);
/* draw stroke curve */
const bGPDspoint *pt = gps->points;
@@ -117,39 +117,39 @@ Gwn_Batch *DRW_gpencil_get_point_geom(bGPDstroke *gps, short thickness, const fl
float thick = max_ff(pt->pressure * thickness, 1.0f);
- GWN_vertbuf_attr_set(vbo, color_id, idx, col);
- GWN_vertbuf_attr_set(vbo, size_id, idx, &thick);
+ GPU_vertbuf_attr_set(vbo, color_id, idx, col);
+ GPU_vertbuf_attr_set(vbo, size_id, idx, &thick);
/* transfer both values using the same shader variable */
float uvdata[2] = { pt->uv_fac, pt->uv_rot };
- GWN_vertbuf_attr_set(vbo, uvdata_id, idx, uvdata);
+ GPU_vertbuf_attr_set(vbo, uvdata_id, idx, uvdata);
- GWN_vertbuf_attr_set(vbo, pos_id, idx, &pt->x);
+ GPU_vertbuf_attr_set(vbo, pos_id, idx, &pt->x);
idx++;
}
- return GWN_batch_create_ex(GWN_PRIM_POINTS, vbo, NULL, GWN_BATCH_OWNS_VBO);
+ return GPU_batch_create_ex(GPU_PRIM_POINTS, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
/* create batch geometry data for stroke shader */
-Gwn_Batch *DRW_gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short thickness, const float ink[4])
+GPUBatch *DRW_gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short thickness, const float ink[4])
{
bGPDspoint *points = gps->points;
int totpoints = gps->totpoints;
/* if cyclic needs more vertex */
int cyclic_add = (gps->flag & GP_STROKE_CYCLIC) ? 1 : 0;
- static Gwn_VertFormat format = { 0 };
+ static GPUVertFormat format = { 0 };
static uint pos_id, color_id, thickness_id, uvdata_id;
if (format.attr_len == 0) {
- pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- color_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
- thickness_id = GWN_vertformat_attr_add(&format, "thickness", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
- uvdata_id = GWN_vertformat_attr_add(&format, "uvdata", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+ color_id = GPU_vertformat_attr_add(&format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
+ thickness_id = GPU_vertformat_attr_add(&format, "thickness", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
+ uvdata_id = GPU_vertformat_attr_add(&format, "uvdata", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
}
- Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
- GWN_vertbuf_data_alloc(vbo, totpoints + cyclic_add + 2);
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
+ GPU_vertbuf_data_alloc(vbo, totpoints + cyclic_add + 2);
/* draw stroke curve */
const bGPDspoint *pt = points;
@@ -190,11 +190,11 @@ Gwn_Batch *DRW_gpencil_get_stroke_geom(bGPDframe *gpf, bGPDstroke *gps, short th
pos_id, color_id, thickness_id, uvdata_id, thickness, ink);
}
- return GWN_batch_create_ex(GWN_PRIM_LINE_STRIP_ADJ, vbo, NULL, GWN_BATCH_OWNS_VBO);
+ return GPU_batch_create_ex(GPU_PRIM_LINE_STRIP_ADJ, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
/* create batch geometry data for current buffer stroke shader */
-Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4], short thickness)
+GPUBatch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4], short thickness)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
@@ -207,17 +207,17 @@ Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4],
tGPspoint *points = gpd->runtime.sbuffer;
int totpoints = gpd->runtime.sbuffer_size;
- static Gwn_VertFormat format = { 0 };
+ static GPUVertFormat format = { 0 };
static uint pos_id, color_id, thickness_id, uvdata_id;
if (format.attr_len == 0) {
- pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- color_id = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
- thickness_id = GWN_vertformat_attr_add(&format, "thickness", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
- uvdata_id = GWN_vertformat_attr_add(&format, "uvdata", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+ color_id = GPU_vertformat_attr_add(&format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
+ thickness_id = GPU_vertformat_attr_add(&format, "thickness", GPU_COMP_F32, 1, GPU_FETCH_FLOAT);
+ uvdata_id = GPU_vertformat_attr_add(&format, "uvdata", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
}
- Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
- GWN_vertbuf_data_alloc(vbo, totpoints + 2);
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
+ GPU_vertbuf_data_alloc(vbo, totpoints + 2);
/* draw stroke curve */
const tGPspoint *tpt = points;
@@ -263,11 +263,11 @@ Gwn_Batch *DRW_gpencil_get_buffer_stroke_geom(bGPdata *gpd, float matrix[4][4],
pos_id, color_id, thickness_id, uvdata_id, thickness, gpd->runtime.scolor);
}
- return GWN_batch_create_ex(GWN_PRIM_LINE_STRIP_ADJ, vbo, NULL, GWN_BATCH_OWNS_VBO);
+ return GPU_batch_create_ex(GPU_PRIM_LINE_STRIP_ADJ, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
/* create batch geometry data for current buffer point shader */
-Gwn_Batch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, float matrix[4][4], short thickness)
+GPUBatch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, float matrix[4][4], short thickness)
{
const DRWContextState *draw_ctx = DRW_context_state_get();
Scene *scene = draw_ctx->scene;
@@ -280,17 +280,17 @@ Gwn_Batch *DRW_gpencil_get_buffer_point_geom(bGPdata *gpd, float matrix[4][4], s
tGPspoint *points = gpd->runtime.sbuffer;
int totpoints = gpd->runtime.sbuffer_size;
- static Gwn_VertFormat format = { 0 };
+ static GPUVertFormat format = { 0 };
static uint pos_id, color_id, thickness_id, uv
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list