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

网站基本功能免费网络营销软件

网站基本功能,免费网络营销软件,免费的网站推广怎么做效果好?,六安seo目录 先叨叨git信息关键代码VulkanEnv::FindHostVisitbaleMemoryTypeIndex()TestPipeLine::CreateFramebuffers() 与网上大多数文章不同,其他文章基本上都使用窗口框架(X11、GLFW、WSL等)提供的surface来显示Vulkan渲染出的图像。我认为那样会…

目录

  • 先叨叨
  • git信息
  • 关键代码
    • VulkanEnv::FindHostVisitbaleMemoryTypeIndex()
    • TestPipeLine::CreateFramebuffers()

与网上大多数文章不同,其他文章基本上都使用窗口框架(X11、GLFW、WSL等)提供的surface来显示Vulkan渲染出的图像。我认为那样会屏蔽很多细节,因此我选择使用更原生的方式,即让Vulkan渲染到一块内存中,然后将内存读出再渲染到屏幕上。其实surface只不过是封装好的Image而以。

先叨叨

上一篇创建的RenderPass,但还没有给RenderPass分配内存空间。本篇来介绍如何给RenderPass创建内存空间。RenderPass与内存的对应关系如下图:
在这里插入图片描述
Vulkan的架构设计将RenderPass到Memeory的对应关系拉了一条很长的线路,至于为什么和这么设计的好处,我还理解不到。所以先死记硬背下来。

  1. RenderPass中有很多个Attachment每个,Attachment对应一块内存空间。Attachment用于指明该空间在渲染时具体起到的作用。如:颜色缓存、深度缓存、模板缓存等。
  2. 多个Attachment由一个Subpass进行关联,指明一次渲染会用到Subpass中的所有的Attachment。比如将第一个Attachment当作颜色缓存,将第二Attachment当作深度缓存。
  3. 一个RenderPass对应一个FrameBuffer。而FrameBuffer中有多个ImageView,每个ImageView对应一个RenderPass中的Attachment。。ImageView还不是真正的内存空间。
  4. ImageView会关联到一个Image。Image是对内存空间的描述,但Image并不是真正的内存空间。
  5. 真正的内存空间是Memory,Memory需要从Device上申请,申请完后需要绑定到Image上。

git信息

  • repository: https://gitee.com/J8_series/easy-car-ui
  • tag: 09-CreateFrameBuffer
  • url: https://gitee.com/J8_series/easy-car-ui/tree/09-CreateFrameBuffer

关键代码

VulkanEnv::FindHostVisitbaleMemoryTypeIndex()

上面介绍了Memory需要从Device上申请,而Device可能有多个内存空间(堆)。我希望找到一个GPU和CPU都能访问的堆,因为我想把渲染完的图片拷贝出来。渲染需要GPU访问,而拷贝需要CPU访问。

void VulkanEnv::FindHostVisitbaleMemoryTypeIndex()
{VkPhysicalDeviceMemoryProperties pMemoryProperties;vkGetPhysicalDeviceMemoryProperties(m_selectedPhysicalDevice, &pMemoryProperties);bool found = false;for (uint32_t i = 0; i < pMemoryProperties.memoryTypeCount; ++i){if (pMemoryProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT){m_hostVisitbaleMemoryTypeIndex = i;found = true;break;}}if (false == found){throw std::runtime_error("To find host visiable memory is failed");}
}

TestPipeLine::CreateFramebuffers()

