Permalink
Browse files

Implement GetFramebufferAPITexture for Vulkan

  • Loading branch information...
hrydgard committed Oct 30, 2017
1 parent 0c7ae95 commit 6e9cd933b2f322a2cd6350d2680ff07347d52bde
Showing with 20 additions and 2 deletions.
  1. +2 −1 ext/native/thin3d/VulkanRenderManager.cpp
  2. +18 −1 ext/native/thin3d/thin3d_vulkan.cpp
@@ -515,7 +515,8 @@ VkImageView VulkanRenderManager::BindFramebufferAsTexture(VKRFramebuffer *fb, in
steps_[i]->render.finalColorLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
break;
}
else {
else if (steps_[i]->render.finalColorLayout != VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL) {
Crash();
// May need to shadow the framebuffer if we re-order passes later.
}
}
@@ -1315,11 +1315,28 @@ void VKContext::BindFramebufferAsTexture(Framebuffer *fbo, int binding, FBChanne
if (channelBit & FBChannel::FB_COLOR_BIT) aspect |= VK_IMAGE_ASPECT_COLOR_BIT;
if (channelBit & FBChannel::FB_DEPTH_BIT) aspect |= VK_IMAGE_ASPECT_DEPTH_BIT;
if (channelBit & FBChannel::FB_STENCIL_BIT) aspect |= VK_IMAGE_ASPECT_STENCIL_BIT;
ILOG("Binding image as texture: %x", (int)fb->GetFB()->color.image);
boundImageView_[0] = renderManager_.BindFramebufferAsTexture(fb->GetFB(), binding, aspect, attachment);
}
uintptr_t VKContext::GetFramebufferAPITexture(Framebuffer *fbo, int channelBit, int attachment) {
return 0;
if (!fbo)
return 0;
VKFramebuffer *fb = (VKFramebuffer *)fbo;
VkImageView view = VK_NULL_HANDLE;
switch (channelBit) {
case FB_COLOR_BIT:
view = fb->GetFB()->color.imageView;
break;
case FB_DEPTH_BIT:
case FB_STENCIL_BIT:
view = fb->GetFB()->depth.imageView;
break;
}
return (uintptr_t)view;
}
void VKContext::GetFramebufferDimensions(Framebuffer *fbo, int *w, int *h) {

0 comments on commit 6e9cd93

Please sign in to comment.