From e0cad38f17278333954828e32d8e18832d0718ea Mon Sep 17 00:00:00 2001 From: Stefan Frederik Date: Wed, 22 Dec 2021 11:11:46 +0100 Subject: [PATCH] updated xschemtest.tcl with new hashes --- scconfig/src/gui/find_gl.c | 36 ++++++++++++++++++++++++++ scconfig/src/gui/find_gl.h | 2 ++ scconfig/src/gui/gui.c | 1 + src/draw.c | 53 ++++++++++++++++++++------------------ tests/xschemtest.tcl | 8 +++--- 5 files changed, 72 insertions(+), 28 deletions(-) diff --git a/scconfig/src/gui/find_gl.c b/scconfig/src/gui/find_gl.c index d33e19d1..a6db4c86 100644 --- a/scconfig/src/gui/find_gl.c +++ b/scconfig/src/gui/find_gl.c @@ -93,6 +93,42 @@ int find_gl(const char *name, int logdepth, int fatal, const char *call, const c return 0; } +int find_gl_vao(const char *name, int logdepth, int fatal, const char *call, const char *arg) +{ + const char *test_c = + NL "#include " + NL "int main()" + NL "{" + NL " glBindVertexArray(0);" + NL " return 0;" + NL "}" + NL; + const char *node = "libs/gui/gl/vao"; + const char *cflags, *ldflags, *incs; + (void) call; /* not used */ + (void) arg; /* not used */ + + if (require("cc/cc", logdepth, fatal)) + return try_fail(logdepth, node); + + if (require("libs/gui/gl/*", logdepth, fatal)) + return try_fail(logdepth, node); + + cflags = get("libs/gui/gl/cflags"); + ldflags = get("libs/gui/gl/ldflags"); + incs = get("libs/gui/gl/includes"); + + report("Checking for gl vao... "); + logprintf(logdepth, "find_gl_vao...\n"); + logdepth++; + + if (try_icl_norun(logdepth, node, test_c, incs, cflags, ldflags) != 0) + return 0; + + return try_fail(logdepth, node); +} + + int find_glu(const char *name, int logdepth, int fatal, const char *call, const char *arg) { char test_c[256]; diff --git a/scconfig/src/gui/find_gl.h b/scconfig/src/gui/find_gl.h index 7e173cd9..b2e8d45e 100644 --- a/scconfig/src/gui/find_gl.h +++ b/scconfig/src/gui/find_gl.h @@ -1,4 +1,6 @@ int find_gl(const char *name, int logdepth, int fatal); +int find_gl_vao(const char *name, int logdepth, int fatal); + int find_glu(const char *name, int logdepth, int fatal); int find_glut(const char *name, int logdepth, int fatal); int find_gui_wgl(const char *name, int logdepth, int fatal); diff --git a/scconfig/src/gui/gui.c b/scconfig/src/gui/gui.c index 065ca6e0..c55576e4 100644 --- a/scconfig/src/gui/gui.c +++ b/scconfig/src/gui/gui.c @@ -41,6 +41,7 @@ void deps_gui_init() dep_add("libs/gui/cairo/*", find_cairo); dep_add("libs/gui/cairo-xcb/*", find_cairo_xcb); dep_add("libs/gui/gl/*", find_gl); + dep_add("libs/gui/gl/vao/*", find_gl_vao); dep_add("libs/gui/glu/*", find_glu); dep_add("libs/gui/glut/*", find_glut); dep_add("libs/gui/wgl/*", find_gui_wgl); diff --git a/src/draw.c b/src/draw.c index afaa7d81..8a9f817c 100644 --- a/src/draw.c +++ b/src/draw.c @@ -1219,8 +1219,8 @@ void polygon_bbox(double *x, double *y, int points, double *bx1, double *by1, do int j; for(j=0; j *bx2) *bx2 = x[j]; + if(j==0 || y[j] < *by1) *by1 = y[j]; if(j==0 || y[j] > *by2) *by2 = y[j]; } } @@ -1294,8 +1294,8 @@ void drawpolygon(int c, int what, double *x, double *y, int points, int poly_fil polygon_bbox(x, y, points, &x1,&y1,&x2,&y2); x1=X_TO_SCREEN(x1); - y1=Y_TO_SCREEN(y1); x2=X_TO_SCREEN(x2); + y1=Y_TO_SCREEN(y1); y2=Y_TO_SCREEN(y2); if( !rectclip(xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2,&x1,&y1,&x2,&y2) ) { return; @@ -1772,32 +1772,35 @@ void draw_graph(int c, int i) double start = (wx1 <= wx2) ? wx1 : wx2; double end = (wx1 <= wx2) ? wx2 : wx1; - /* Process "npoints" simulation items - * p loop split repeated 2 timed (for xx and yy points) to preserve cache locality */ - for(p = 0 ; p < xctx->npoints; p++) { - xx = xctx->values[0][p]; - if(xx > end) { - break; + /* skip if nothing in viewport */ + if(xctx->values[0][xctx->npoints -1] > start) { + /* Process "npoints" simulation items + * p loop split repeated 2 timed (for xx and yy points) to preserve cache locality */ + for(p = 0 ; p < xctx->npoints; p++) { + xx = xctx->values[0][p]; + if(xx > end) { + break; + } + if(xx >= start) { + if(first == -1) first = p; + /* Build poly x array. Translate from graph coordinates to {x1,y1} - {x2, y2} world. */ + xarr[poly_npoints] = W_X(xx); + poly_npoints++; + } } - if(xx >= start) { - if(first == -1) first = p; - /* Build poly x array. Translate from graph coordinates to {x1,y1} - {x2, y2} world. */ - xarr[poly_npoints] = W_X(xx); - poly_npoints++; + last = p; + if(first != -1) { + poly_npoints = 0; + for(p = first ; p < last; p++) { + yy = xctx->values[v][p]; + /* Build poly y array. Translate from graph coordinates to {x1,y1} - {x2, y2} world. */ + yarr[poly_npoints] = W_Y(yy); + poly_npoints++; + } + /* plot data */ + drawpolygon(wave_color, NOW, xarr, yarr, poly_npoints, 0, 0); } } - last = p; - if(first != -1) { - poly_npoints = 0; - for(p = first ; p < last; p++) { - yy = xctx->values[v][p]; - /* Build poly y array. Translate from graph coordinates to {x1,y1} - {x2, y2} world. */ - yarr[poly_npoints] = W_Y(yy); - poly_npoints++; - } - /* plot data */ - drawpolygon(wave_color, NOW, xarr, yarr, poly_npoints, 0, 0); - } } bbox(END, 0.0, 0.0, 0.0, 0.0); wcnt++; diff --git a/tests/xschemtest.tcl b/tests/xschemtest.tcl index 6b1b9c42..d022af1f 100644 --- a/tests/xschemtest.tcl +++ b/tests/xschemtest.tcl @@ -17,11 +17,13 @@ ## allows to see differences in number of function calls / time spent. ## move schematic and redraw in a loop. -proc draw_test {filelist} { +proc draw_test {{filelist {-}}} { global show_pin_net_names set show_pin_net_names 1 foreach f $filelist { - xschem load [abs_sym_path $f] + if { $f ne {-}} { + xschem load [abs_sym_path $f] + } xschem search regex 1 lab . ;# select all nets xschem hilight ;# hilight all selected nets and labels xschem unselect_all @@ -161,7 +163,7 @@ proc netlist_test {} { loading.sch vhdl 2601437773 mos_power_ampli.sch spice 1186348644 hierarchical_tedax.sch tedax 998070173 - LCC_instances.sch spice 824427889 + LCC_instances.sch spice 3014344057 pcb_test1.sch tedax 1295717013 simulate_ff.sch spice 1321596936 } {