_update_gradient_desc_set(ctx);
//add full screen quad at the beginning, recurently used
- _vkvg_fill_rectangle (ctx,0,0,ctx->pSurf->width,ctx->pSurf->height);
+ _vao_add_rectangle (ctx,0,0,ctx->pSurf->width,ctx->pSurf->height);
_init_cmd_buff (ctx);
_clear_path (ctx);
}
_record_draw_cmd(ctx);
}
-void _vkvg_fill_rectangle (VkvgContext ctx, float x, float y, float width, float height){
- Vertex v[4] =
- {
- {{x,y}, {0,0,-1}},
- {{x,y+height}, {0,0,-1}},
- {{x+width,y}, {0,0,-1}},
- {{x+width,y+height},{0,0,-1}}
- };
- uint32_t firstIdx = ctx->vertCount;
- Vertex* pVert = (Vertex*)(ctx->vertices.mapped + ctx->vertCount * sizeof(Vertex));
- memcpy (pVert,v,4*sizeof(Vertex));
- ctx->vertCount+=4;
- _add_tri_indices_for_rect(ctx, firstIdx);
-}
void vkvg_paint (VkvgContext ctx){
vkCmdDrawIndexed (ctx->cmd,6,1,0,0,0);
}
inds[2] = i2;
ctx->indCount+=3;
}
+void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, float height){
+ Vertex v[4] =
+ {
+ {{x,y}, {0,0,-1}},
+ {{x,y+height}, {0,0,-1}},
+ {{x+width,y}, {0,0,-1}},
+ {{x+width,y+height},{0,0,-1}}
+ };
+ uint32_t firstIdx = ctx->vertCount;
+ Vertex* pVert = (Vertex*)(ctx->vertices.mapped + ctx->vertCount * sizeof(Vertex));
+ memcpy (pVert,v,4*sizeof(Vertex));
+ ctx->vertCount+=4;
+ _add_tri_indices_for_rect(ctx, firstIdx);
+}
void _create_cmd_buff (VkvgContext ctx){
ctx->cmd = vkh_cmd_buff_create(ctx->pSurf->dev->vkDev, ctx->cmdPool,VK_COMMAND_BUFFER_LEVEL_PRIMARY);
}
vec2 _get_current_position (VkvgContext ctx);
void _add_point (VkvgContext ctx, float x, float y);
void _add_point_vec2 (VkvgContext ctx, vec2 v);
-void _vkvg_fill_rectangle (VkvgContext ctx, float x, float y, float width, float height);
void _create_vertices_buff (VkvgContext ctx);
void _add_vertex (VkvgContext ctx, Vertex v);
void _add_triangle_indices (VkvgContext ctx, uint32_t i0, uint32_t i1,uint32_t i2);
void _add_tri_indices_for_rect (VkvgContext ctx, uint32_t i);
void _build_vb_step (vkvg_context* ctx, Vertex v, float hw, uint32_t iL, uint32_t i, uint32_t iR);
+void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, float height);
void _bind_draw_pipeline (VkvgContext ctx);
void _create_cmd_buff (VkvgContext ctx);