Skip to content

Commit 55378f1

Browse files
committed
dev merge to main
2 parents 3f5500a + 4eca54e commit 55378f1

File tree

8 files changed

+39
-5
lines changed

8 files changed

+39
-5
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ Vulkan入门精要
1818

1919
使用`Sphinx`书写和发布
2020

21+
<!--
2122
## Sponsor
2223
2324
想赞助的小伙伴,欢迎使用`爱发电`赞助,请量力而为,如果赞助完真有困难可以退回,**未成年人禁止投喂!!!**
24-
![爱发电Essentials.of.Vulkan](./source/_static/aifadian.jpg)
25+
![爱发电Essentials.of.Vulkan](./source/_static/aifadian.jpg)
26+
-->

memorandum.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
资源与内存->VkMemoryRequirements->对应关系 给出图示

source/Changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@
44
此更新日志为纵览更新,对于具体文章的更新位于每个文章的开头的 `更新记录` 中。
55
```
66

7+
## 2024/9/14
8+
9+
>* 更新`纵览`文档
10+
11+
## 2024/9/6
12+
13+
>* 更新`资源与内存`文档
14+
15+
## 2024/9/3
16+
17+
>* 更新`资源`文档
18+
719
## 2024/8/29
820

921
>* 更新`欢迎来到 Vulkan 入门精要`文档

source/Overview.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
* 2024/1/20 增加 ``vkWaitForFences`` 章节。
179179
* 2024/2/4 增加 ``VkInstanceCreateFlags`` 章节。并增加 ``VkFlags 与 位域`` 说明。
180180
* 2024/2/4 更新 ``VkQueueFlags`` 章节。将其中的 ``VkFlags`` 说明转移至 ``VkInstanceCreateFlags`` 章节的 ``VkFlags 与 位域`` 说明中。
181+
* 2024/9/14 增加 ``模棱两可的函数获取`` 注释说明。
181182

182183
由于 ``Vulkan`` 比较复杂,为了更好的入门 ``Vulkan`` ,还是大致过一遍 ``Vulkan`` 的核心思路,这对以后的学习很有帮助。
183184

@@ -442,7 +443,13 @@ Vulkan 函数分类
442443
.. admonition:: vkGetInstanceProcAddr 和 Device 域函数
443444
:class: note
444445

445-
在 ``Vulkan`` 中并没有禁止用户使用 ``vkGetInstanceProcAddr`` 获得 ``Device`` 域函数,但这是不推荐的,当有多个硬件设备时会造成模棱两可的函数获取。比如电脑上插着两个显卡,一个是摩尔线程的,一个是景嘉微的,这两个设备都支持绘制函数 ``vkCmdDraw`` 函数 ,但是到底获取的是哪个设备的实现是由 ``Vulkan Loader`` 定义的,用户并不能知道返回的函数是哪个设备的实现。
446+
在 ``Vulkan`` 中并没有禁止用户使用 ``vkGetInstanceProcAddr`` 获得 ``Device`` 域函数,但这是不推荐的,当有多个硬件设备时会造成 “模棱两可” 的函数获取。比如电脑上插着两个显卡,一个是摩尔线程的,一个是景嘉微的,这两个设备都支持绘制函数 ``vkCmdDraw`` 函数 ,但是到底获取的是哪个设备的实现是由 ``Vulkan Loader`` 定义的,用户并不能知道返回的函数是哪个设备的实现。
447+
448+
.. admonition:: 模棱两可的函数获取
449+
:class: seealso
450+
451+
``vkGetInstanceProcAddr`` 对于获取 ``Device 域`` 函数:当调用这些 ``Device 域`` 函数时 :bdg-danger:`一定` 是作用在某一个句柄(设备句柄或其子句柄)上,而句柄间有明确的子父关系 , ``Vulkan Loader`` 会根据句柄的子父关系查找到对应的设备句柄,并调用对应设备上的函数实现。
452+
``Vulkan Loader`` 在其中作为中间商进行了内部的函数调度,这种调度是需要消耗一部分调度时间的,为了得到更加高效的执行效率,推荐直接 :ref:`Get_Deivce_Function` 并调用,这将直接省去内部函数调度。
446453

447454
vkGetInstanceProcAddr
448455
************************
@@ -1426,6 +1433,8 @@ VkDeviceQueueCreateInfo
14261433

14271434
assert(result == VkResult::VK_SUCCESS) //是否创建成功
14281435

1436+
.. _Get_Deivce_Function:
1437+
14291438
获取 Device 域函数
14301439
############################
14311440

source/Resource.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
* 2024/5/7 增加 ``二维多级渐远纹理`` 示例章节。
6767
* 2024/5/7 增加 ``多采样二维颜色附件纹理`` 示例章节。
6868
* 2024/5/7 增加 ``深度-模板附件纹理`` 示例章节。
69+
* 2024/9/3 修正 ``VkImageTiling`` 打印错误。
6970

7071

7172
在 ``Vulkan`` 中只有 ``2`` 种资源 :
@@ -714,8 +715,6 @@ VkSampleCountFlagBits
714715

715716
单次采样与 ``8`` 次采样对比示意图
716717

717-
其中 ``VkImageCreateInfo::tiling`` 的 ``VkImageTiling`` 类型定义如下:
718-
719718
图片资源逻辑模型
720719
^^^^^^^^^^^^^^^^^^^^^^^^
721720

@@ -900,6 +899,8 @@ VkImageCreateFlagBits
900899

901900
如上示意图中各级的渐远纹理中每个像素都是有确切图像值的,这些只是帮助您从逻辑上理解多级渐远,但是在实际通过 ``vkCreateImage(...)`` 创建带有多级渐远纹理中,图片数据全都是初始值(可能为 ``0`` )。每一级别的多级渐远图片中每个像素具体为何值,需要通过执行 ``GPU指令`` 手动运算赋值。这将会在之后的章节进行讲解。
902901

902+
其中 ``VkImageCreateInfo::tiling`` 的 ``VkImageTiling`` 类型定义如下:
903+
903904
VkImageTiling
904905
^^^^^^^^^^^^^^^^^^^^^^^^
905906

source/ResourceAndMemory.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* 2024/5/18 更新 ``VkMemoryRequirements`` 章节。
1717
* 2024/5/21 更新 ``VkMemoryRequirements`` 章节。
1818
* 2024/5/21 增加 ``资源与设备内存绑定`` 章节。
19+
* 2024/9/6 更新 ``对应关系`` 章节。
1920

2021
在 `资源 <./Resource.html>`_ 章节中我们知道一个资源仅仅是一个 ``虚拟资源句柄`` ,其本质上并没有相应的内存实体用于存储数据。所以在创建完资源后,需要分配内存并与资源进行绑定,用于之后的数据读写。
2122

@@ -114,6 +115,14 @@ VkMemoryRequirements
114115

115116
所以一个 ``32`` 位的 ``VkMemoryRequirements::memoryTypeBits`` 完全可以覆盖到所有的 ``VkPhysicalDeviceMemoryProperties::memoryTypes`` 对应索引。
116117

118+
示意图如下:
119+
120+
.. figure:: ../_static/memory_type_bits.png
121+
122+
memoryTypeBits 与 memoryTypes
123+
124+
假如, ``VkPhysicalDeviceMemoryProperties::memoryTypes`` 有 ``10`` 个内存类型,其中 ``VkMemoryRequirements::memoryTypeBits`` 比特位为 ``1`` 所对应的内存索引的那个 ``设备内存`` 支持该为资源分配内存。
125+
117126
由于 ``VkMemoryRequirements::memoryTypeBits`` 中是按比特位存储的索引,所以我们需要遍历 ``32`` 位的每一位,来确定对应位是否为 ``1`` 。示例代码如下:
118127

119128
.. code:: c++
209 KB
Loading

source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
'myst_parser',
2121
'sphinx_copybutton',
2222
'sphinx_inline_tabs',
23-
'sphinx_last_updated_by_git',
23+
#'sphinx_last_updated_by_git',
2424
'sphinx_design',
2525
'sphinx_comments',
2626
]

0 commit comments

Comments
 (0)