cubesに色がつかない
まとめ
複数オブジェクトを描画してみようとしているが、cubesに色がつかない
こんな感じ
調べたこと
descriptor setのindex buffersをbindするときに
VUID-VkWriteDescriptorSet-dstArrayElement-00321
のメッセージが出ている。
khronos公式ページVkWriteDescriptorSet(3)でエラーメッセージを確認すると
The sum of dstArrayElement and descriptorCount must be less than or equal to the number of array elements in the descriptor set binding specified by dstBinding, and all applicable consecutive bindings, as described by https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#descriptorsets-updates-consecutive
VkWriteDescriptorSet の定義は以下。
// Provided by VK_VERSION_1_0 typedef struct VkWriteDescriptorSet { VkStructureType sType; const void* pNext; VkDescriptorSet dstSet; uint32_t dstBinding; uint32_t dstArrayElement; uint32_t descriptorCount; VkDescriptorType descriptorType; const VkDescriptorImageInfo* pImageInfo; const VkDescriptorBufferInfo* pBufferInfo; const VkBufferView* pTexelBufferView; } VkWriteDescriptorSet;
構造体の中のdstArrayElement+descriptorCountがdescriptor setの配列要素数以下にならなければならないようで、こちらはlayoutの作成時に指定する。
この記事を書きながら修正点に気づいたので、書き換えて実行してみるとcubesは赤く表示された
最後に
Hatena BlogはQiitaのようなcodeだけ書くような場所ではないと思うので、最後に雑感を少し。
プログラムの日記を書こうとすると、最後までビルドできないこともしばしばで、どのタイミングで記事にしようか迷うこともある。
今回は成功していない場合にでも投稿しようと思ったが、これでも意味はあるのだろうか?
同じエラーが出た人がいて、エラーのキーワードで検索したときに引っかかるかもしれないが、その場合には解決策が書かれていなければその人の問題は解決しない。。。
とりあえず書いておいて、解決すればリンクを貼るとかでもよいけど、それも大変そう。
まぁ何日か書きながら考えよう。