mirror of
https://github.com/opus-tango/IntroductionToVulkan.git
synced 2026-03-20 03:55:26 +00:00
Fixed bug in buffer memory allocation code in tutorials 04 and 05. Modified ImageParameters structure (renamed "ImageView" member to "View", added "Sampler" member) and updated tutorial 03, 04 and 05. Fixed typos in comments.
This commit is contained in:
@@ -391,6 +391,7 @@ namespace ApiWithoutSecrets {
|
||||
Vulkan.VertexBuffer.Size = static_cast<uint32_t>(vertex_data.size() * sizeof(vertex_data[0]));
|
||||
if( !CreateBuffer( VK_BUFFER_USAGE_VERTEX_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, Vulkan.VertexBuffer ) ) {
|
||||
std::cout << "Could not create vertex buffer!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -400,6 +401,7 @@ namespace ApiWithoutSecrets {
|
||||
Vulkan.StagingBuffer.Size = 4000;
|
||||
if( !CreateBuffer( VK_BUFFER_USAGE_TRANSFER_SRC_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, Vulkan.StagingBuffer ) ) {
|
||||
std::cout << "Could not staging buffer!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -437,7 +439,7 @@ namespace ApiWithoutSecrets {
|
||||
|
||||
bool Tutorial05::AllocateBufferMemory( VkBuffer buffer, VkMemoryPropertyFlagBits property, VkDeviceMemory *memory ) {
|
||||
VkMemoryRequirements buffer_memory_requirements;
|
||||
vkGetBufferMemoryRequirements( GetDevice(), Vulkan.VertexBuffer.Handle, &buffer_memory_requirements );
|
||||
vkGetBufferMemoryRequirements( GetDevice(), buffer, &buffer_memory_requirements );
|
||||
|
||||
VkPhysicalDeviceMemoryProperties memory_properties;
|
||||
vkGetPhysicalDeviceMemoryProperties( GetPhysicalDevice(), &memory_properties );
|
||||
@@ -559,7 +561,7 @@ namespace ApiWithoutSecrets {
|
||||
}
|
||||
|
||||
bool Tutorial05::PrepareFrame( VkCommandBuffer command_buffer, const ImageParameters &image_parameters, VkFramebuffer &framebuffer ) {
|
||||
if( !CreateFramebuffer( framebuffer, image_parameters.ImageView ) ) {
|
||||
if( !CreateFramebuffer( framebuffer, image_parameters.View ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,4 +130,4 @@ namespace ApiWithoutSecrets {
|
||||
|
||||
} // namespace ApiWithoutSecrets
|
||||
|
||||
#endif // TUTORIAL_03_HEADER
|
||||
#endif // TUTORIAL_05_HEADER
|
||||
@@ -24,7 +24,7 @@ int main( int argc, char **argv ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Tutorial 04
|
||||
// Tutorial 05
|
||||
if( !tutorial05.CreateRenderPass() ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user