Vulkan: Implement SetBindGroup
This commit is contained in:
parent
14e0687f94
commit
54c11a8a55
|
@ -15,8 +15,10 @@
|
||||||
#include "backend/vulkan/CommandBufferVk.h"
|
#include "backend/vulkan/CommandBufferVk.h"
|
||||||
|
|
||||||
#include "backend/Commands.h"
|
#include "backend/Commands.h"
|
||||||
|
#include "backend/vulkan/BindGroupVk.h"
|
||||||
#include "backend/vulkan/BufferVk.h"
|
#include "backend/vulkan/BufferVk.h"
|
||||||
#include "backend/vulkan/FramebufferVk.h"
|
#include "backend/vulkan/FramebufferVk.h"
|
||||||
|
#include "backend/vulkan/PipelineLayoutVk.h"
|
||||||
#include "backend/vulkan/RenderPassVk.h"
|
#include "backend/vulkan/RenderPassVk.h"
|
||||||
#include "backend/vulkan/RenderPipelineVk.h"
|
#include "backend/vulkan/RenderPipelineVk.h"
|
||||||
#include "backend/vulkan/TextureVk.h"
|
#include "backend/vulkan/TextureVk.h"
|
||||||
|
@ -67,6 +69,8 @@ namespace backend { namespace vulkan {
|
||||||
void CommandBuffer::RecordCommands(VkCommandBuffer commands) {
|
void CommandBuffer::RecordCommands(VkCommandBuffer commands) {
|
||||||
Device* device = ToBackend(GetDevice());
|
Device* device = ToBackend(GetDevice());
|
||||||
|
|
||||||
|
RenderPipeline* lastRenderPipeline = nullptr;
|
||||||
|
|
||||||
Command type;
|
Command type;
|
||||||
while (mCommands.NextCommandId(&type)) {
|
while (mCommands.NextCommandId(&type)) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -223,6 +227,19 @@ namespace backend { namespace vulkan {
|
||||||
// Do nothing because the single subpass is ended in vkEndRenderPass
|
// Do nothing because the single subpass is ended in vkEndRenderPass
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case Command::SetBindGroup: {
|
||||||
|
SetBindGroupCmd* cmd = mCommands.NextCommand<SetBindGroupCmd>();
|
||||||
|
VkDescriptorSet set = ToBackend(cmd->group.Get())->GetHandle();
|
||||||
|
|
||||||
|
// TODO(cwallez@chromium.org): Add some dirty bits for this to allow setting
|
||||||
|
// before there is a pipeline layout
|
||||||
|
// TODO(cwallez@chromium.org): fix for compute passes
|
||||||
|
VkPipelineLayout layout =
|
||||||
|
ToBackend(lastRenderPipeline->GetLayout())->GetHandle();
|
||||||
|
device->fn.CmdBindDescriptorSets(commands, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||||
|
layout, cmd->index, 1, &set, 0, nullptr);
|
||||||
|
} break;
|
||||||
|
|
||||||
case Command::SetBlendColor: {
|
case Command::SetBlendColor: {
|
||||||
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
|
SetBlendColorCmd* cmd = mCommands.NextCommand<SetBlendColorCmd>();
|
||||||
float blendConstants[4] = {
|
float blendConstants[4] = {
|
||||||
|
@ -251,6 +268,7 @@ namespace backend { namespace vulkan {
|
||||||
|
|
||||||
device->fn.CmdBindPipeline(commands, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
device->fn.CmdBindPipeline(commands, VK_PIPELINE_BIND_POINT_GRAPHICS,
|
||||||
pipeline->GetHandle());
|
pipeline->GetHandle());
|
||||||
|
lastRenderPipeline = pipeline;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case Command::SetVertexBuffers: {
|
case Command::SetVertexBuffers: {
|
||||||
|
|
Loading…
Reference in New Issue