Comments (13)
With regards to your global barrier, it may be preferable to keep the old code to be explicit about the intend, but note that it is not actually necessary. Do you agree?
from vulkantutorial.
I disagree for this transition :
transitionImageLayout(textureImage, VK_FORMAT_R8G8B8A8_UNORM, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL);
You want to transition the image from TRANSFER_DST to SHADER_READ.
As I wrote above, you must wait the transfer stage to be finished. And you want to use it at the Fragment Shader stage.
That's said, you must flush the caches used for transfers with VK_ACCESS_TRANSFER_WRITE and invalidate caches red by the FRAGMENT_SHADER using VK_ACCESS_SHADER_READ.
So, if you do not want use a "all blocking barrier", you should, IMHO, at least use :
srcStage = TRANSFER;
dstStage = FRAGMENT_SHADER
srcAccess = TRANSFER_WRITE;
dstAccess = SHADER_READ;
from vulkantutorial.
Actually, for the dstStage/Access, a TOP_OF_PIPE / 0 should be correct.
from vulkantutorial.
For your first proposal, am I understanding correctly that you want to change
if (oldLayout == VK_IMAGE_LAYOUT_PREINITIALIZED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) {
barrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;
barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
} else if (oldLayout == VK_IMAGE_LAYOUT_PREINITIALIZED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) {
barrier.srcAccessMask = VK_ACCESS_HOST_WRITE_BIT;
barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
}
To:
if (oldLayout == VK_IMAGE_LAYOUT_PREINITIALIZED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL) {
barrier.srcAccessMask = 0;
barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
} else if (oldLayout == VK_IMAGE_LAYOUT_PREINITIALIZED && newLayout == VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) {
barrier.srcAccessMask = 0;
barrier.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
}
Because if I do this, I still get a warning from the validation layers despite your pull request.
from vulkantutorial.
It is correct, try to upgrade your validation layer, I pushed a fix that correct this bug :
KhronosGroup/Vulkan-LoaderAndValidationLayers#1142
from vulkantutorial.
I am aware, but I'm already using the latest version.
from vulkantutorial.
I do not have any problem
I am using archlinux and use vulkan-extra-layers 1.0.37
from vulkantutorial.
Here is the code I am using :
vk::ImageMemoryBarrier Transferer::transitionImage(Image image,
vk::ImageLayout oldLayout,
vk::ImageLayout newLayout,
vk::ImageSubresourceRange imageSubResourceRange) {
vk::AccessFlags src, dst;
if(oldLayout == vk::ImageLayout::eUndefined || oldLayout == vk::ImageLayout::ePreinitialized)
src = vk::AccessFlags();
// If it was in transferDst, we wait for transferWrite
else if(oldLayout == vk::ImageLayout::eTransferDstOptimal)
src = vk::AccessFlagBits::eTransferWrite;
// If it was in transferSrc, we wait for transferRead
else if(oldLayout == vk::ImageLayout::eTransferSrcOptimal)
src = vk::AccessFlagBits::eTransferRead; // Useless since make available a read is meaningless
else
assert(!"This oldLayout is not managed");
// If it will be transferSrcOptimal, it should be ready at transferRead
if(newLayout == vk::ImageLayout::eTransferSrcOptimal)
dst = vk::AccessFlagBits::eTransferRead;
// If it will be transferDstOptimal
else if(newLayout == vk::ImageLayout::eTransferDstOptimal)
dst = vk::AccessFlagBits::eTransferWrite; // Myst be useless since invalidate for a write
// If it will be shaderReadOnlyOptimal, it should be ready at shaderRead
else if(newLayout == vk::ImageLayout::eShaderReadOnlyOptimal)
dst = vk::AccessFlagBits::eShaderRead;
else
assert(!"This newLayout is not managed");
return vk::ImageMemoryBarrier(src, dst, oldLayout, newLayout, VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_IGNORED,
image, imageSubResourceRange);
}
from vulkantutorial.
I'm also using version 1.0.37 of the validation layers, although I don't know what "vulkan-extra-layers" is.
from vulkantutorial.
I guess it is for other validation layers, but 1.0.37 should be good.
What is the message that is gave by the validation layers?
from vulkantutorial.
Source AccessMask 0 [None] must have required access bit 16384 [VK_ACCESS_HOST_WRITE_BIT] when layout is VK_IMAGE_LAYOUT_PREINITIALIZED, unless the app has previously added a barrier for this transition.
from vulkantutorial.
It is weird ^^, I do not have any problem... Try to compile by yourself the validation layers? Else, try to compile my VulkanExample Scene and launch it to see if in your case you have the same error or not.
from vulkantutorial.
Ah, I had a configuration error that caused it to use DLLs from an older SDK. It runs without errors now, I'll update the tutorial.
from vulkantutorial.
Related Issues (20)
- VK_MAKE_VERSION deprecated HOT 1
- GlfwInit should be inside an if statement
- Possibly erroneous code in "Binding the vertex buffer" section of Vertex buffer creation HOT 2
- Synchronization Validation Error in 30_multisampling.cpp
- CMake issue
- getMaxUsableSampleCount crash
- UpdateUniformBuffer between fences is misleading for a beginner. HOT 1
- Suggestions about misleading terminologies in "Descriptor layout and buffer" chapater HOT 1
- shaders/comp.spv
- Add links highlighting for pdf
- Add credits sub chapter to introduction
- Synchronization Errors in Hello Triangle Tutorial HOT 1
- Website periodically redirects to random possibly malicious spam HOT 2
- Enabling VK_KHR_portability_enumeration causes deadlock on Arch Linux HOT 1
- Dedicated transfer queue for copying buffers
- Frames showing up in the wrong order HOT 1
- GPU memory leak HOT 1
- SIGSEGV after completing example 06.
- Errors running Chapter 2 on M2 mac
- Typo in Drawing_a_triangle/Setup/Validation_layers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vulkantutorial.