这篇教程C++ stride函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stride函数的典型用法代码示例。如果您正苦于以下问题:C++ stride函数的具体用法?C++ stride怎么用?C++ stride使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stride函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: brw_push_insn_statevoidvec4_generator::generate_gs_set_write_offset(struct brw_reg dst, struct brw_reg src0, struct brw_reg src1){ /* From p22 of volume 4 part 2 of the Ivy Bridge PRM (2.4.3.1 Message * Header: M0.3): * * Slot 0 Offset. This field, after adding to the Global Offset field * in the message descriptor, specifies the offset (in 256-bit units) * from the start of the URB entry, as referenced by URB Handle 0, at * which the data will be accessed. * * Similar text describes DWORD M0.4, which is slot 1 offset. * * Therefore, we want to multiply DWORDs 0 and 4 of src0 (the x components * of the register for geometry shader invocations 0 and 1) by the * immediate value in src1, and store the result in DWORDs 3 and 4 of dst. * * We can do this with the following EU instruction: * * mul(2) dst.3<1>UD src0<8;2,4>UD src1 { Align1 WE_all } */ brw_push_insn_state(p); brw_set_access_mode(p, BRW_ALIGN_1); brw_set_mask_control(p, BRW_MASK_DISABLE); brw_MUL(p, suboffset(stride(dst, 2, 2, 1), 3), stride(src0, 8, 2, 4), src1); brw_set_access_mode(p, BRW_ALIGN_16); brw_pop_insn_state(p);}
开发者ID:anderco,项目名称:mesa,代码行数:31,
示例2: emit_pixel_xystatic void emit_pixel_xy(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, const struct brw_reg *arg0){ struct brw_reg r1 = brw_vec1_grf(1, 0); struct brw_reg r1_uw = retype(r1, BRW_REGISTER_TYPE_UW); brw_set_compression_control(p, BRW_COMPRESSION_NONE); /* Calculate pixel centers by adding 1 or 0 to each of the * micro-tile coordinates passed in r1. */ if (mask & WRITEMASK_X) { brw_ADD(p, vec16(retype(dst[0], BRW_REGISTER_TYPE_UW)), stride(suboffset(r1_uw, 4), 2, 4, 0), brw_imm_v(0x10101010)); } if (mask & WRITEMASK_Y) { brw_ADD(p, vec16(retype(dst[1], BRW_REGISTER_TYPE_UW)), stride(suboffset(r1_uw,5), 2, 4, 0), brw_imm_v(0x11001100)); } brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED);}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:29,
示例3: stencilBlitzStencilVersionvoid stencilBlitzStencilVersion(BenchmarkExt<int>& bench){ bench.beginImplementation("Blitz++ Stencil"); while (!bench.doneImplementationBenchmark()) { int N = bench.getParameter(); cout << "Blitz++ Stencil: N = " << N << endl; cout.flush(); long iters = bench.getIterations(); Array<double,3> A(N,N,N), B(N,N,N); initializeRandomDouble(A.data(), N*N*N, A.stride(thirdDim)); initializeRandomDouble(B.data(), N*N*N, B.stride(thirdDim)); TinyVector<int,2> size = N-2; generateFastTraversalOrder(size); double c = 1/7.; ; bench.start(); for (long i=0; i < iters; ++i) { Range I(1,N-2), J(1,N-2), K(1,N-2); applyStencil(test1stencil(),A,B); applyStencil(test1stencil(),B,A); } bench.stop(); } bench.endImplementation();}
开发者ID:OliverDA,项目名称:sph-blitz,代码行数:32,
示例4: emit_pixel_xystatic void emit_pixel_xy(struct brw_wm_compile *c, struct prog_instruction *inst){ struct brw_reg r1 = brw_vec1_grf(1, 0); struct brw_reg r1_uw = retype(r1, BRW_REGISTER_TYPE_UW); struct brw_reg dst0, dst1; struct brw_compile *p = &c->func; GLuint mask = inst->DstReg.WriteMask; dst0 = get_dst_reg(c, inst, 0, 1); dst1 = get_dst_reg(c, inst, 1, 1); /* Calculate pixel centers by adding 1 or 0 to each of the * micro-tile coordinates passed in r1. */ if (mask & WRITEMASK_X) { brw_ADD(p, vec8(retype(dst0, BRW_REGISTER_TYPE_UW)), stride(suboffset(r1_uw, 4), 2, 4, 0), brw_imm_v(0x10101010)); } if (mask & WRITEMASK_Y) { brw_ADD(p, vec8(retype(dst1, BRW_REGISTER_TYPE_UW)), stride(suboffset(r1_uw, 5), 2, 4, 0), brw_imm_v(0x11001100)); }}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:30,
示例5: size_yuv420static unsigned longsize_yuv420(int w, int h){ unsigned yPitch = stride(w); return h * (yPitch + (yPitch >> 1));}
开发者ID:freedesktop-unofficial-mirror,项目名称:openchrome__xf86-video-openchrome,代码行数:7,
示例6: printfvoid Data::print() const{ printf("%p + %d, (%d", mData, offset(), size(0)); for(int i=1;i<highestDim(*this);++i){ printf(",%d", size(i)); } printf("):%+d, %s %s/n", stride(), typeToString(type()).c_str(), toToken().c_str());}
开发者ID:eranws,项目名称:GLV,代码行数:7,
示例7: stridevoid const* ms::GLPixelBuffer::as_argb_8888(){ if (pixels_need_y_flip) { auto const stride_val = stride().as_uint32_t(); auto const height = size_.height.as_uint32_t(); std::vector<char> tmp(stride_val); for (unsigned int i = 0; i < height / 2; i++) { /* Store line i */ tmp.assign(&pixels[i * stride_val], &pixels[(i + 1) * stride_val]); /* Copy line height - i - 1 to line i */ copy_and_convert_pixel_line(&pixels[(height - i - 1) * stride_val], &pixels[i * stride_val]); /* Copy stored line (i) to height - i - 1 */ copy_and_convert_pixel_line(tmp.data(), &pixels[(height - i - 1) * stride_val]); } /* Process middle line if there is one */ if (height % 2 == 1) { copy_and_convert_pixel_line(&pixels[(height / 2) * stride_val], &pixels[(height / 2) * stride_val]); } pixels_need_y_flip = false; } return pixels.data();}
开发者ID:ubuntu-touch-leo,项目名称:mir,代码行数:35,
|