void test_close_raster(Raster *r) /***************************************************************************** * ****************************************************************************/ { if (r == NULL || r->lib == NULL || r->lib->close_raster == NULL || is_generic(r->lib, close_raster)) return; log_progress("Testing close_raster()...\n"); r->lib->close_raster(r); log_progress("...testing of close_raster() completed.\n\n"); }
void test_rastzooms(Raster *r) /***************************************************************************** * ****************************************************************************/ { Raster *bmr = &tcb.bytemap_raster; Raster *vbr = &tcb.verification_raster; Rastlib *rlib = r->lib; Ucoor width; Ucoor height; short iteration_count; short iteration_limit; width = r->width; height = r->height; /*----------------------------------------------------------------------- * zoom_in_card testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,zoomblit[0]) && !tcb.test_via_generics) { log_bypass("zoom_in_card(), zoom_to_ram(), zoom_from_ram()"); goto RZOOM_DONE; } /*------------------------------------------------------------------------ * zoom_in_card testing.. *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? RZOOM_TIME_ITCOUNT : 1; log_start("Testing zoom_in_card()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(vbr, 0); rlib->wait_vsync(r); while (iteration_count--) { draw_blitpattern(r, iteration_count, 0); time_it( do_zooms(r,r); ); }
const ProtobufCFieldDescriptor* KeySpecHelper::get_leaf_pb_desc() { if (is_generic()){ return NULL; } if (!is_leafy()) { return NULL; } size_t depth = get_depth(); if (depth < 2) { return NULL; } auto leaf_entry = get_path_entry(depth-1); RW_ASSERT(leaf_entry); auto element_id = ((RwSchemaPathEntry*)leaf_entry)->element_id; RW_ASSERT(element_id); RW_ASSERT(element_id->element_tag); auto leaf_tag = element_id->element_tag; auto parent_entry = get_path_entry(depth-2); RW_ASSERT(parent_entry); if (!(parent_entry->base.descriptor->ypbc_mdesc && parent_entry->base.descriptor->ypbc_mdesc->u)) { return NULL; } auto mdesc = parent_entry->base.descriptor->ypbc_mdesc->u->msg_msgdesc; RW_ASSERT(mdesc.num_fields); auto parent_tag = mdesc.pb_element_tag; if ((parent_tag > leaf_tag) || ((parent_tag+mdesc.num_fields) < leaf_tag)) { return NULL; } auto index = leaf_tag - parent_tag -1; const ProtobufCFieldDescriptor *fd = mdesc.ypbc_flddescs[index].pbc_fdesc; RW_ASSERT(fd); return fd; }
void test_rastxors(Raster *r) /***************************************************************************** * ****************************************************************************/ { Raster *bmr = &tcb.bytemap_raster; Raster *vbr = &tcb.verification_raster; Rastlib *rlib = r->lib; Coor x; Coor y; Pixel color; Ucoor width; Ucoor height; short iteration_count; short iteration_limit; width = r->width; height = r->height; /*----------------------------------------------------------------------- * xor_in_card testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,xor_rast[0]) && !tcb.test_via_generics) { log_bypass("xor_in_card(), xor_to_ram(), xor_from_ram()"); goto XRAST_DONE; } /*------------------------------------------------------------------------ * xor_in_card testing.. *----------------------------------------------------------------------*/ if (r == &tcb.display_raster) { log_progress("Testing bypassed for xor_in_card(), current raster is " "primary display raster.\n\n"); goto XRAST_IN_CARD_DONE; } iteration_limit = (tcb.timing_only_run) ? XRAST_TIME_ITCOUNT : 1; log_start("Testing xor_in_card()...\n"); iteration_count = iteration_limit; clear_screen(); while (iteration_count--) { } log_end("...xor_in_card() testing complete.\n\n"); if (!single_step()) return; XRAST_IN_CARD_DONE: /*------------------------------------------------------------------------ * xor_to_ram testing.. *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? XRAST_TIME_ITCOUNT : 1; log_start("Testing xor_to_ram()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(bmr, 0); pj_set_rast(vbr, 0); rlib->wait_vsync(r); while (iteration_count--) { color = iteration_count + 1; for (x = 0; x < width; x += 2*(WPAT/3)) pj_set_rect(bmr, color, x, 0, WPAT/3, height); for (y = 0; y < height; y += 2*(HPAT/3)) pj_set_rect(r, ~color, 0, y, width, HPAT/3); time_it( pj_xor_rast(r, bmr); ); }
void test_segs(Raster *r) /***************************************************************************** * test put_hseg, get_hseg, put_vseg, get_vseg. ****************************************************************************/ { short iteration_count; short iteration_limit; short do_verify; Raster *bmr = &tcb.bytemap_raster; Rastlib *rlib = r->lib; PLANEPTR pixbuf; Coor x; Coor y; Coor seg1; Coor seg2; Coor seg3; Coor step; Ucoor width; Ucoor height; Segfunc_t put_hseg; Segfunc_t get_hseg; Segfunc_t put_vseg; Segfunc_t get_vseg; width = r->width - 1; height = r->height - 1; do_verify = !tcb.timing_only_run; /*----------------------------------------------------------------------- * hseg testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the hseg testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,put_hseg) && !tcb.test_via_generics) { log_bypass("put_hseg() and get_hseg()"); goto HSEG_DONE; } put_hseg = rlib->put_hseg; get_hseg = rlib->get_hseg; /*----------------------------------------------------------------------- * test put_hseg using short segments... *---------------------------------------------------------------------*/ clear_screen(); step = 1 + height / 8; seg1 = 0; seg2 = (width / 2) - (SHRTSEG_WIDTH / 2); seg3 = width - SHRTSEG_WIDTH; pixbuf = bmr->hw.bm.bp[0]; iteration_limit = (tcb.timing_only_run) ? HSSEG_TIME_ITCOUNT : 1; log_start("Testing put_hseg() using short line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { make_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1); time_start(); for (y = 0; y < height; y += step) { put_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); } y = height; put_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); put_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); time_end(); } log_end("...put_hseg() short segment testing completed.\n\n"); /*----------------------------------------------------------------------- * test get_hseg using short segments... *---------------------------------------------------------------------*/ log_start("Testing get_hseg() using short line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { time_start(); for (y = 0; y < height; y += step) { memset(pixbuf, 0, SHRTSEG_WIDTH); memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg1; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg2; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg3; goto HSEG_ERROR; } } y = height; memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg1, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg1; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg2, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg2; goto HSEG_ERROR; } memset(pixbuf, 0, SHRTSEG_WIDTH); get_hseg(r, pixbuf, seg3, y, SHRTSEG_WIDTH); if (do_verify && !verify_ripple(bmr, SHRTSEG_WIDTH, 1, 0, 0, iteration_count, 1)) { x = seg3; goto HSEG_ERROR; } time_end(); } log_end("...get_hseg() short segment testing completed.\n\n"); if (!single_step()) return; /*----------------------------------------------------------------------- * test put_hseg using full-line segments... *---------------------------------------------------------------------*/ pixbuf = bmr->hw.bm.bp[0]; x = 0; iteration_limit = (tcb.timing_only_run) ? HFSEG_TIME_ITCOUNT : 1; log_start("Testing put_hseg() using full-line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { make_ripple(bmr, width, 1, 0, 0, iteration_count, 1); time_start(); for (y = 0; y < height; y += step) { put_hseg(r, pixbuf, x, y, width); } put_hseg(r, pixbuf, x, height, width); time_end(); } log_end("...put_hseg() full-line segment testing completed.\n\n"); /*----------------------------------------------------------------------- * test get_hseg using full-line segments... *---------------------------------------------------------------------*/ log_start("Testing get_hseg() using full-line segments...\n"); iteration_count = iteration_limit; while (iteration_count--) { for (y = 0; y < height; y += step) { memset(pixbuf, 0, width); time_it( get_hseg(r, pixbuf, x, y, width); ); if (do_verify && !verify_ripple(bmr, width, 1, 0, 0, iteration_count, 1)) goto HSEG_ERROR; } memset(pixbuf, 0, width); memset(pixbuf, 0, width); time_it( get_hseg(r, pixbuf, x, height, width); );
void test_rastblits(Raster *r) /***************************************************************************** * ****************************************************************************/ { Raster *bmr = &tcb.bytemap_raster; Raster *vbr = &tcb.verification_raster; Rastlib *rlib = r->lib; Coor x; Ucoor width; Ucoor height; short iteration_count; short iteration_limit; width = r->width; height = r->height; /*----------------------------------------------------------------------- * blit_in_card testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,blitrect[0]) && !tcb.test_via_generics) { log_bypass("blit_in_card(), blit_to_ram(), blit_from_ram()"); goto RBLIT_DONE; } /*------------------------------------------------------------------------ * blit_in_card testing.. * clear the screen, then lay in a striped background before testing *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? RBLIT_TIME_ITCOUNT : 1; log_start("Testing blit_in_card()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(vbr,0); for (x = 0; x+WPAT/3 <= width; x += 2*(WPAT/3)) { pj_set_rect(r, 1, x, 0, WPAT/3, height); pj_set_rect(vbr, 1, x, 0, WPAT/3, height); } rlib->wait_vsync(r); while (iteration_count--) { draw_blitpattern(r, iteration_count, 0); time_start(); do_blits(r, r); time_end(); } draw_blitpattern(vbr, 0, 0); do_blits(vbr, vbr); verify_raster(r, vbr, TRUE); log_end("...blit_in_card() testing complete.\n\n"); if (!single_step()) goto RBLIT_DONE; /*------------------------------------------------------------------------ * blit_to_ram testing.. * clear the screen, lay in a striped background, blit background to ram *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? RBLIT_TIME_ITCOUNT : 1; log_start("Testing blit_to_ram()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(bmr, 0); pj_set_rast(vbr, 0); for (x = 0; x+WPAT/3 <= width; x += 2*(WPAT/3)) { pj_set_rect(bmr, 1, x, 0, WPAT/3, height); pj_set_rect(vbr, 1, x, 0, WPAT/3, height); } rlib->wait_vsync(r); while (iteration_count--) { draw_blitpattern(r, iteration_count, 0); time_start(); do_blits(r, bmr); time_end(); } draw_blitpattern(vbr, 0, 0); do_blits(vbr, vbr); verify_raster(bmr, vbr, TRUE); log_end("...blit_to_ram() testing complete.\n\n"); if (!single_step()) goto RBLIT_DONE; /*------------------------------------------------------------------------ * blit_from_ram testing.. * clear the screen, lay in a striped background *----------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? RBLIT_TIME_ITCOUNT : 1; log_start("Testing blit_from_ram()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(bmr, 0); pj_set_rast(vbr, 0); for (x = 0; x+WPAT/3 <= width; x += 2*(WPAT/3)) { pj_set_rect(r, 1, x, 0, WPAT/3, height); pj_set_rect(vbr, 1, x, 0, WPAT/3, height); } rlib->wait_vsync(r); while (iteration_count--) { draw_blitpattern(bmr, iteration_count, 0); time_start(); do_blits(bmr, r); time_end(); } draw_blitpattern(vbr, 0, 0); do_blits(vbr, vbr); verify_raster(r, vbr, TRUE); log_end("...blit_from_ram() testing complete.\n\n"); single_step(); RBLIT_DONE: return; }
bool Type::is_ref() const { return is_interface() || is_object() || is_alt() || is_generic() || is_nil(); }
void test_mask1blit(Raster *r) /***************************************************************************** * ****************************************************************************/ { Rastlib *rlib = r->lib; Raster *vbr = &tcb.verification_raster; Coor x; Coor y; Coor xstart; Coor width; Coor height; Pixel color; short iteration_count; short iteration_limit; width = r->width; height = r->height; /*----------------------------------------------------------------------- * mask1blit testing... * if the driver didn't provide a routine, and we're not testing via * generics, skip the testing. *---------------------------------------------------------------------*/ if (is_generic(rlib,mask1blit) && !tcb.test_via_generics) { log_bypass("mask1blit()"); goto M1BLIT_DONE; } /*----------------------------------------------------------------------- * test mask1blit... *---------------------------------------------------------------------*/ iteration_limit = (tcb.timing_only_run) ? MASK1_TIME_ITCOUNT : 1; log_start("Testing mask1blit()...\n"); iteration_count = iteration_limit; pj_set_rast(r, 0); pj_set_rast(vbr,0); for (x = 0; x+MBPW/3 <= width; x += 2*(MBPW/3)) { pj_set_rect(r, 1, x, 0, MBPW/3, height); pj_set_rect(vbr, 1, x, 0, MBPW/3, height); } rlib->wait_vsync(r); time_start(); while (iteration_count--) { color = iteration_count * 3; for (y = -MBPH+3, xstart = -MBPW; y < height+MBPH; y += MBPH, xstart +=1) { for (x=xstart; x < width+MBPW; x+=MBPW) { ++color; pj_mask1blit(markBitmap, MBPR, 0, 0, r, x, y, MBPW, MBPH, color); } } } time_end(); /* build the verification raster... */ color = 0; for (y = -MBPH+3, xstart = -MBPW; y < height+MBPH; y += MBPH, xstart +=1) { for (x=xstart; x < width+MBPW; x+=MBPW) { ++color; pj_mask1blit(markBitmap, MBPR, 0, 0, vbr, x, y, MBPW, MBPH, color); } } verify_raster(r, vbr, TRUE); M1BLIT_EXIT: log_end("...testing of mask1blit() complete.\n\n"); single_step(); M1BLIT_DONE: return; }