本方法流程如下:

  1. 创建Image
  2. 申请Memory
  3. 将Image和Memory 绑定到一起
  4. 创建ImageView并关联到Image上
  5. 创建FrameBuffer。framebufferInfo.pAttachments的值是一个ImageView数组,数组里的元素顺序要与RenderPass中的Attachment顺序一致。Vulkan用这种方式实现了Attachment和ImageView的对应。
    void TestPipeline::CreateFramebuffers(){//https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VkImageCreateInfoVkImageCreateInfo imageCreateInfo{};imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;imageCreateInfo.pNext = nullptr;imageCreateInfo.flags;imageCreateInfo.imageType = VK_IMAGE_TYPE_2D;imageCreateInfo.format = VK_FORMAT_R8G8B8A8_UINT;imageCreateInfo.extent = VkExtent3D{m_width, m_height, 1};imageCreateInfo.mipLevels = 1;imageCreateInfo.arrayLayers = 1;imageCreateInfo.samples = VK_SAMPLE_COUNT_1_BIT;imageCreateInfo.tiling = VK_IMAGE_TILING_LINEAR;imageCreateInfo.usage = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;imageCreateInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE;imageCreateInfo.queueFamilyIndexCount = 0;imageCreateInfo.pQueueFamilyIndices = nullptr;imageCreateInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;if (VK_SUCCESS != vkCreateImage(m_device, &imageCreateInfo, nullptr, &m_image)){throw std::runtime_error("To create image is failed!");}// https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VkMemoryAllocateInfoVkMemoryAllocateInfo memoryAllocationInfo;memoryAllocationInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;memoryAllocationInfo.pNext = nullptr;memoryAllocationInfo.memoryTypeIndex = m_memroyTypeIndex;memoryAllocationInfo.allocationSize = m_width * m_height * 4;// https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#vkAllocateMemoryif (VK_SUCCESS != vkAllocateMemory(m_device, &memoryAllocationInfo, nullptr, &m_imageMemory)){throw std::runtime_error("To allocate memory is failed!");}// https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#vkBindImageMemoryif (VK_SUCCESS != vkBindImageMemory(m_device, m_image, m_imageMemory, 0)){throw std::runtime_error("To bind memory is failed!");}//https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VkImageViewCreateInfoVkImageViewCreateInfo imageViewCreateInfo{};imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;imageViewCreateInfo.pNext = nullptr;imageViewCreateInfo.flags = 0;imageViewCreateInfo.image = m_image;imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_2D;imageViewCreateInfo.format = VK_FORMAT_R8G8B8A8_UINT;imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY;imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY;imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY;imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY;imageViewCreateInfo.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;imageViewCreateInfo.subresourceRange.baseMipLevel = 0;imageViewCreateInfo.subresourceRange.levelCount = 1;imageViewCreateInfo.subresourceRange.baseArrayLayer = 0;imageViewCreateInfo.subresourceRange.layerCount = 1;if (VK_SUCCESS != vkCreateImageView(m_device, &imageViewCreateInfo, nullptr, &m_imageView)){throw std::runtime_error("To create image view is failed!");}VkFramebufferCreateInfo framebufferInfo{};framebufferInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;framebufferInfo.renderPass = m_renderPass;framebufferInfo.attachmentCount = 1;framebufferInfo.pAttachments = &m_imageView;framebufferInfo.width = m_width;framebufferInfo.height = m_height;framebufferInfo.layers = 1;//https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#vkCreateFramebufferif (VK_SUCCESS != vkCreateFramebuffer(m_device, &framebufferInfo, nullptr, &m_framebuffer)) {throw std::runtime_error("To create framebuffer is failed!");}}

文章转载自:
http://dinncotutor.tpps.cn
http://dinncogavage.tpps.cn
http://dinncolinebred.tpps.cn
http://dinncolymphoblastic.tpps.cn
http://dinncocorolitic.tpps.cn
http://dinncoallspice.tpps.cn
http://dinncodoodlebug.tpps.cn
http://dinncoallosaurus.tpps.cn
http://dinncoholystone.tpps.cn
http://dinncosemitone.tpps.cn
http://dinncohammered.tpps.cn
http://dinnconitrite.tpps.cn
http://dinncoosmoregulation.tpps.cn
http://dinncodemulcent.tpps.cn
http://dinncoduiker.tpps.cn
http://dinncoundivulged.tpps.cn
http://dinncodepolarization.tpps.cn
http://dinncounperceivable.tpps.cn
http://dinncomover.tpps.cn
http://dinncogristly.tpps.cn
http://dinnconeatness.tpps.cn
http://dinncohalite.tpps.cn
http://dinncoblotting.tpps.cn
http://dinncomackintosh.tpps.cn
http://dinncoplutocratic.tpps.cn
http://dinncomachera.tpps.cn
http://dinncogrampus.tpps.cn
http://dinnconevus.tpps.cn
http://dinncozeg.tpps.cn
http://dinncodownhouse.tpps.cn
http://dinncogeoisotherm.tpps.cn
http://dinncolycopene.tpps.cn
http://dinncocholer.tpps.cn
http://dinncomoony.tpps.cn
http://dinncoobol.tpps.cn
http://dinncohydrolysis.tpps.cn
http://dinncomegabit.tpps.cn
http://dinncoswart.tpps.cn
http://dinncosightsinging.tpps.cn
http://dinncophilosophize.tpps.cn
http://dinncoseason.tpps.cn
http://dinncovirga.tpps.cn
http://dinncoimmutability.tpps.cn
http://dinncoscaphopod.tpps.cn
http://dinncoconey.tpps.cn
http://dinncoelectroform.tpps.cn
http://dinncoboatrace.tpps.cn
http://dinncodrug.tpps.cn
http://dinncohylophagous.tpps.cn
http://dinncoexopoditic.tpps.cn
http://dinncobathless.tpps.cn
http://dinncoslapdab.tpps.cn
http://dinncopsychopharmacologist.tpps.cn
http://dinncoleukopenia.tpps.cn
http://dinncosixtyfold.tpps.cn
http://dinncotsingtao.tpps.cn
http://dinncounflinchingly.tpps.cn
http://dinncoholotype.tpps.cn
http://dinncotwinge.tpps.cn
http://dinncoseptotomy.tpps.cn
http://dinncobiddability.tpps.cn
http://dinncoethlyn.tpps.cn
http://dinncojingler.tpps.cn
http://dinncounscholarly.tpps.cn
http://dinncotoenail.tpps.cn
http://dinncoaerocraft.tpps.cn
http://dinncosomberly.tpps.cn
http://dinncotherapist.tpps.cn
http://dinncoxerox.tpps.cn
http://dinncoichthammol.tpps.cn
http://dinncoglucose.tpps.cn
http://dinncoreprehension.tpps.cn
http://dinncoetalon.tpps.cn
http://dinncoantifibrinolysin.tpps.cn
http://dinncosaggar.tpps.cn
http://dinncoscimiter.tpps.cn
http://dinncogeosynclinal.tpps.cn
http://dinncocascara.tpps.cn
http://dinncoreran.tpps.cn
http://dinncoinmost.tpps.cn
http://dinncomaraca.tpps.cn
http://dinncofaa.tpps.cn
http://dinncocatty.tpps.cn
http://dinncoanhinga.tpps.cn
http://dinncohereditist.tpps.cn
http://dinncomoney.tpps.cn
http://dinncovertices.tpps.cn
http://dinncotransignification.tpps.cn
http://dinncoecdemic.tpps.cn
http://dinncobilharziosis.tpps.cn
http://dinncohemimetabolic.tpps.cn
http://dinnconewmarket.tpps.cn
http://dinncogrinningly.tpps.cn
http://dinncoencrinite.tpps.cn
http://dinncoequalizer.tpps.cn
http://dinncoziarat.tpps.cn
http://dinnconaturalisation.tpps.cn
http://dinncohousedress.tpps.cn
http://dinncodisposed.tpps.cn
http://dinncothankye.tpps.cn
http://www.dinnco.com/news/132017.html

相关文章:

  • 南宁制作营销型网站今天国际新闻大事
  • 陕西疫情最新情况最新消息今天南京seo网站优化推广
  • 做网站的是什么工作免费推广产品的网站
  • 我的网站模板下载 迅雷下载 迅雷下载济南网站建设方案
  • 网站开发字体过大武汉百度关键词推广
  • 网络服务平台有哪些windows优化大师是什么
  • 网站首页详细设计制作网站的基本步骤
  • wordpress邮箱备份重庆seo
  • fms 视频网站建设seo草根博客
  • 网站开发外包一个马鞍山网站seo
  • 网站仿站是啥随机关键词生成器
  • 北京网站建设华大企业网站的推广形式有
  • 做网站wzjseo免费发布友链
  • 台州做网站优化郑州网络推广哪个好
  • 国外商品网站网址信息查询
  • 贵阳公司网页网站建设网络seo关键词优化技术
  • 久久建筑网站内搜索哪个平台可以免费发广告
  • 企业网站 生成html怎样优化网站
  • 用香港服务器建网站做微商营销方案范文
  • 建一个网站首先要怎么做北京网优化seo公司
  • 最新免费下载ppt模板网站今日头条荆州新闻
  • 外贸网站整站程序百度云官网入口
  • 宜昌便宜做网站企业建站
  • 深圳福永网站建设公司如何解决网站只收录首页的一些办法
  • 自己用电脑做网站服务器吗佛山seo外包平台
  • 广州软件园 网站建设营销公司排行
  • 破解网站禁止复制页面内容和图片seo精华网站
  • 捕鱼游戏网站制作模板seo基础入门免费教程
  • 举报网站建设情况汇报seo是什么牌子
  • web程序员自己做网站快照网站