当前位置: 首页 > news >正文

合肥seo招聘排名优化网站

合肥seo招聘,排名优化网站,wordpress 当前页面登录密码,娄底建设企业网站对应的教程文章: https://codelabs.developers.google.com/your-first-webgpu-app?hlzh-cn#5 对应的源码执行效果: 对应的教程源码: 此处源码和教程本身提供的部分代码可能存在一点差异。 class Color4 {r: number;g: number;b: number;a: number;constructor(pr 1.0, …对应的教程文章:  https://codelabs.developers.google.com/your-first-webgpu-app?hlzh-cn#5 对应的源码执行效果: 对应的教程源码:  此处源码和教程本身提供的部分代码可能存在一点差异。 class Color4 {r: number;g: number;b: number;a: number;constructor(pr 1.0, pg 1.0, pb 1.0, pa 1.0) {this.r pr;this.g pg;this.b pb;this.a pa;} }export class WGPURUniform {private mRVertices: Float32Array null;private mRPipeline: any | null null;private mVtxBuffer: any | null null;private mCanvasFormat: any | null null;private mWGPUDevice: any | null null;private mWGPUContext: any | null null;private mUniformBindGroup: any | null null;private mGridSize 4;constructor() {}initialize(): void {const canvas document.createElement(canvas);canvas.width 512;canvas.height 512;document.body.appendChild(canvas);console.log(ready init webgpu ...);this.initWebGPU(canvas).then(() {console.log(webgpu initialization finish ...);this.clearWGPUCanvas();});document.onmousedown (evt):void {this.updateUniform(this.mWGPUDevice);this.clearWGPUCanvas( new Color4( Math.random(), Math.random(), Math.random()) );}}private mUniformObj: any {uniformArray: null, uniformBuffer: null};private updateUniform(device: any): void {let n Math.round(Math.random() * 3);this.mGridSize 2 n;const obj this.mUniformObj;obj.uniformArray[0] this.mGridSize;obj.uniformArray[1] this.mGridSize;device.queue.writeBuffer(obj.uniformBuffer, 0, obj.uniformArray);}private createUniform(device: any, pipeline: any): void {// Create a uniform buffer that describes the grid.const uniformArray new Float32Array([this.mGridSize, this.mGridSize]);const uniformBuffer device.createBuffer({label: Grid Uniforms,size: uniformArray.byteLength,usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,});device.queue.writeBuffer(uniformBuffer, 0, uniformArray);this.mUniformBindGroup device.createBindGroup({label: Cell renderer bind group,layout: pipeline.getBindGroupLayout(0),entries: [{binding: 0,resource: { buffer: uniformBuffer }}],});const obj this.mUniformObj;obj.uniformArray uniformArray;obj.uniformBuffer uniformBuffer;}private createRectGeometryData(device: any, pass: any): void {let vertices this.mRVertices;let vertexBuffer this.mVtxBuffer;let cellPipeline this.mRPipeline;if(!cellPipeline) {let hsize 0.8;vertices new Float32Array([// X, Y,-hsize, -hsize, // Triangle 1 (Blue)hsize, -hsize,hsize, hsize,-hsize, -hsize, // Triangle 2 (Red)hsize, hsize,-hsize, hsize,]);vertexBuffer device.createBuffer({label: Cell vertices,size: vertices.byteLength,usage: GPUBufferUsage.VERTEX | GPUBufferUsage.COPY_DST,});device.queue.writeBuffer(vertexBuffer, /*bufferOffset*/0, vertices);const vertexBufferLayout {arrayStride: 8,attributes: [{format: float32x2,offset: 0,shaderLocation: 0, // Position, see vertex shader}],};const shaderCodes group(0) binding(0) varuniform grid: vec2f;vertexfn vertexMain(location(0) pos: vec2f,builtin(instance_index) instance: u32) -builtin(position) vec4f {let i f32(instance);// Compute the cell coordinate from the instance_indexlet cell vec2f(i % grid.x, floor(i / grid.x));let cellOffset cell / grid * 2;let gridPos (pos 1) / grid - 1 cellOffset;return vec4f(gridPos, 0, 1);}fragmentfn fragmentMain() - location(0) vec4f {return vec4f(0.8, 0.1, 0.1, 1);};const cellShaderModule device.createShaderModule({label: Cell shader,code: shaderCodes});cellPipeline device.createRenderPipeline({label: Cell pipeline,layout: auto,vertex: {module: cellShaderModule,entryPoint: vertexMain,buffers: [vertexBufferLayout]},fragment: {module: cellShaderModule,entryPoint: fragmentMain,targets: [{format: this.mCanvasFormat}]},});this.mRVertices vertices;this.mVtxBuffer vertexBuffer;this.mRPipeline cellPipeline;this.createUniform(device, cellPipeline);}pass.setPipeline(cellPipeline);pass.setVertexBuffer(0, vertexBuffer);pass.setBindGroup(0, this.mUniformBindGroup);pass.draw(vertices.length / 2, this.mGridSize * this.mGridSize);}private clearWGPUCanvas(clearColor: Color4 null): void {clearColor clearColor ? clearColor : new Color4(0.05, 0.05, 0.1);const device this.mWGPUDevice;const context this.mWGPUContext;const rpassParam {colorAttachments: [{clearValue: clearColor,// clearValue: [0.3,0.7,0.5,1.0], // yesview: context.getCurrentTexture().createView(),loadOp: clear,storeOp: store}]};const encoder device.createCommandEncoder();const pass encoder.beginRenderPass( rpassParam );this.createRectGeometryData(device, pass);pass.end();const commandBuffer encoder.finish();device.queue.submit([commandBuffer]);}private async initWebGPU(canvas: HTMLCanvasElement) {const gpu (navigator as any).gpu;if (gpu) {console.log(WebGPU supported on this browser.);const adapter await gpu.requestAdapter();if (adapter) {console.log(Appropriate GPUAdapter found.);const device await adapter.requestDevice();if (device) {this.mWGPUDevice device;console.log(Appropriate GPUDevice found.);const context canvas.getContext(webgpu) as any;const canvasFormat gpu.getPreferredCanvasFormat();this.mWGPUContext context;this.mCanvasFormat canvasFormat;console.log(canvasFormat: , canvasFormat);context.configure({device: device,format: canvasFormat,alphaMode: premultiplied});} else {throw new Error(No appropriate GPUDevice found.);}} else {throw new Error(No appropriate GPUAdapter found.);}} else {throw new Error(WebGPU not supported on this browser.);}}run(): void {} }
http://wiki.neutronadmin.com/news/366940/

