- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我学习了如何使用 IASetVertexVuffers 将顶点缓冲区绑定(bind)到特定插槽。
但是,当我学习 DrawInstanced 时,我学会了仅使用起始顶点的索引来选择要绘制的顶点。
我想知道这个 DrawInstanced 如何通过计算哪个插槽的顶点缓冲区的索引来选择顶点。
或者它只是一个从插槽 0 到下一个插槽的索引?
这个问题可能很难解释,因为我使用了错误的英语。
最佳答案
如果您在调用 Draw*
时将多个顶点缓冲区绑定(bind)到多个插槽,然后根据当前的输入布局并行使用它们。
如果您使用 DrawIndexed*
, 然后一个绑定(bind)的索引缓冲区用于生成一个索引,用于所有与 D3D11_INPUT_PER_VERTEX_DATA
绑定(bind)的顶点缓冲区。 .即,它们被视为并行数组:
// This is psuedo-code!
Vertex0 vb0[nVerts];
Vertex1 vb1[nVerts];
Vertex2 vb2[nVerts];
uint32_t ib[nTris * 3];
Bind vb0 to slot 0, vb1 to slot 1, vb2 to slot 2 of Vertex Buffers
Bind ib to Index Buffer
// For DirectX 12, the input layout is part of the Pipeline State Object (PSO)
Bind an input layout that uses vertex data from from 3 slots
DrawIndexed
foreach j in 0 to (IndexCount-1);
index = ib[StartIndexLocation + j] + BaseVertexLocation
assemble vertex from vb0[index], vb1[index], vb2[index]
draw when you have enough vertices for the primitive
使用 DirectX 文档的挑战之一是通常每个版本都假设您已经知道以前的版本。早在 DirectX 9 中就引入了多流渲染,所以这是最后一次在概念上解释它:
Programming One or More Streams (Direct3D 9)
Draw*
方法:
void Draw(
UINT VertexCount,
UINT StartVertexLocation);
void DrawInstanced(
UINT VertexCountPerInstance,
UINT InstanceCount,
UINT StartVertexLocation,
UINT StartInstanceLocation);
// Uses an Index Buffer
void DrawIndexed(
UINT IndexCount,
UINT StartIndexLocation,
INT BaseVertexLocation);
void DrawIndexedInstanced(
UINT IndexCountPerInstance,
UINT InstanceCount,
UINT StartIndexLocation,
INT BaseVertexLocation,
UINT StartInstanceLocation);
DirectX 12 支持所有相同的功能,但通过两种方法实现。如果
InstanceCount
为 1,则不实例化:
void DrawInstanced(
UINT VertexCountPerInstance,
UINT InstanceCount,
UINT StartVertexLocation,
UINT StartInstanceLocation
);
// Uses an Index Buffer
void DrawIndexedInstanced(
UINT IndexCountPerInstance,
UINT InstanceCount,
UINT StartIndexLocation,
INT BaseVertexLocation,
UINT StartInstanceLocation
);
有关使用实例化的信息,请参阅 C++ 示例
简单实例化 :
DX11/
DX12 .
关于c++ - 'CommandList::DrawInstanced' 如何选择多个槽中的顶点缓冲区之一?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64895338/
我在QPushButton的最后一列中插入了QTableview。使用该按钮,我将使用按钮释放信号和插槽handlebutton(int)删除该特定行。 cpp代码: MainWindow::Main
它编译正常,但这是我运行程序时的错误消息: QObject::connect: Cannot queue arguments of type 'QVector' (Make sure 'QVector
我在 PyQt 中使用 for 循环 连接多个信号/槽。代码如下: # Connect Scan Callbacks for button in ['phase', 'etalon', 'mirror
我正在使用 Qt 创建一个 UI,有两个元素可能存在也可能不存在。此外,他们的 parent 也是不同的元素。但是,一个会影响另一个。 我应该如何以最佳方式构造信号/槽(或者我什至不应该使用该模式)?
我正在为这事兜圈子。就是无法理解信号和插槽。 只是在寻找某种机制,当我的 C++ 中出现信号时可以自动更新我的 UI。 示例: 我在 Qml 中有两个带有文本的标签:返回值的 _app.method。
我有两条路线呈现相同的组件,但来自 API 的数据不同。 该组件有一个名为 的子组件有一个 v-if检查特定插槽是否有内容的指令(因为如果它没有内容,我不希望该插槽显示)。 但是,在同一个父组件上可
我只是问当我的 html 位于 java-script 变量而不是 DOM 本身时如何使用 .each。 如果我有这样的 html: deze this dies 我能做到
基本上,想象一个宽度为 9(从 0 开始)的基于位置的区域 ╔════╦════╦════╦════╦════╦════╦════╦════╦════╗ ║ 0 ║ 1 ║ 2 ║ 3 ║
我想做一些非常简单的事情。单击切换按钮并在 QT 中获取消息框。 cpp: _show_hide_password = new QPushButton( "abc" ); _show_hide_pas
我有一个关于信号和槽的问题。在我的应用程序中,我想将来自一个对象的信号连接到 textEdit在对话框窗口中。我的信号发出 QString ;如果我违反封装(通过将 UI 公开而不是私有(privat
你好我来自java阵营,正在尝试做一个c++程序 我有一个名为 Manifest 的数组,它接收乘客对象 for (int i = 0; i Manifest . 例如 #include #incl
似乎为 Signal 类和插槽中调用的内容提供安全跨线程信号的唯一实现是 QT。 (也许我错了?)。 但是我不能在我做的项目中使用QT。那么我怎样才能从不同的线程(例如使用 Boost::signal
我将直接从示例开始: 在游戏中,有一个袋子供玩家用来存放他们的元素(元素的大小不一),袋子的大小也是可变的。 在一个 8x15 插槽的袋子中,我需要插入一个占用 2x2 插槽的元素,我可以搜索空间来实
PyQt 按钮事件可以以正常方式连接到函数,以便函数接收默认信号参数(在本例中为按钮选中状态): def connections(self): my_button.clicked.connec
访问类槽时,而不是写入 (defmethod get-name ((somebody person) (slot-value somebody 'name)) 是否可以使用点符号(又名 C++),即
我正在使用 vee-validate v3.0 进行验证并且设置很顺利,但现在我正在尝试设置我的元素的样式,但我似乎无法让它工作。我遵循了关于样式的非常简短的文档并编辑了 vee-validate 配
我尝试使用来自 https://wiki.qt.io/QThreads_general_usage 的方法与 moveToThread。一切安好。但是,如果我尝试将参数添加到完成的信号中,则会出现以下
我刚刚使用 iAds 和 adMob 在我的应用程序中实现了 adWhirl。一切都编译正确,adMob 工作完美,但我的 iAd 大小不正确。广告看起来尺寸合适,但实际上似乎被剪掉了。大约 1/4
我正在使用 python 和 PySide 开发 GUI 应用程序。我需要在单独的线程中运行长时间的背景任务。对于线程,我决定根据“正确”的方法使用 QThread,而不是从 if 进行子类化(参见
在用于编写 GUI 代码的 Qt 的 QML 语言中,QML 元素(如果我理解正确的话)在它们变得可见之前不会被实际创建。 (编辑: 听起来这些元素是在 QML 引擎加载它们时创建的,但看起来信号/槽
我是一名优秀的程序员,十分优秀!