Vulkan depal code now passes validation, but produces black.

This commit is contained in:
Henrik Rydgård committed 2017-10-31 12:35:00 +01:00
1 parent 3f503ca297
commit 07dfda0633
5 files changed
+33 -2

No files matched your search

+17
View File
@@ -343,6 +343,8 @@ private:
DataFormat format_;
};
class VKFramebuffer;
class VKContext : public DrawContext {
public:
VKContext(VulkanContext *vulkan);
@@ -481,6 +483,7 @@ private:
VkDescriptorSetLayout descriptorSetLayout_;
VkPipelineLayout pipelineLayout_;
VkPipelineCache pipelineCache_;
VKFramebuffer *curFramebuffer_ = nullptr;
VkDevice device_;
VkQueue queue_;
@@ -1303,13 +1306,27 @@ void VKContext::BindFramebufferAsRenderTarget(Framebuffer *fbo, const RenderPass
VKFramebuffer *fb = (VKFramebuffer *)fbo;
VKRRenderPassAction color = (VKRRenderPassAction)rp.color; // same values.
VKRRenderPassAction depth = (VKRRenderPassAction)rp.color; // same values.
if (fb) {
ILOG("Binding image as RT: %x (clear_color: %d)", (int)fb->GetFB()->color.image, rp.color == RPAction::CLEAR);
}
if (fb && boundImageView_[0] == fb->GetFB()->color.imageView) {
// Crash();
}
renderManager_.BindFramebufferAsRenderTarget(fb ? fb->GetFB() : nullptr, color, depth, rp.clearColor, rp.clearDepth, rp.clearStencil);
curFramebuffer_ = fb;
}
// color must be 0, for now.
void VKContext::BindFramebufferAsTexture(Framebuffer *fbo, int binding, FBChannel channelBit, int attachment) {
VKFramebuffer *fb = (VKFramebuffer *)fbo;
if (fb == curFramebuffer_) {
Crash();
}
int aspect = 0;
if (channelBit & FBChannel::FB_COLOR_BIT) aspect |= VK_IMAGE_ASPECT_COLOR_BIT;
if (channelBit & FBChannel::FB_DEPTH_BIT) aspect |= VK_IMAGE_ASPECT_DEPTH_BIT;