相关文章:

  • 网站建设属于哪个分类编码中国纪检监察报网站
  • 树在线网页制作网站软文网站推广法
  • 美妆网站模版网站友情链接的好处
  • 网站长期建设 运营计划无锡做网站公司有哪些
  • 浙江建设厅网站那三类人员亚马逊做deal的网站
  • 网站被采集wordpress折叠代码
  • 新媒体包不包括公司网站的建设seo关键词是什么意思
  • 备案网站能打开吗怎样打造营销型网站建设
  • 小型电子商务企业网站建设网站建设实施背景分析
  • 好的做外贸的网站有哪些使用WordPress默认主题
  • seo两个域名一个网站有影响江西省上饶市城乡建设网站
  • 酒店机票最便宜的网站建设专注湛江地区网站开发定制建设
  • 松阳县建设局网站网站开发一般要多少钱
  • 宁波网站建设选择荣胜网络gg服务器租用网站
  • 假视频网站源码出售网站轮播图的按钮怎么做的
  • 响应式网站建设服务提供商天津网站制作套餐
  • 商务网站开发实验报告深圳商城网站设计推荐
  • 企业内部门户网站建设方案制作网站首页的步骤
  • 河南建设网站官网垂直行业门户网站建设方案
  • 上海做公司网站建筑公司网站制作
  • 有中文网站 怎么做英文网站丰宁县有做网站的吗
  • 深圳网站设计 建设科技有限公司网站建设的常见技术有哪些方面
  • 天津做网站哪家比较好企业qq怎么申请
  • 网站需要公司备案么ddns域名注册
  • 海南的网站建设公司凡客家具质量怎么样
  • 网站死链存在的问题长沙如何优化排名
  • 淮安网站制作设计重庆南岸营销型网站建设公司哪家专业
  • 怎么做社交网站自我建设外贸网站
  • 域名命名网站包做包装的网站
  • 网站被攻击的方法深圳最大的广告公司