_ensure_renderpass_is_started(ctx);
+ CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
+
#ifdef VKVG_WIRED_DEBUG
CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipelineWired);
CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
//CmdBindPipeline(ctx->cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, ctx->pSurf->dev->pipe_OVER);
-#else
- CmdDrawIndexed(ctx->cmd, ctx->indCount - ctx->curIndStart, 1, ctx->curIndStart, (int32_t)ctx->curVertOffset, 0);
-
#endif
LOG(VKVG_LOG_INFO, "RECORD DRAW CMD: ctx = %p; vertices = %d; indices = %d (vxOff = %d idxStart = %d idxTot = %d )\n",
ctx, ctx->vertCount - ctx->curVertOffset,
v.pos = vec2_add (p0, vec2_mult (vec2_perp(v1n), hw));
else
v.pos = vec2_sub (p0, vec2_mult (vec2_perp(v1n), hw));
- /*else
- v.pos = vec2_add (p0, vec2_mult (vec2_perp(v1n), hw));*/
} else
v.pos = vec2_add(p0, bisec);
} else*/
_add_vertex(ctx, v);
- /*if (reducedLH)
- v.pos = ctx->vertexCache[ctx->vertCount-3].pos;
- else*/
if (dot < 0 && reducedLH && det > 0) {
if (length_v0 < length_v1)
v.pos = vec2_sub (p0, vec2_mult (vec2_perp(v1n), hw));
}else{
vec2 vp = vec2_perp(v0n);
if (det<0){
- if (reducedLH) {
- if (length_v0 < length_v1)
- v.pos = vec2_add (p0, vec2_mult (vec2_perp(v1n), hw));
- else
- v.pos = vec2_sub (p0, vec2_mult (vec2_perp(v1n), hw));
- } else
+ if (dot < 0 && reducedLH)
+ v.pos = vec2_sub (p0, vec2_mult (vec2_perp(v1n), hw));
+ else
v.pos = vec2_add (p0, bisec);
_add_vertex(ctx, v);
v.pos = vec2_sub (p0, vec2_mult (vp, hw));
}else{
v.pos = vec2_add (p0, vec2_mult (vp, hw));
_add_vertex(ctx, v);
- if (reducedLH) {
- if (length_v0 < length_v1)
- v.pos = vec2_sub (p0, vec2_mult (vec2_perp(v1n), hw));
- else
- v.pos = vec2_add (p0, vec2_mult (vec2_perp(v1n), hw));
- } else
+ if (dot < 0 && reducedLH)
+ v.pos = vec2_add (p0, vec2_mult (vec2_perp(v1n), hw));
+ else
v.pos = vec2_sub (p0, bisec);
}
_add_vertex(ctx, v);
if (join == VKVG_LINE_JOIN_BEVEL){
if (det<0){
- _add_triangle_indices(ctx, idx, idx+2, idx+1);
- _add_triangle_indices(ctx, idx+2, idx+4, idx+0);
- _add_triangle_indices(ctx, idx, idx+3, idx+4);
+ if (dot < 0 && reducedLH) {
+ _add_triangle_indices(ctx, idx, idx+3, idx+4);
+ _add_triangle_indices(ctx, idx+1, idx+3, idx+0);
+ }else{
+ _add_triangle_indices(ctx, idx, idx+2, idx+1);
+ _add_triangle_indices(ctx, idx+2, idx+4, idx+0);
+ _add_triangle_indices(ctx, idx, idx+3, idx+4);
+ }
}else{
- _add_triangle_indices(ctx, idx, idx+2, idx+1);
- _add_triangle_indices(ctx, idx+2, idx+3, idx+1);
- _add_triangle_indices(ctx, idx+1, idx+3, idx+4);
+ if (dot < 0 && reducedLH) {
+ _add_triangle_indices(ctx, idx+1, idx+3, idx+4);
+ _add_triangle_indices(ctx, idx, idx+1, idx+4);
+ }else{
+ _add_triangle_indices(ctx, idx, idx+2, idx+1);
+ _add_triangle_indices(ctx, idx+2, idx+3, idx+1);
+ _add_triangle_indices(ctx, idx+1, idx+3, idx+4);
+ }
}
}else if (join == VKVG_LINE_JOIN_ROUND){
float step = M_PIF / hw;
VKVG_IBO_INDEX_TYPE p0Idx = (VKVG_IBO_INDEX_TYPE)(ctx->vertCount - ctx->curVertOffset);
_add_triangle_indices(ctx, idx, idx+2, idx+1);
if (det < 0){
- for (VKVG_IBO_INDEX_TYPE p = idx+2; p < p0Idx; p++)
- _add_triangle_indices(ctx, p, p+1, idx);
- _add_triangle_indices(ctx, p0Idx, p0Idx+2, idx);
- _add_triangle_indices(ctx, idx, p0Idx+1, p0Idx+2);
+ if (dot < 0 && reducedLH) {
+ for (VKVG_IBO_INDEX_TYPE p = idx+2; p < p0Idx; p++)
+ _add_triangle_indices(ctx, p, p+1, idx);
+ _add_triangle_indices(ctx, idx+1, p0Idx+1, idx);
+ _add_triangle_indices(ctx, idx, p0Idx+1, p0Idx+2);
+ }else{
+ for (VKVG_IBO_INDEX_TYPE p = idx+2; p < p0Idx; p++)
+ _add_triangle_indices(ctx, p, p+1, idx);
+ _add_triangle_indices(ctx, p0Idx, p0Idx+2, idx);
+ _add_triangle_indices(ctx, idx, p0Idx+1, p0Idx+2);
+ }
}else{
- for (VKVG_IBO_INDEX_TYPE p = idx+2; p < p0Idx; p++)
- _add_triangle_indices(ctx, p, p+1, idx+1);
- _add_triangle_indices(ctx, p0Idx, p0Idx+1, idx+1);
- _add_triangle_indices(ctx, idx+1, p0Idx+1, p0Idx+2);
+ if (dot < 0 && reducedLH) {
+ for (VKVG_IBO_INDEX_TYPE p = idx+2; p < p0Idx; p++)
+ _add_triangle_indices(ctx, p, p+1, idx+1);
+ _add_triangle_indices(ctx, idx, p0Idx+2, idx+1);
+ _add_triangle_indices(ctx, idx+1, p0Idx+1, p0Idx+2);
+ }else{
+ for (VKVG_IBO_INDEX_TYPE p = idx+2; p < p0Idx; p++)
+ _add_triangle_indices(ctx, p, p+1, idx+1);
+ _add_triangle_indices(ctx, p0Idx, p0Idx+1, idx+1);
+ _add_triangle_indices(ctx, idx+1, p0Idx+1, p0Idx+2);
+ }
}
}
debugLinePoints[dlpCount+1] = pR;
dlpCount+=2;
#endif*/
- return det;
+ /*if (reducedLH)
+ return -det;
+ else*/
+ return det;
}
void _draw_stoke_cap (VkvgContext ctx, float hw, vec2 p0, vec2 n, bool isStart) {
printf("\t\t\t - 2: Discrete (first choice)\n");
printf("\t\t\t - 3: Virtual\n");
printf("\t\t\t - 4: Cpu\n");
+ printf("\t-l line_width:\tset lines width for stokes.\n");
+ printf("\t-j line_join:\tset line joins for strokes:\n");
+ printf("\t\t\t - m: Mitter(default)\n");
+ printf("\t\t\t - r: Rount\n");
+ printf("\t\t\t - b: Bevel\n");
+ printf("\t-c line_cap:\tset line caps for strokes:\n");
+ printf("\t\t\t - b: Butt (default)\n");
+ printf("\t\t\t - r: Rount\n");
+ printf("\t\t\t - s: Square\n");
+ printf("\t-d:\t\tenable dashes.\n");
printf("\t-n index:\tRun only a single test, zero based index.\n");
printf("\t-q:\t\tQuiet, don't print measures table head row, usefull for batch tests.\n");
printf("\t-p:\t\tPrint test details and exit without performing test, usefull to print details in logs.\n");
if (argc -1 < ++i)
_print_usage_and_exit();
preferedPhysicalDeviceType = (VkPhysicalDeviceType)atoi (argv[i]);
- }
- if (printTestDetailsAndExit) {
- #ifdef DEBUG
- printf("Debug build\n");
- #else
- printf("Release build\n");
- #endif
- #ifdef VKVG_USE_RENDERDOC
- printf("Render doc enabled\n");
- #endif
- #ifdef VKVG_USE_VALIDATION
- printf("Validation enabled\n");
- #endif
- printf("surf dims:\t%d x %d\n", test_width, test_height);
- printf("Samples:\t%d\n", samples);
- printf("Gpu type:\t");
- switch (preferedPhysicalDeviceType) {
- case VK_PHYSICAL_DEVICE_TYPE_OTHER:
- printf("Other\n");
+ }else if (strcmp (argv[i], "-l\0") == 0) {
+ if (argc -1 < ++i)
+ _print_usage_and_exit();
+ line_width = atoi (argv[i]);
+ }else if (strcmp (argv[i], "-d\0") == 0) {
+ dashes_count = 2;
+ }else if (strcmp (argv[i], "-j\0") == 0) {
+ if (argc -1 < ++i)
+ _print_usage_and_exit();
+ switch (argv[i][0]) {
+ case 'm':
+ line_join = VKVG_LINE_JOIN_MITER;
break;
- case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
- printf("Integrated\n");
+ case 'r':
+ line_join = VKVG_LINE_JOIN_ROUND;
break;
- case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
- printf("Discrete\n");
+ case 'b':
+ line_join = VKVG_LINE_JOIN_BEVEL;
break;
- case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
- printf("Virtual\n");
+ default:
+ _print_usage_and_exit();
+ }
+ }else if (strcmp (argv[i], "-c\0") == 0) {
+ if (argc -1 < ++i)
+ _print_usage_and_exit();
+ switch (argv[i][0]) {
+ case 'b':
+ line_cap = VKVG_LINE_CAP_BUTT;
+ break;
+ case 'r':
+ line_cap = VKVG_LINE_CAP_ROUND;
break;
- case VK_PHYSICAL_DEVICE_TYPE_CPU:
- printf("CPU\n");
+ case 's':
+ line_cap = VKVG_LINE_CAP_SQUARE;
break;
+ default:
+ _print_usage_and_exit();
}
-
- #ifdef VKVG_TEST_OFFSCREEN
- printf("Offscreen:\ttrue\n");
- #else
- printf("Offscreen:\tfalse\n");
- #endif
- printf("\n");
- exit(0);
}
}
+ if (printTestDetailsAndExit) {
+ #ifdef DEBUG
+ printf("Debug build\n");
+ #else
+ printf("Release build\n");
+ #endif
+ #ifdef VKVG_USE_RENDERDOC
+ printf("Render doc enabled\n");
+ #endif
+ #ifdef VKVG_USE_VALIDATION
+ printf("Validation enabled\n");
+ #endif
+ printf("surf dims:\t%d x %d\n", test_width, test_height);
+ printf("Samples:\t%d\n", samples);
+ printf("Gpu type:\t");
+ switch (preferedPhysicalDeviceType) {
+ case VK_PHYSICAL_DEVICE_TYPE_OTHER:
+ printf("Other\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU:
+ printf("Integrated\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU:
+ printf("Discrete\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU:
+ printf("Virtual\n");
+ break;
+ case VK_PHYSICAL_DEVICE_TYPE_CPU:
+ printf("CPU\n");
+ break;
+ }
+
+ #ifdef VKVG_TEST_OFFSCREEN
+ printf("Offscreen:\ttrue\n");
+ #else
+ printf("Offscreen:\tfalse\n");
+ #endif
+ printf("\n");
+ exit(0);
+ }
}
void _print_results (const char *testName, int argc, char* argv[], uint32_t i, double run_total, double* run_time_values) {
vkvg_fill_rule_t fill_rule = VKVG_FILL_RULE_NON_ZERO;
vkvg_line_cap_t line_cap = VKVG_LINE_CAP_BUTT;
vkvg_line_join_t line_join = VKVG_LINE_JOIN_MITER;
-float dashes[] = {20.0f, 10.0f};
+float dashes[] = {10.0f, 6.0f};
+//float dashes[] = {0.0f, 10.0f};
uint32_t dashes_count= 0;
float dash_offset = 0;
float line_width = 2.f;