-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multi-layered render target #8108
Conversation
Clients can create a multi-layered render target that consists of array textures, and use it as a custom render target. A new sample app "hellostereo" demonstrates how to use this feature.
Co-authored-by: Ben Doherty <[email protected]>
@@ -34,7 +34,7 @@ struct RenderTarget::BuilderDetails { | |||
uint32_t mWidth{}; | |||
uint32_t mHeight{}; | |||
uint8_t mSamples = 1; // currently not settable in the public facing API | |||
uint8_t mLayerCount = 0;// currently not settable in the public facing API | |||
uint8_t mLayerCount = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this needs to be 1. This value gets directly assigned to a range struct in vk for doing barriers, and it needs to be > 0, which makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I can change it to 1 since layer==1 still means a regular RT, I'm not sure what you meant. Could you elaborate on where it could cause an issue? I tested it with both Vulkan and OpenGL backends.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry not about barriers, but when the image is created.
Here's the validation error it tripped:
https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageViewCreateInfo-imageViewType-04973
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Makes sense. Let me update it.
@@ -107,6 +112,7 @@ RenderTarget* RenderTarget::Builder::build(Engine& engine) { | |||
|
|||
mImpl->mWidth = minWidth; | |||
mImpl->mHeight = minHeight; | |||
mImpl->mLayerCount = minDepth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, can minDepth be 0? In which case, it needs to be 1 IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It cannot be 0. The default for depth is 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the user could pass 0, but that would be an precondition violation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I meant by "it cannot be 0" is that even if a user passes 0 explicitly, FTexture::getDepth
returns 1 as minimum. But yeah, they should know what went wrong in the case. Let me add one more check just in case.
|
||
int main(int argc, char** argv) { | ||
App app{}; | ||
app.config.title = "stereoscopic rendering"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the default Config.stereoscopicType
is NONE
, then is there a bug if this renders in stereo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! this sample requires the multiview build flag. Let me update it.
be61308
to
44d86fd
Compare
@@ -107,6 +112,7 @@ RenderTarget* RenderTarget::Builder::build(Engine& engine) { | |||
|
|||
mImpl->mWidth = minWidth; | |||
mImpl->mHeight = minHeight; | |||
mImpl->mLayerCount = minDepth; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the user could pass 0, but that would be an precondition violation.
Clients can create a multi-layered render target that consists of array textures, and use it as a custom render target.
A new sample app "hellostereo" demonstrates how to use this feature.