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

什么是市场营销策划广东seo网站推广代运营

什么是市场营销策划,广东seo网站推广代运营,做外贸网站需要缴什么税,免费推广的方式是WebGPU(七):C头部封装 在前面的学习中,我们使用的都是原生态的WebGPU API,那是基于C语言的API,但是为了更高效的开发,我们可以使用一个基于C的库。 根据参考的教程,这个github库提供更加纤细的描述。它提…

WebGPU(七):C++头部封装

在前面的学习中,我们使用的都是原生态的WebGPU API,那是基于C语言的API,但是为了更高效的开发,我们可以使用一个基于C++的库。

根据参考的教程,这个github库提供更加纤细的描述。它提供了一个webgpu.hpp的C++封装头文件,但是在Dawn的代码实现中,本身包含一个C++头封装文件,本例程主要使用Dawn自带的C++封装头文件。

#define WEBGPU_CPP_IMPLEMENTATION
#include <webgpu/webgpu.hpp>#include <glfw3webgpu.h>
#include <GLFW/glfw3.h>#include <iostream>
#include <cassert>#define UNUSED(x) (void)x;using namespace wgpu;int main (int, char**) {Instance instance = createInstance(InstanceDescriptor{});if (!instance) {std::cerr << "Could not initialize WebGPU!" << std::endl;return 1;}if (!glfwInit()) {std::cerr << "Could not initialize GLFW!" << std::endl;return 1;}glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);GLFWwindow* window = glfwCreateWindow(640, 480, "Learn WebGPU", NULL, NULL);if (!window) {std::cerr << "Could not open window!" << std::endl;return 1;}std::cout << "Requesting adapter..." << std::endl;Surface surface = glfwGetWGPUSurface(instance, window);RequestAdapterOptions adapterOpts{};adapterOpts.compatibleSurface = surface;Adapter adapter = instance.requestAdapter(adapterOpts);std::cout << "Got adapter: " << adapter << std::endl;std::cout << "Requesting device..." << std::endl;DeviceDescriptor deviceDesc{};deviceDesc.label = "My Device";deviceDesc.requiredFeaturesCount = 0;deviceDesc.requiredLimits = nullptr;deviceDesc.defaultQueue.label = "The default queue";Device device = adapter.requestDevice(deviceDesc);std::cout << "Got device: " << device << std::endl;Queue queue = device.getQueue();auto onDeviceError = [](WGPUErrorType type, char const* message, void* /* pUserData */) {std::cout << "Uncaptured device error: type " << type;if (message) std::cout << " (" << message << ")";std::cout << std::endl;};wgpuDeviceSetUncapturedErrorCallback(device, onDeviceError, nullptr /* pUserData */);std::cout << "Creating swapchain device..." << std::endl;
#ifdef WEBGPU_BACKEND_WGPUTextureFormat swapChainFormat = surface.getPreferredFormat(adapter);
#elseTextureFormat swapChainFormat = TextureFormat::BGRA8Unorm;
#endifSwapChainDescriptor swapChainDesc = {};swapChainDesc.width = 640;swapChainDesc.height = 480;swapChainDesc.usage = TextureUsage::RenderAttachment;swapChainDesc.format = swapChainFormat;swapChainDesc.presentMode = PresentMode::Fifo;SwapChain swapChain = device.createSwapChain(surface, swapChainDesc);std::cout << "Swapchain: " << swapChain << std::endl;while (!glfwWindowShouldClose(window)) {glfwPollEvents();TextureView nextTexture = swapChain.getCurrentTextureView();if (!nextTexture) {std::cerr << "Cannot acquire next swap chain texture" << std::endl;return 1;}CommandEncoderDescriptor commandEncoderDesc{};commandEncoderDesc.label = "Command Encoder";CommandEncoder encoder = device.createCommandEncoder(commandEncoderDesc);RenderPassDescriptor renderPassDesc{};WGPURenderPassColorAttachment renderPassColorAttachment = {};renderPassColorAttachment.view = nextTexture;renderPassColorAttachment.resolveTarget = nullptr;renderPassColorAttachment.loadOp = LoadOp::Clear;renderPassColorAttachment.storeOp = StoreOp::Store;renderPassColorAttachment.clearValue = Color{ 0.9, 0.1, 0.2, 1.0 };renderPassDesc.colorAttachmentCount = 1;renderPassDesc.colorAttachments = &renderPassColorAttachment;renderPassDesc.depthStencilAttachment = nullptr;renderPassDesc.timestampWriteCount = 0;renderPassDesc.timestampWrites = nullptr;RenderPassEncoder renderPass = encoder.beginRenderPass(renderPassDesc);renderPass.end();nextTexture.release();CommandBufferDescriptor cmdBufferDescriptor{};cmdBufferDescriptor.label = "Command buffer";CommandBuffer command = encoder.finish(cmdBufferDescriptor);queue.submit(command);swapChain.present();}glfwDestroyWindow(window);glfwTerminate();return 0;
}

因为在测试的时候发现,有很多函数都没有相对应的封装,所以这一步的代码修改的内容相对而言很少。

http://www.qdjiajiao.com/news/4957.html

相关文章:

  • 国外做电商网站有哪些seo专业培训课程
  • 怎么网站搜索排名优化今日腾讯新闻最新消息
  • 破解php网站后台账号密码网站统计
  • 哪个网站有利于做课件搜索网页
  • 中山快速做网站服务北京seo优化技术
  • 购物中心网站建设电商入门基础知识
  • 苏州疫情开始时间培训如何优化网站
  • 营销模式方案广州百度seo优化排名
  • wordpress 关闭google字体成都抖音seo
  • 国际人才网中山招聘网合肥网站seo
  • 英文seo 文章发布类网站谷歌关键词热度查询
  • 玉树营销网站建设服务新野seo公司
  • 学校怎么做网站网易最新消息新闻
  • 网站建设实践报告绪论手机在线制作网站
  • 湖北网站建设价格什么是营销型网站?
  • 网站开发的方式seo整站排名
  • 哪些网站自己做宣传亚洲7号卫星电视
  • 做网站 多页面网址怎么弄优化搜索引擎
  • 企业网站网站设计北京做网站推广
  • 北京网站建设推广百度校招
  • 怎么改网站模块web3域名注册
  • 凯发网站百度运营怎么做
  • 网站的竞价怎么做电商网站建设方案
  • 信息流推广的竞价机制是抖音seo优化排名
  • 很大气的网站 营销苏州seo招聘
  • 宣讲家网站官德修养与作风建设免费招收手游代理
  • 长安网站制作公司百度浏览器网页版
  • 做网站代理拉不到人东莞seo优化排名推广
  • 做网站系统百度教育官网登录入口
  • 北京市工程建设信息交易网站百度搜索广告收费标准