Skip to content

Commit 7a28b60

Browse files
committed
Thanks Sascha for testing. Looks like some changes from the code directory didn't fully make it over. This should compile everything again, I'm still working on compute_shader.
1 parent c1bea71 commit 7a28b60

File tree

6 files changed

+18
-25
lines changed

6 files changed

+18
-25
lines changed

attachments/05_window_surface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class HelloTriangleApplication {
173173
// first check if the graphicsIndex is good enough
174174
auto presentIndex = physicalDevice.getSurfaceSupportKHR( graphicsIndex, *surface )
175175
? graphicsIndex
176-
: ~0 );
176+
: ~0;
177177
if ( presentIndex == queueFamilyProperties.size() )
178178
{
179179
// the graphicsIndex doesn't support present -> look for another family index that supports both

attachments/06_swap_chain_creation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class HelloTriangleApplication {
260260
}
261261

262262
static vk::PresentModeKHR chooseSwapPresentMode(const std::vector<vk::PresentModeKHR>& availablePresentModes) {
263-
return std::ranges::contains( presentModes, vk::PresentModeKHR::eMailbox ) ? vk::PresentModeKHR::eMailbox : vk::PresentModeKHR::eFifo;
263+
return std::ranges::find( availablePresentModes, vk::PresentModeKHR::eMailbox ) != availablePresentModes.end() ? vk::PresentModeKHR::eMailbox : vk::PresentModeKHR::eFifo;
264264
}
265265

266266
vk::Extent2D chooseSwapExtent(const vk::SurfaceCapabilitiesKHR& capabilities) {

attachments/07_image_views.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ class HelloTriangleApplication {
230230
vk::DeviceCreateInfo deviceCreateInfo{
231231
.pNext = &features,
232232
.queueCreateInfoCount = 1,
233-
.pQueueCreateInfos = &deviceQueueCreateInfo
234-
.enabledExtensionCount = deviceExtensions.size();
235-
.ppEnabledExtensionNames = deviceExtensions.data();
233+
.pQueueCreateInfos = &deviceQueueCreateInfo,
234+
.enabledExtensionCount = static_cast<uint32_t>(deviceExtensions.size()),
235+
.ppEnabledExtensionNames = deviceExtensions.data()
236236
};
237237

238238
device = vk::raii::Device( physicalDevice, deviceCreateInfo );

attachments/27_depth_buffering.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ class HelloTriangleApplication {
512512
}
513513

514514
vk::Format findSupportedFormat(const std::vector<vk::Format>& candidates, vk::ImageTiling tiling, vk::FormatFeatureFlags features) {
515-
auto formatIt = std::ranges::find_if(candidates, [&physicalDevice, &tiling, &features](auto const format){
516-
vk::FormatProperties props = physicalDevice->getFormatProperties(format);
515+
auto formatIt = std::ranges::find_if(candidates, [&](auto const format){
516+
vk::FormatProperties props = physicalDevice.getFormatProperties(format);
517517
return (((tiling == vk::ImageTiling::eLinear) && ((props.linearTilingFeatures & features) == features)) ||
518518
((tiling == vk::ImageTiling::eOptimal) && ((props.optimalTilingFeatures & features) == features)));
519519
});
@@ -998,8 +998,7 @@ class HelloTriangleApplication {
998998
}
999999

10001000
static vk::Format chooseSwapSurfaceFormat(const std::vector<vk::SurfaceFormatKHR>& availableFormats) {
1001-
auto formatIt = std::ranges::find(availableFormats, vk::SurfaceFormatKHR(vk::Format::eB8G8R8A8Srgb, vk::ColorSpaceKHR::eSrgbNonlinear));
1002-
return (formatIt != availableFormats.end() ? *formatIt : availableFormats[0];
1001+
return (availableFormats[0].format == vk::Format::eUndefined) ? vk::Format::eB8G8R8A8Unorm : availableFormats[0].format;
10031002
}
10041003

10051004
static vk::PresentModeKHR chooseSwapPresentMode(const std::vector<vk::PresentModeKHR>& availablePresentModes) {

attachments/31_compute_shader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class ComputeShaderApplication {
120120
std::vector<vk::raii::Fence> inFlightFences;
121121
uint32_t currentFrame = 0;
122122

123-
float lastFrameTime = 0.0f;
123+
double lastFrameTime = 0.0;
124124

125125
bool framebufferResized = false;
126126

@@ -493,8 +493,8 @@ class ComputeShaderApplication {
493493

494494
void createShaderStorageBuffers() {
495495
// Initialize particles
496-
std::default_random_engine rndEngine((unsigned)time(nullptr));
497-
std::uniform_real_distribution<float> rndDist(0.0f, 1.0f);
496+
std::default_random_engine rndEngine(static_cast<unsigned>(time(nullptr)));
497+
std::uniform_real_distribution rndDist(0.0f, 1.0f);
498498

499499
// Initial particle positions on a circle
500500
std::vector<Particle> particles(PARTICLE_COUNT);
@@ -765,7 +765,7 @@ class ComputeShaderApplication {
765765

766766
void updateUniformBuffer(uint32_t currentImage) {
767767
UniformBufferObject ubo{};
768-
ubo.deltaTime = lastFrameTime * 2.0f;
768+
ubo.deltaTime = static_cast<float>(lastFrameTime) * 2.0f;
769769

770770
memcpy(uniformBuffersMapped[currentImage], &ubo, sizeof(ubo));
771771
}

attachments/CMakeLists.txt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,9 @@ add_chapter (09_shader_modules
151151
add_chapter (10_fixed_functions
152152
SHADER 09_shader_base)
153153

154-
add_chapter (11_render_passes
155-
SHADER 09_shader_base)
156-
157154
add_chapter (12_graphics_pipeline_complete
158155
SHADER 09_shader_base)
159156

160-
add_chapter (13_framebuffers
161-
SHADER 09_shader_base)
162-
163157
add_chapter (14_command_buffers
164158
SHADER 09_shader_base)
165159

@@ -218,20 +212,20 @@ add_chapter (27_depth_buffering
218212

219213
add_chapter (28_model_loading
220214
SHADER 27_shader_depth
221-
MODELS ../resources/viking_room.obj
222-
TEXTURES ../resources/viking_room.png
215+
MODELS viking_room.obj
216+
TEXTURES viking_room.png
223217
LIBS glm::glm tinyobjloader::tinyobjloader)
224218

225219
add_chapter (29_mipmapping
226220
SHADER 27_shader_depth
227-
MODELS ../resources/viking_room.obj
228-
TEXTURES ../resources/viking_room.png
221+
MODELS viking_room.obj
222+
TEXTURES viking_room.png
229223
LIBS glm::glm tinyobjloader::tinyobjloader)
230224

231225
add_chapter (30_multisampling
232226
SHADER 27_shader_depth
233-
MODELS ../resources/viking_room.obj
234-
TEXTURES ../resources/viking_room.png
227+
MODELS viking_room.obj
228+
TEXTURES viking_room.png
235229
LIBS glm::glm tinyobjloader::tinyobjloader)
236230

237231
add_chapter (31_compute_shader

0 commit comments

Comments
 (0)