#Vkguide 2 thread
1 messages Β· Page 2 of 1
the annoying thing about that is that it isn't platform safe
some cards seem to have BGRA8 and some seem to have RGBA8
and it'll fail giving you the swapchain if you demand the wrong one iirc
ye :/
i can add both formats into the desired formats on vkbootstrap
https://vkguide.dev/docs/new_vkguide/chapter_2/vulkan_imgui_setup/ new imgui chapter
its pretty great that dynamic rendering is so easy to use. but im really not convinced on how im explaining it here
i think this makes it for chapter 2, just another article of hooking random shaders into imgui
i was thinking of adding window resizing here, but seems it will blat it a bit. maybe for chapter 3, and i do it by first implementing a resolution slider
Are you going to overengineer the window resizing to be buttery smooth? πΈ
please show how it's actually done
i.e: device.wait_idle();
thank you
no one handles resize good
nobody needs smoof resizing
yeh it wont be smooth, i dont care enough for that
im thinking that i will implement resizing to directly reallocate swap & render, and do render resolution through shrinking the viewport. that will likely work best and its what AAA games do
you use sdl, doesnt it come with begin/end resize callbacks even, then resize vk resources at resize end
it does have the resize events but i check those from mainloop right now, so i get the out-of-date errors
yeh
need to think of what dynamic state to add to chapter 3
viewport is an obvious one
dynamic depth i think is a good idea too, specially coming from gltf. but should i
the gltf materials can have depth off i think
hmm jakerino and i had a similar conversation some time ago about what counts as dynamic state
viewport/scissor definitely
would depthtest on/off,blending on/off count as dynamic state too?
it feels liek it should be baked into a pipeline
ah there you go
VK_DYNAMIC_STATE_VIEWPORT
VK_DYNAMIC_STATE_SCISSOR
VK_DYNAMIC_STATE_LINE_WIDTH
VK_DYNAMIC_STATE_DEPTH_BIAS
VK_DYNAMIC_STATE_BLEND_CONSTANTS
VK_DYNAMIC_STATE_DEPTH_BOUNDS
VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK
VK_DYNAMIC_STATE_STENCIL_WRITE_MASK
VK_DYNAMIC_STATE_STENCIL_REFERENCE
hm so thats the ones you recomend?
other than line width which im never going to use, it sounds like a reasonable set
i would only pick viewport/scissor and depthbias probably
i dont do stencil stuff in vkguide
yeah
and i was thinking not only depthbias but depthtest itself
so no need to have it in there... perhaps this can be mentioned though
there is even more stuff...
VK_DYNAMIC_STATE_VIEWPORT = 0,
VK_DYNAMIC_STATE_SCISSOR = 1,
VK_DYNAMIC_STATE_LINE_WIDTH = 2,
VK_DYNAMIC_STATE_DEPTH_BIAS = 3,
VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4,
VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5,
VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6,
VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7,
VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8,
VK_DYNAMIC_STATE_CULL_MODE = 1000267000,
VK_DYNAMIC_STATE_FRONT_FACE = 1000267001,
VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY = 1000267002,
VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT = 1000267003,
VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT = 1000267004,
VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE = 1000267005,
VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE = 1000267006,
VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE = 1000267007,
VK_DYNAMIC_STATE_DEPTH_COMPARE_OP = 1000267008,
VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE = 1000267009,
VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE = 1000267010,
VK_DYNAMIC_STATE_STENCIL_OP = 1000267011,
ah
there is your depth test too
and switching topology even
hmm, so viewport/scissor/depthtest/depthbias
depth write too perhaps
yeh
can even do blend stuff on dynamic pipeline 3
but probably overkill
you would want different shaders for translucent objects anyway
push constants + having multiple compute shaders for background and choosing between them with imgui
this makes it for chapter 2
ill now review stuff from the start and check if stuff is mostly correct before i move to chapter 3
one design question, on the push constant stuff, im just copypasting a "data" struct that has vec4s as data1, data2, etc
should i show them with different names on each shader? to make more clear that name doesnt matter, only size/layout
yeah that would be good, and clear names are always better
for ref, im doing this atm
pushconstants is just data1/2/3/4
im thinking if i should change it to have actual names, and only have the data1/2/3/4 on the cpp side
im also for proper naming
90% of our time we be reading code
the reason is that i want to have the compute shader passes all with this same 16-float layout, which means i only need to deal with 1 layout
i could, but im binding them to imgui as edit float4s
ah
if its just a generic compute shader for this one purpose then data1-4 is probably ok too
you can change the shader
but please add a sentence about proper naming shit is important for any other use case
thing is that im showing how to load multiple pipelines as an array of compute-effects, which, in a way, will mimic how it will do draws later
those are pipeline + data struct
(its on the draft article)
ill have some other shaders like a fractal and something else so that the tutorial dude can try more shaders in the folder, maybe tinker with them
let me give you something good
as long as the shader works with just a mat4 properties for config, its all good
// byte bag
namespace det {
template <typename T, typename C>
constexpr auto __make_byte_bag_impl(T& data, uint64& offset, const C& current) noexcept -> void {
__builtin_memcpy(&data[offset], ¤t, sizeof(C));
}
template <typename T, typename C, typename... Ts>
constexpr auto __make_byte_bag_impl(T& data, uint64& offset, const C& current, Ts&&... args) noexcept -> void {
__builtin_memcpy(&data[offset], ¤t, sizeof(C));
__make_byte_bag_impl(data, offset += sizeof(C), args...);
}
}
template <typename... Ts>
requires (std::is_trivial_v<std::remove_cvref_t<Ts>> && ...)
IR_NODISCARD constexpr auto make_byte_bag(Ts&&... args) noexcept -> std::array<uint8, size_bytes_of_pack<Ts...>> {
auto offset = 0_u64;
auto data = std::array<uint8, size_bytes_of_pack<Ts...>>();
det::__make_byte_bag_impl(data, offset, args...);
return data;
}```
hell no lmao
it's epic though
if i wanted a thicker abstraction i would make the compute effect into a virtual class
where it does the pushconstants "manually" as each effect would be a class with an Edit + Draw function
you can just vkCmdPushConstants(make_byte_bag(stuff, all, your, shit, in, there))
hm thinking about it, maybe i should turn the compute shader execution into a class
basic class with a draw() + edit() function + load() which compiles the pipeline
but probs more code than i need to draw a simple bunch of random fullscreen computes
lol that's pretty neat
struct {
float x;
int y;
} constants {
.x = 3.f,
.y = 2,
};```
is what I do when I'm lazy
gotta get that bag π°
so im thinking i should put the compute shader execution into a function with a class, just not virtual
bit of a refactor
some sort of "default shader" pass where it holds pipeline (layout created separately) and just takes the shader module ...
or maybe i can just not care, current approach is not bad and will be carried through the rest of the tutorial
meh, ill go through this first 3 chapters to try to polish them a bit and decide
phylosophical question
do i leave the vk_initializers.h/cpp filled as starting point
instead of having the tutorial dude copypaste it every time its used
the entire tutorial im adding new stuff to initializers but that is stuff that never changes, and will just get copypasta-d. it even gets somewhat glossed over quite often
so i can leave it already written on the starting point and just show the implementation to people to explain it
instead of being constantly, over the whole tutorial "now add this into vk_initializers"
I think it's fine to gloss over init structs and just tell people to read the docs/code if they wanna see the fields, it definitely does improve the tutorial readability
maybe even give a ref link the first time you mention a struct like VkSubmitInfo
the one thing I do remember is that when I was in the stage of extending vkguide code into my own thing, relying on vk_initializers without looking at the spec made me miss the existence of some fields I needed
truly a skill issue but I think a good big picture goal is to help take the training wheels off on checking the spec
oh, i really like the idea of directly pointing to docs for the first mention of each of them
i think that solves it, prewritten vk-inits plus pointing to the spec on each new struct and function used
functions are less useful i think
most of the time is like "ok this function takes a VkWhateverFunctionInfo"
so pointing to the function itself is less value
still its not like it takes space
we do that in learnd3d11 too iirc
@kind ferry this shader from Shadertoy is neat
https://github.com/Devsh-Graphics-Programming/GPU-With-C-Sharp-Angular-WASM/blob/master/data/shader.frag
uniform sampler2D iChannel0; // input channel. XX = 2D/Cube
uniform samplerCube iChannel1; // input channel. XX = 2D/Cube
uniform ivec2 iResolution; // viewport resolution (in pixels)
uniform vec2 iMouse; // mouse pixel coords. xy: current (if MLB down)
uniform float iTime; // shader playback time (in seconds)
uniform int iEnv;
uniform float iFramesRcp; // 1/(current frame number)
if you throw out iChannel0 then you just disable accumulation (although you could just make your compute texture readwrite)
and iChannel1 is a cubemap but you could just make the envmap procedural
im really not happy with the current shaders build target
what do you think if i add a python script to build the shaders?
would it make sense to have that in the tutorial. just a very basic thing that recalcs all shaders when triggered
:S
thing is that current cmake based builder requires you to re-run the configurator when adding new shader files
if its invoked by cmake then its fine
yeh thats the idea
hmm
like glad generates its bindings via some python during configure
ye .bat and .sh
and .it π
then you get bat sh it π
I think a python script would be a big point of failure esp. for people on windows
what im thinking is to still have the shaders cmake target, but also run the compile script from the normal engine executable
and if you manually compile shaders target it does forced rebuild
else it checks timestamps
I think the GLOB_RECURSE is an antipattern in 'good' CMake usage though
you'd never do it for cpp sources for example
telling peeople to go add the shaders one by one into cmake is even worse
there is an alternative choice. i could compile the shaders from the engine.exe on launch
by directly calling into console command
or maybe just providing the code that links into glslang stuff
that's crusty and/or cumbersome
i do worry about the python on windows case
linking against the compiler is at least correct
i build shaders during build with custom command
i do expect essentially every single dude gonna have python
and you can ship it as a submodule
but still
or fetchcontent
and just invoke glslvalidator or whats it called on all *.vs.glsl and *.fs.glsl
you might have python but do you have it in your path by default
I think installing python on windows doesn't put it into the path by default
it's been forever since I checked
it needs to be checked, during install
glslang stuff is provided by the sdk
i can have it added with 0 friction
downside is that im adding extra code to the chapter-0 stuff for the shader recompile
but, in a way, that could be a good idea
then maybe i could show how to hotreload shaders
LETS GOOO
it's pretty self contained "don't worry about it" code, so I don't think it's a bad idea
call glslang -> get uint32_t array
no, it must write the shader files to disk
i really dont want to get people used to just grabbing the glsl in the engine at runtime
oh yeah true
if you wanna develop best practices, perhaps making people add their shaders as source files is the real winner?
i also hate shaders embedded as strings
also vb is right, python should NOT be a big problem
people who do GP should know how to install a thing like python
if they cant then GP is not for them tbh
yeah
[Install Python](linktopython) should be alright in the guide
the great filter
I don't even think you need to link python
this is like the gentlest filter
another nice detail is that if i have python i could show how to run scripts that process gltf files or other things of that sort
important to have a way to run meshoptimizer
don't people usually link meshopt in their programs
yes, but its much better to run its gltfpack or others offline
to precalc all that stuff
everyone cooks their own shit together : )
perhaps have a custom target for all that o ffline cooking
so that i can do all that from within my cmake tools
those can invoke scripts/this_and_that.sh
I think one of the first things I did was have the exe depend on the shader target in vkguide
was annoying to ninja shaders separately
ye
im also annoyed that shaders are end in .vert .frag and .whatnot
i like them to be .vs.glsl .fs.glsl and so forth
so that the fucking highlighters and linters and whatnot work properly
my nvim highlighter handles those, I had to modify it for glh though
also had to mess with the custom commands a bit to have glslang generate depfiles so I could properly track recompiles from editing shader headers
heh
for some reason in my vkguide journey, cmake only builds shaders when they were changed
almost 1:1 vkguide i think
find_program(GLSL_VALIDATOR glslangValidator PATHS $ENV{VULKAN_SDK}/bin REQUIRED)
file(GLOB_RECURSE GLSL_SOURCE_FILES
"${PROJECT_SOURCE_DIR}/data/shaders/*vs.glsl"
)
foreach(GLSL ${GLSL_SOURCE_FILES})
message(STATUS "Building Shaders")
get_filename_component(FILE_NAME ${GLSL} NAME)
set(SPIRV "${PROJECT_SOURCE_DIR}/data/shaders/${FILE_NAME}.spv")
message(STATUS ${GLSL})
add_custom_command(
OUTPUT ${SPIRV}
COMMAND ${GLSL_VALIDATOR} -V -S vert ${GLSL} -o ${SPIRV}
DEPENDS ${GLSL})
list(APPEND SPIRV_BINARY_FILES ${SPIRV})
endforeach(GLSL)
``` and the same block again for fragment shaders
(Chiming in b/c I'm finally working through vkguide right now & stumbled on this thread)
I personally find the current CMake setup really nice & easy, despite needing to reload the shader target when adding new files. Especially since glslangvalidator is provided by the SDK anyway
It was also easy enough for me to copy/paste the cmake snippet to find & compile HLSL shaders too, since dxc is provided by the sdk too
yeh, but the issue is that if you want to reload shaders you must do it from vs
thats a bit of a wonky thing to do...
and reloading the cmake to add files is something ive always disliked a lot
Fair enough, I hadn't considered that some people only have cmake available via IDE
tbf, why would people add shaders to vkguide all the time
they are supposed to go through and learn and then do whatever they want later
you could make it an exercise and leave it to the reader
because during the tutorial i will add more shaders myself @hallow berry
that should still be fine
why does the pipeline take image formats wat
dynamic rendering my man
before you had to give it the renderpass
which would contain the attachment info
i like this one more than the older one with the vk-initializer spam
much less space taken and can split things
now that i think maybe the set_depthtest function should set depth format too
none makes sense, you could also call it disable_multisampling, or disable_culling and be more semantic about it, but then it would be a mix of set_xxx and other things, which you probably ont like, im also not completely happy about it
needs to set sample to 1 and other similar defaults
im calling them all with the same type of name
idea is that laetr you would have set_multisampling(4) or similar
same thing with the cull
oh, but thats what i mean
its just me
you have set_multisampling_none() and set_multisampling(4)
hm, that makes sense
enable/disable semantics on those
im not convinced 100% myself, because fluent api would even be better, but requires more code infrastructure which is probably not what you want anyway
.enable_multisampling().with(4).samples()
leaving it as set_xxx should be enough for the guide
its quite a bikesheddy topic π
its not even a real builder after all π
ye but it doesnt have to be an ugly fake one either π
Sorry for late response after starting the bikeshedding
Just not a fan of two methods that do the same thing when you could just set_multisampling(1), set_depthtest(false), etc
People also keep getting surprised (myself included) that disabling depth test also disables depth write
the latter could be split into two things then
i also have Disable/Enable DepthTest/DepthWrite as separate things in my engine
my main grief with code like "set_multisampling(1)" is simply readability
we, coders, read source code 90% of time working on code
and only spend very little time actually writing code, thats why code should be as readable as possible and help the brain rather than have the brain guess what is what
idk, im also just saying, ive been reading source code for too long already, and im fed up with spaghetti π
personally they both convey the same meaning and are just as readable for me, but ymmv 
If anything in my lib you need to do setMultisampling(tp::MultisampleLevel::x1)
I just realized I'm doing a dumb
In my code that first parameter is optional and defaulted to x1
: D
tfw vkinitializers loses like 200 lines worth of pipeline bs
good change honestly
tho i will go through the structures in the tutorial to explain their properties
im thinking how much should i have on chapter 3 and 4. i know 5 is the full gltf load, and 3 is pipelines. but just drawing the triangle wont take much. maybe slam the stuff with descriptor sets and uniform buffers there? gotta have to store vertex buffers after all
im also thinking if i should use BDA directly
for mesh data loads
the hello triangle will show how to do it without bda, then bda from there onwards
if people want to still use non bda, then they should know how
ofc. hello triangle actually starts from hardcoded triangle
and in regards to hardcoded triangle
what do you think of setting up a fullscreen-triangle function?
to use instead of a vkcmd blit
its widely used everywhere, should be a good thing to do here as well
i think it makes a fair bit of sense to set it up, after all can go later and add the tonemap there or similar
yeah
this should work no?
i was refacting some stuff but for some reason its not blending
while this thing should be doing a "pure additive" blend π€
I think the result of that is "always write (2, 2, 2)"
according to renderdoc its ok
yes but im getting normal rendering
as if there is no blending
but wtf is going on because renderdoc is going "yeh this is fine"
maybe its not a valid combo
been trying a few random combinations and nothing seems to be doing anything which is incredibly strange
im weirded out because im seeing the blend stuff changing in renderdoc and yet.. the image is always the exact same
i wonder if im running into some sort of caching bug somewhere
and this doesn't even work right with src alpha and 1 - src alpha?
absolutely nothing matters
the strange thing that has me baffled is that the settings are there on renderdoc
hm seems i have some layer error on a compute pipeline that runs before this (only at pipeline creation), i wonder if its something getting megafuckd in the background
copying code backwards and forwads between the multiple chapters is kind of messy...
fixed the validation and it still doesnt work. real odd stuff here
bit of a design question
for the actual renderer, im currently storing a "bIsTransparent" on my material structure
but im thinking maybe thats not the correct way
what do you think of storing the transparent flag in the surface itself?
should transparency be a property of the material, stored with the pipeline, or should it be a part of the mesh itself
I remember discussing this on this server like a year ago, and I was given the recommendation that a "transparent" material is just a different type of material altogether
so in short yeah, it should be a property of the material
this is the reason whyt
im looking into the scene rendering to check what i can pick for the chapter 4 and chapter 3 so that stuff is built gradually
are surfaces what gltf calls primitives?
kinda
its my "draw" basically
one mesh has multiple of them
but its not 1 to 1 to primitives because stuff like shadows would also generate them
sorry. misread. yes, surfaces are gltf primitives
one possibility is to hold a bitfield per surface of what passes does it render to
so i would have one bit for mainpass and another for transparent
and then possible one for shadows and other for depth prepass
I can see why that'd make sense for shadows
but things aren't mutually transparent and opaque
that's a property of their material type
"PBR Opaque" and "PBR Transparent" are 2 materials to me, for example
yeh they are 2 materials
thing is about the pipelines per pass
like maybe a material should be a set of pipelines here
so for transparent objects their "main pass" pipeline slot would be null
it's kinda reassuring that you're having as much trouble architecting that as I did lol
what I came up with is having pipelines be grouped into an object called a "MaterialPass" which has a MaterialPassType which is either Opaque or Transparent
and they have various functions: indirect_cull, render_forward, render_depth_only, and render_shadow
they also own all the buffers related to objects of this given material
then in my main renderer, during my cull pass I invoke the indirect_cull of all registered material passes, then the same thing for all other passes as needed
the error i had above happened because the render info was badly put on the pipeline (i created the pipelines with 0 color attachments)
yet layers did not have a check for it, and the driver didnt care. so blending was broken but everything else was rendering no issues
0 color attachments is a valid pipeline
I don't know where the best point for validation to catch that would be, either
It shouldn't be valid to use it while rendering with color attachments bound, though
Unless you have VK_EXT_dynamic_rendering_unused_attachments maybe
is renderpass-pipeline compatibility strictly equal?
or is a 0-attachment pipeline compatible with a nonzero-attachment subpass/dynamic rendering
When it comes to attachment count, they are strictly equal afaik
its a 0-attachment pipeline but which has 1 pixel color output in the shader correctly
used from within a renderpass (dynamic) with 1 color attachment
That's ok, but should produce a warning
then I'd suspect that's a layer bug since that should be easy to catch?
@meager flume how is that possibly ok?
having the shader output to attachment but the pipeline having no output attachment
yeah I see 2 cases here
either A) the layer warns you the pipeline attachments are incompatible with the renderpass, or B) the layer warns you your shader is incompatible with your pipeline
or both
You effectively declare that the output is unused
It's quite useful to avoid having multiple shader variants that output different combination of things (normals, motion vectors, etc)
It at least used to produce a perf warning when you did that, but I can't see it anymore
i see
my issue is that then i was rendering with this pipeline
and it worked
i had 0 color formats but the renderpass was being written. but with no blending. blending was fuck-d
i even have the renderdoc capture lol
Yeah, the renderpasses not being compatible should have been caught 
Validation <101294395|UNASSIGNED-CoreValidation-Shader-OutputNotConsumed> : Validation Warning: [ UNASSIGNED-CoreValidation-Shader-OutputNotConsumed ] Object 0: handle = 0x2b17b0000005209, type = VK_OBJECT_TYPE_SHADER_MODULE; | MessageID = 0x609a13b | fragment shader writes to output location 1 with no matching attachment
Here, I found it in old logs
but i had all warnings enabled π€
also is that with no attachment on renderpass or in the pipeline
revisiting and preparing chapter 3 (triangle) im thinking i will do BDA for mesh buffers fairly early
dealing with the descriptor sets per-mesh and similar is kind of ass
another im thinking is removing the pipeline layout stuff. doing a good ol hash&cache
so that creating new materials is a bit easier as can be on a function where it takes the 2 shader modules and does the options
yes
do it
i dont like the idea of hash n cache for this
hash n cache for pipeline layouts is good, but it only makes sense if you have shader reflection
so that's 2 unnecessary moving parts for tutorial code
at least to push up front
im considering putting the shaders into a hashmap, VkShaderModules
by name
so that my pipeline logic first loads a bunch of shaders and then i have a create-pipeline type thing that just takes 2 shaders by name
or maybe thats not a good idea as its different from how i build the compute shader..
I also don't think that reflects the direction vulkan wants to go
iirc one of the newest maintenance exts allows you to circumvent creating shader modules entirely, and add shader module create info directly into your pipeline create info
shader modules are kinda useless if you think about it, so I'd advise people to not treat them as first class vulkan crap
hm good point
i could just load them from file on demand, even multiple times
they are smol files after all
shadermodules are deprecated
i could update the tutorial removing them
yes
yea i dont remember which one
i dont use any extension right now
i think its core
good to teach people how to enable extensions
plus it's just maintance
this is the futureβ’οΈ
because i can begin by loading every single .spv file from the shader folder into std vectors
and just send those to the pipeline
nah man i want to keep this core... @lapis isle
rip
still though you can build your API like that
and just hide shader module creation as a transient thing inside the pipeline creation
thats what im doing right now
the "Create pipeline"
function loads the shader file and creates shader module, then deletes it at the end
i currently have a good plan for chapter 3 but chapter 4 is a bit on the ?? right now
not fully sure on it
my idea is that it would build the render structures that the gltf will need later
draft pipeline chapter
what do you think? i might be doing stuff a bit out of order? maybe split the first part (explaining the whole pipeline create info) into another article?
first explain the pipeline create info and its settings as an overview, then create the pipeline builder with a few abstractions (its missing stuff that will be added later like depth-test), and then hook it all to draw the hardcoded triangle
my main worry with it is that maybe the abstractions of the builder and what the settings do is completely unclear, im really skipping a huge amount here
after thinking about it the rest of chapter 3 will explain more pipeline options, and setup mesh rendering
but without the fancy abstraction layers that will be built for mesh objects and the likes, just hardcoded
I think it's fine, it's an info dump but that's just how setting up the graphics pipeline is
I think vulkan-tutorial actually does a good job here with their little diagram
also lol they split it into 5 parts
they also seem to go in programmable vs fixed order instead of pipeline order
i dont need to explain shader modules (was done before for compute), nor renderpasses
so really mine is just the fixed function part
i have a diagram in my odler version, ill definitely add it back
you know what, passing BDA pointer for vertex buffer into the models works.. great
it actually removes the descriptor set i had for meshes, makes things a fair bit easier, and scales later to do instancing and indirect
i think ill do a buffer first and then demonstrate BDA for meshes
after the main timeline then ill have the classic big-buffer-for-all-meshes and that will contain the bda pointer to mesh
after thinking for a while i wont be doing dynamic descriptors
vertex buffer passed by BDA, material buffer a bound SSBO where index (through pushconstant) will index material params
and index buffer as a really big preallocated buffer and then suballocated from with VMA magic
but index buffer trickery will be done later, when going with draw indirect
ill begin chapter 4, which will be setting up depth buffer, and setting up the render architecture
c5 being dedicated purely to gltf
ended up adding the more advanced abstractions of the descriptor stuff to chapter 4
rate my material system
im thinking its just going to be structs like this with the hardcoded logic per material type
fairly easy to also add shadow version by just adding another MaterialPipeline for a different pass type
wat
I assume MaterialPass then selects opaque vs transparent and such?
What does MaterialData store?
MaterialData sounds like the gpu version of MaterialConstants/MaterialResources
Yeah but then tying a descriptor set to a particular pipeline selection doesn't sound the best when you can usually reuse the same set for many different configurations
a MaterialData is basically the min data i need for a given material in the draw loop
so pointer to pipeline+layout, descriptor set for the material, and passType which will be useful for some other stuff, as it handles if the thing is transparent or opaque
So you have a separate descriptor set for opaque and transparent
yes
opaque and transparent will have different textures and so on
just because that material has the 2 pipelines it doesnt mean a given mesh will draw with both
it will only use one of them
Maybe, but when you add shadows, depth pre-pass, motion pass and whatever else
All of them will necessarily have a different desc. set
yes
its fine because this descriptor set is temporal only
by the time i add shadows, prepass, etc it will be bindless and i wont need that descriptor set anymore
ah alright
for the base chapters (up to chapter 5, loading gltf) it will be 2 descriptor sets
a global one for camera data and the likes, and a per-material one with the textures
So in this case GLTFMetallic_Roughness is the material as a whole, and MaterialData is the "instance" of a material that actually gets applied to an object?
and a shadow pass would have a different descriptor set, for example it only needs the color texture (for alpha testing) , but not the roughness/emmisive/etc others
yes @fringe berry
thats the idea
when a GLTF is loaded, a MaterialData is saved per-object
well, per gltf material, really
this is how the GLTF mat is loaded
sorry for the incredibly cursed mixed tabs/spaces, my vs config is a total mess right now
i also dont mind that
that "striving for reuse" is just a possible optimization
there isnt that much reuse, the descriptor for a main view isnt the same as a shadow view
yeah
illallowit.gif
I mean there is very little downside in including all the other textures as well and it saves you managing multiple descriptor sets
reasonable
Allows you to reuse the same pipeline layout as well
if i didnt switch to bindless so quickly i probably would try that
MaterialData as name is honestly completely awful, ill change it to MaterialInstance
chapter 4 is almost done now, but im not completely happy with the flow. too much code, too little things happening. but its kind of.. the point of the chapter
ill finish the chapter and then see if i can rearrange things a bit, maybe moving stuff between chapter 3 and 4
i think ill move depth buffer setup and a 3d camera matrix into chapter 3 as 4 is feeling bloated a bit
that way 4 is mostly about textures and material system and scaling up
i prefix my constructs which live on the gpu with Gpu : ) ie GpuMaterial
for me that'd probably just be the struct that defines the memory layout on the GPU and not necessarily the handle or CPU-side data for it
so a MaterialInstance might be transfered to the GPU as a GPUMaterial which is actually laid out like the GPU would read it
naming is hard
a MaterialInstance is not really that pure of a gpu structure
i prefer the GPU prefix on data that will be put on a uniform
rate my mesh loading format
there we go, mesh loading with 3 primitives. Cube, Sphere, and Suzzane (monkey)
alternatively, i could do badly-loaded GLTF isntead (where i just load first mesh and first primitive in mesh)
what do you think?
im thinking that while this is cool, maybe i should begin loading a mesh-gltf
yeah
that way it can then continue making another loader later that does the "full" thing
i dont think thre is a point of having a hard coded cube
mesh-only gltf is simpler to load than even obj
just grab meshes[0] primitive[0] and loop accessors
obj is not worth it anyway
yeh
im going to consider changing chapter 3 to do the gltf load at the end, when vertex buffers get shown
and see how would that look
oki
i should replay vkguide2 here next weekend
so if what you made makes sense hehe
replay?
work it through myself
ah ok
for next weekend ill have chapter 4 probably done and some tweaks to chapter 3 too, so should be somewhat followable
im only at memory transfer descriptor sets in vkg1, right febore textures
current vkguide2 is a bit ahead of that
i hope i dont have to travel next weekend already, i really dont want to
thats fine
at the moment its actually somewhat equivalent to full vkguide 1
noice
with chapter 4 full it will be parity
sounds good
yeh ill change to load from gltf as simple mesh. it will work better and act as a improved progression towards the full load
henlo tringle should be enough to see how you can manually load a vb with vertex data
All these guides are making me want to write my own guide except it's Vulkan strictly using the most bleeding edge of features
Like zero descriptor sets, mesh shaders & stuff 
thats what vkguide 2 is doing (almost)
like, i dont even show vertex buffers
but btw a full bindless guide/tutorial would be useful
the bindless chapter in vkguide 1 is the most popular page
ye but it's still using the crusty old VTG pipeline
maybe I'll make a pull request for a ultra epic, fully bindless, fully gpu driven engine
on chapter 6 i will be going bindless textures and some indirect shanenigans
but it will be a while until there as the 5 chapters polished is more important
ive also thought of converting the vkguide website into a bit more of a blog type thing
and allow guest articles
what would one use to make such guide websites automagically
I don't want to write CSS and HTML myself ideally 
so what do you use to actually make it into a website
as in what compiles your md to HTML/CSS
oh
and it all just ends up as raw html with maybe a lil bit of js
thats why vkguide loads so incredibly quickly on so little space
most github sites are like this. jekyll just generates ultra thin pages by default
there is no server, its just completely static html hosting, so you cant go insane with the js scripts
that's great, a guide doesn't need that stuff really
my github site is raw html because I didn't know a better way lol
ok so the plan is as follows
1st chapter. initializing vulkan and basic infrastructure
2nd chapter. mesh shader triangle
3rd chapter. loading bistro & bindless
4th chapter. DLSS/FSR2 & cluster culling
5th chapter. VSM
6th chapter. RTGI
who is the target for it?
the target up until the 3rd chapter is people who have completed vkguide and know their way around vulkan, wanting to go even further
then from 4th chapter onward is just me dumping features in the guide for those who like them
you think RT shadows maybe fit better? 
I will mostly be showcasing what I've learnt from daxa, vkguide and stuff
so credits will be given to you frogs
~~basically an ad for potrick and vkguide
~~
ok so a "bindless guide" for people who already know vulkan
seems about right, can be useful as a reference
ye
Has anyone done full RT pipelines at scale yet? With managing the pipeline libraries and shader binding groups and such
ue5 vulkan πΈ
I think potrick is underway with doing that in daxa
Cool if so
I might be on the path of rays
pipeline libraries are ez just go bindless and have 2 materials tops
I don't think non-bindless is even an alternative with rt 
from what I understand you bind desc. sets for the entire pipeline, not per material
lol
tho kinda related to that, reflections are kinda the most boring RT effect to add :/
i think stuff like shadows and GI with restir type stuff is more interesting
first ray effects i implemented were ray sun shadows and ray AO
shadows are about as simple as reflections though
idk about how you'd do ray AO or restir GI but they seem considerably more involved and their own tutorial set
ray ao is kinda just "randomly throw rays every pixel up to a radius, then denoise it with a blur"
shadows are much simpler
ray ao is basically same difficulty as normal SSAO
because normal SSAO is also noisy and you do temporal accumulation/blur to fix it
yeah I guess launching an anyhit towards a light is way simpler than actually dealing with the result of a reflection
the hard part with shadows is implementing stuff like not launching rays for stuff that is fully on shadow
just throwing 1 ray into the sun per pixel is the easy mode but you can get 2-4x faster than that by being smarter
what do you do for that? do you render a low res shadowmap or something
one of the ways is to divide the scene on 4x4 pixel tiles, if all 4 are fully in sun or fully in shadow, you only trace 1 ray per block. On penumbra areas you throw more rays
you reproject these things every frame as the camera moves, and on the dissocluded zones you throw full rays
thats the TLDR version
then there is the omegagigabrain RESTIR version from nvidia which i dont understand, but lets you do that sort of thing with a ultra huge light count
oh so basically you have a texture with history data and decide occlusion from that
is the history just the shadow mask
depends on the technique
i dont know it in detail only read the basic thing from the articles and the ray tracing gems book
I think I should read that book, I've just been screwing around with BVHs instead of actually using raytracing for anything lol
For my guide I'll just do HWRT lol
but maybe a persistent thread based, compute only RT pipeline could be fun
one technique i like a lot with hw rt is DDGI
its just such level of hax for a nice GI implementation
and seems to be super easy
you just have a grid of probes. the probes use rays to get probe info. Thats it
only re-trace the probes as you move around or the ones around dynamic objects as you want
if you are feeling really fancy you can also do like lumen, and spawn probes from the camera point of view into objects on the z-buffer
that does sound really cool, idk how to even begin implementing that though
and project them around
check this out
this had me at GTX 680
we are now witnessing the formation of a brainworm live gentlemen
It sounds fun but will it really see much use with hwrt getting more and more widespread?
maybe on amd cards
my gtx 760 won't grow hardware rt no matter how much time passes
so it'll at least be worthwhile for me
just inject RT cores
Consider using SterRToids
new chapter 3 with gltf mesh loads even if crappy + pushconstants object matrix + depthbuffer is a definite improvement
Totally didn't pin stuff before realizing the link to the rendered version is available on the main site....
negative viewport for flip or matrix on the gltfs?
negate the y on the projection matrix, is that an option
yes, thats what i do
chapter 3 is now a bit different but i consider it an upgrade
now time to finish 4
You guys fix your coordinate systems?
too ambiguous, can you rephrase
uhhh
yep
b) if individuals here fix their coord systems, using method 1 or 2
as in
i suppose its projection[1][1] *= -1 since its what vb wrote
every third party uses some different coord system
and you could standardize it within your engine
engine, game, app, whatever
im making the joke that I don't lol and I just convert wherever i need to
since there are multitude ways of doing things you can use whatever i suppose
its all ugly : )
because api designers wanted to be special or were mathematicians and not computer people
yep
chapter 4 is now basically done
lots of changes on 3-4
gonna do a bit of a review pass as its likely code has desynced heavily
chapter 5 is now done
at least, the main part
which means the tutorial is now "done" for the basic track
π
ill still add a couple more articles to chapter 5 to optimize a few things. Specifically, improving barriers for the draw logic, adding the transparent draws to the gltf, and not calling VkBindPipeline every single draw (check that its a different one)
made a bunch of tweaks to chapters 3-4-5 so its now a fair bit improved
likely followable right now
now i need you to try reading/following it and let me know of the issues/wonkyness/etc. i have issues reviewing it myself due to bias
gonna give it some frustrum culling and transparency depth sort
looking at it the lack of frustrum culling is just.. so crappy
with the current architecture i cant really have the fast culling due to it being a node-walk, but i can do a basic IsVisible check on the mesh nodes to decide wether to add the draw or not
that can kinda show the concept of how culling can be done, and it can do the much faster flat frustrum cull when i do the caching thing
ok all hyperlinks between articles should now work
ended up adding it into the mark down generator
doing every link manually is super annoying
I want to clean up a few things around the glTF chapters, can I just send all of my stuff as PRs to the normal repository?
and the source for the markdown text is just on master under vkguide_new_source?
did you see the coments by that guy who did a lot of small fixes?
im already going through that list
I didn't read through all of that tbh, just thought it was spam
there is likely overlap
the markdown is a bit more complicated. it uses a generator
but i can run it myself after merging the pr
eh I'm sure I can figure out how to generate it too
the code of the generator is not published
tho chapter 5 in particular doesnt use the generator properly yet as im fixing it
generally you will see in the markdowns stuff like ^code init_logic chapter-2/vk_engine.cpp
thats basically "go open chapter-2/engine.cpp, find the init_logic tag, and copypaste it"
ah, interesting
chapter 5 i was still modifying the code a bit so most of its code snippets are just code snippets, without the copypasting codegen
but every other chapter has almost all code snippets done that way
so yeh.. dont touch chapter 5 yet, im working on it right now
wait a few days
Never used this library so a lot of this stuff was new to me. I also was wondering if there was a way to query indices and vertices size from fastgltf so you can resize the vectors accordingly.
It would be a good idea to const the accessors.
this was the only thing MasterDrake said specifically to fastgltf, right?
hmm ok
example
@low minnow i had the resizing done before
i changed it to be push back precisely because i wanted to initialize the vertices properly vs the 0init of the std vector resize
well, I mainly thought of using reserve
yup, very interesting way to do this
but formatting is way off sometimes, which was one of my main points I wanted to fix
also the gltfOptions should probably be on multiple lines
ah that i can fix no issue
well just mention me when you got the PR up and I'll review that & open another PR with specific fixes for fastgltf
for now, i might work on a Vulkan example in fastgltf
what are the specific fixes you want to do?
better if i just do them myself as part of the tweaking when i fix a few things on c5
- there was some things mentioned about gltf and fastgltf which were simply wrong
- LoadExternalImages is an option which would simplify the texture loading chapter
2 main points, nothing drastic
but i dont want to do the external images thing, i have the code on load image that loads from a path
external images options is just like external buffers
you'll remove one branch of the std::visit call
then youll only have to care about sources::Vector and sources::BufferView
yes but things like Bistro are a couple gbs of images
with load external images the program now uses +2-3 gbs of ram to run
hmm ok sure
by loading them myself i avoid that because its directly calling stb to open file, load it, and unload memory
what are the things that are wrong? thats important things to fix
only thing I remember right now is this line "The third one is is loading from a BufferView, when the image file is embedded into the binary GLB file."
that's just wrong, because a BufferView could reference any buffer, not just the GLB buffer
do i change those glb mentions to "the binary part of the gltf"?
no
that buffer view is also used for base64 on the text part?
buffers could be external files too, like a asset.bin file
this is very common practice about buffer views
images that use buffer views are rare though, yes
some of all that is because im focusing on what unreal and blender exports
but ill reword that part, commenting that a gltf can refer to outside binary files too
wheres the new code again
i have some uncommited stuff on c5 for frustrum culling and calculating mesh bounding boxes
chapter-5 doesn't seem to be properly updated at all though
the mesh loading is completely missing
mesh loading is on chapter 4
no it isn't
so you moved that forwards?
ye
ah ok
its a "wrong" partial loader
but then it gets superseeded by the one in c5
on this one it doesnt load nodes or anything, just the mesh list
its not in here either https://github.com/vblanco20-1/vulkan-guide/blob/all-chapters-1.3-wip/chapter-3/vk_engine.cpp
the loaders are on vk_loader.cpp in shared
tho i will refactor it, its a mess
the loader is deeply tied with the engine
the shared folder is for stuff that DOESNT depend on engine
so currently its dodgy, i will duplicate the loader and put it on the chapter folders
this is just a complete mess
i was doing that to avoid duplicating code but seems there is no other choice
at the moment im going through a big todo.txt which is mostly the stuff that other guy reported in the comments
but ill add this to that
- overloaded is also available as
fastgltf::visitor. You already make use of the visitor sometimes, so remove this and switch everything over. - here and here you should be using
fastgltf::getErrorMessage. - why are you using
auto&&here? - your usage of
fastgltf::iterateAccessorcould mostly be replaced withfastgltf::iterateAccessorWithIndex, which would save you from resettingvidxall the time and just usinginitial_vtx + idxin the loops. - not sure why you're doing this. The scene already specifies what the top node is, so just go from there? And then you'll also skip irrelevant nodes if they exist. Not sure if the program has the concept of multiple scenes, but then multiple scenes could be loaded from a glTF but then share their resources (meshes, buffers, ...).
- the indices are optional. While I know you only concentrate on what Blender and Unreal export, I think you should at least specify
Options::GenerateMeshIndicesto guarantee availability of indices. - side note, but not really relevant: integers not prefixed with
stdare technically UB because they're not defined to exist in the C++ specification and only exist because they also exist in C.
some more things to think about, but i'd be happy to fix those too
some of the issues there are from having the code on older fastgltf. will fix
wait the scene specifies the top node? where is that
and multiple gltfs are allowed and its the intended use
yes, they will share resources which will be duplicated
but i dont consider it much of a problem toi have a bit of duplicates there with the massively simplified architecture regarding asset/data lifetimes
fastgltf::Scene has a vector of nodes, which are all essentially top nodes
yeah I see a lot of comments and code I wrote for gl_viewer, and I've changed a lot in there over time
good, you adressed some of the issues
with the formatting fixes it already looks a lot better
where is the Overloaded thing declared? @low minnow
util.hpp
as fastgltf::visitor
you were already using the replacement in some places
yeah probably best to target 0.6.1, thats the version thats also available on package managers if any users wanna use those
i just nabbed master off github
also fine, just know I donβt care really about breaking backwards compatibility just now because its still a 0.x version and I still want to change some things
went through almost the entire tutorial by now in fixes
only chapter 5 stuff left
chapter 4 had a few fairly critical issues on it
on chapter 5 ive fixed a few things but there are a couple things i want to still add to it, with the frustrum cull
and probably a chapter on a "cleanup" of all the debug/intermediate garbage made in the chapters before
no need to still carry around the hello-triangle by that point
SIMD Frustum Culling
turns out its wrong (does mention it on comments and later)..
couse its testing if any of the OOBB vertices are inside frustrum. but on big objects its possible that no corner is in view...
going back to simple projection of the 8 corners into the clip space, which works fine
it has the downside that its a fairly innacurate cull.. but should be fine enough for the explanation and maps well to projecting it on a compute shader for hiz cull
at least i dont need to explain frustums or anything, its super easy logic and mirrors the vertex transforms of the vertex shader
ill add this into the text as its very important to significantly speed up things
are you still working on the code around the loader or can I add the changes I noticed?
yeh ive improved things so its now more ready for that
also whats your opinion on setting the GenerateMeshIndices option, because technically indices are optional but I see youre always relying on it
didnt know it got added
yeah ill add that in my little fixer pr
are you going to change the code or the articles
but I'd have to change everything in vk_loader.cpp from chapter 3, 4, and 5, yes?
for now code, but if I find anything in the articles I would want to change that too?
would I only have to edit the md files?
no, a lot of the articles are actually using the copypaste codegen
tho chapter 5 ones still have inline code on that but that will be changed
for the code yes
but I mean the actual text in the articles
I understand that the code gets copied into the files essentially
yes, the system just grabs the tags from source code and plops them into the .md
its very very basic
yeah I'm not touching any of that
should window resizing and the likes be part of the main tutorial?
or should i have it on a dedicated article outside of the timeline
given that its something that gets constantly asked everywhere with vulkan
specially given that one of the things im thinking is to have the draw buffers be made at maximum window size from startup, and then only resize the swapchain itself
which would give smooth dynamic res by rendering into a smaller viewport of the draw images
i have no objections if you leave it out, but i would also like to have it in
too many people keep asking about resizing windows, you might as well cover it too
thing is that i dont do it either on vkguide 1
so an article about it would help both
personally, i would add it in the main article, and not leave it in some appendix
i also personally dont give a fuck if a neat guide has 15 pages or 13 pages of showing how to swim through a swamp
hmm
think of it as a deterrent too
something you can send kids to, who need resize in their engines
chapter 5 is being a bit strange given that i have some random "engine needs this" extra stuff on it
but i think its important given how many things are skipped
im writing the mipmap generation chapter for example
that means you are already thinking about to make it a main thing of the guide π
it only adds more value
only annoying part is that without swapchain/surface maintenance resizing "safely" is by the spec impossible without leaking old swapchains and semaphores.
You can just 'wait a second and hope for the best' but it don't look purdy. What I mean is that vkDeviceWaitIdle (by the spec) has no effect on the present engine, even if in practice is used to sync things just fine.
im mostly going for the pragmatic option :/
wait idle + remake swapachain and rendering
what thomas just said could be a paragraph in a warning/info box
Thats exactly what I would do. Smooth resizing is the trap, wait idle is fine
oh so even deferring deletion via your frames-in-flight deletion queue also isn't safe, you need the callback from the EXT to know when to delete them?
And I really do mean 'technically its not possible' in the "aschtually" sense - not relevant for users but pedants gonna pedant
yes, the base spec makes no guarantees about when things are safe to delete, since there isn't a way to check when a swapchain/present-semaphore is no longer in use.
you could prompt the user to reboot, as soon as they start resizing, that will clear things up
makes sense
and auto start the app with the new size : )
The other pain point is the whole "window size must match swapchain size" which is a race condition because by the time the app recreates the swapchain with the 'new' size, the window has changed size again leading to pointless validation error.
im thinking of just not rendering while resizing
you use sdl neh?
and another thing is that i wont be recreating the draw images
because thats a bunch of stuff + fragmentation + other fucekry
swapchain only
ye
iirc sdl has events for resize begin and end
exactly
i tried to do it recreating everything but it was a pain
gotta recreate some of the descriptor sets, draw + depth, etc
at end should be fine
and honestly i do not need it. the draw image can be fixed at startup, and then draw in a viewport
call Destroy/CreateResolutionDependentResources()
if the swpachain is bigger than the image just scale up when doing the blit
yeah
as a bonus it maps directly into dynamic resolution slider
which is something i think is really useful
because it can be used to answer the question of "is stuff pixel bottlenecked or not"
anyway only thing left is mipmaps (already coded, need to write it), the resizing, and a chapter on setting up some info/bench ui on imgui
at the end of the day the resizing code ended up incredibly trivial
barely a couple paragraphs to add to chapter 5. By that time the engine actually is rendering on backbuffers so it doesnt give a fuck about the swapchain. The rebuilding function is just wait idle + re-create the swapchain itself
but ill change a couple thingies in chapters before that to pave the path
Added the code for mips into vkguide text. now working on the resizing part
resizing got added
https://vkguide.dev/docs/new_vkguide/chapter_3/resizing_window/ kinda shows how hx dynamic rendering is
just call destroy->create swapchain and keep on
im now going to go and review the entire tutorial trying to follow it from chapter 0 to finalize it
ye just fixed
mipmaps and resizing changed some early chapters so im reviewing stuff to re-sync it properly
likely missed something
without the code generation copypasta tool vkguide 2 would have been impossible.
chapters 0-1-2 are now fully doublechecked and improved a ibt
when youre done with that I can do a bit of checks on the gltf part
had a lot of school n shit
on this holidays i can finish the thing
quite a lot of minor nits have been fixed/tweaked
is there a reason why chapter 0 is the last one?
Initial Setup: Building the project should be
Start by syncing Git project at https://github.com/vblanco20-1/vulkan-guide/tree/starting-point-2 and perhaps turned into some markdown link Start by cloning from git [here](link-here) you can preselect the branch in the link, or you write itout as "clone url && checkout starting-point-2"
main.cpp should annotate both params in main with [[maybe_unused]]
merry christmas vb
the heck
.request_validation_layers() why does this have a param for enabling it
you either request or you dont
request_validation_layers(false) looks funny.
i suppose its to not have to write if (enableSomeDebugStuff) builder = builder.request_validation_layers();
anyway, here some naming thing which could be addressed: VulkanEngine::init_vulkan ... features, should be called features13 to be consistent with feature12
the whole device/physical device naming-ism is super irritating
...
//create the final vulkan device
vkb::DeviceBuilder deviceBuilder{ physicalDevice };
vkb::Device vkbDevice = deviceBuilder.build().value();
// Get the VkDevice handle used in the rest of a vulkan application
_device = vkbDevice.device;
_chosenGPU = physicalDevice.physical_device;
...
and no VKCHECK in there either
vkb::PhysicalDeviceSelector physicalDeviceSelector{ vkbInstance };
auto physicalDeviceSelectionResult = physicalDeviceSelector
.set_minimum_version(1, 3)
.set_required_features_12(features12)
.set_required_features_13(features13)
.set_surface(_surface)
.select();
if (!physicalDeviceSelectionResult)
{
std::cerr << "Vulkan: Failed to select physical device.\nDetails: " << physicalDeviceSelectionResult.error().message();
return false;
}
vkb::PhysicalDevice vkbPhysicalDevice = physicalDeviceSelectionResult.value();
vkb::DeviceBuilder deviceBuilder{ vkbPhysicalDevice };
auto deviceBuilderResult = deviceBuilder.build();
if (!deviceBuilderResult)
{
std::cerr << "Vulkan: Unable to build logical device.\nDetails: " << deviceBuilderResult.error().message();
return false;
}
auto vkbDevice = deviceBuilderResult.value();
_physicalDevice = vkbPhysicalDevice.physical_device;
_device = vkbDevice.device;
idk, i find this more readable
even when "it can be assumed" that "x will never ever happen" like device selection failing in between
same stuff in creating swapchain, no error handling
building schwippchain can fail when surface is null for instance
for (int i = 0; i < _swapchainImageViews.size(); i++)
{
vkDestroyImageView(_device, _swapchainImageViews[i], nullptr);
}
``` for things like this, "shouldnt" you be using ranged loops, and avoid these
for (auto& swapchainImageView : _swapchainImageViews)
{
vkDestroyImageView(_device, swapchainImageView, nullptr);
}
Vkbootstrap's .value() uses C standard assert (which will not be triggered in release mode) so we need some error handing code
https://github.com/charles-lunarg/vk-bootstrap/blob/main/src/VkBootstrap.h#L130-L133
Yeah. It deviate from the semantics of std::optional and std::expected, but some people may not want exceptions. Or maybe using a custom assertion (that always triggers) is a better option @civic mantle
i suppose most people using any lib dont even bother with any error handling
and let it just crash to the os
Crashing is a form of error handling (much better than undefined behavior)
ye, but that has other implications
or can have
you might want to gracefully shutdown some other shit first
not like any of us make any commercial products... 
that shouldnt matter
just tried building this on my mac and it fails
I get /Users/sean/Applications/CLion.app/Contents/bin/cmake/mac/aarch64/bin/cmake -E copy /Users/sean/Documents/git/spnda/vulkan-guide/bin in the clion build output for a command
$<TARGET_RUNTIME_DLLS:chapter_0> is an empty list
ah found a fix
Are you complaining about the usage of vk bootstrap or the library itself
the part you are referring to right now is on vb
i was complaining about the value() and error() builder pattern in vbkootstrap having an assert in there, and kind of defeating the purpose of an optional/result/builder pattern
what lesley was pointing out
btw, swapchain.destroy_image_views(swapchainImageViews); is a thing with vkb
ah, but that's a different thing
hence the 'btw'
i thought of storing the vkb swapchain but at the end its kinda not needed to keep all that state
and i prefer to have bootstrap be completely private to vk_engine.cpp
i feel the same way
yeah same
Yeah I wonder if I should use std optional that I use c++17
A rewrite is in order tbh
std::optional does the same though
Assert if you access the object when itβs not there? I thought it threw an exception
but take your time @civic mantle until end of year you settled into your new place
chapter 5 now is mostly fixed
Yeah I am still staying at my moms until I can unpack more (its close by)
only the faster-draw and mipmap stuff left
gonna change that article a bit as i want to give it a timer to showcase how sorting is faster
btw its not gltf nor GLTF but glTF in all the markdown documents
really triggers my ocd
easy fix that one
final chapter is done so... its done
lmao the sorting makes things slower once validation layers are implemented
i dont have that many meshes/textures/etc so the cost of sorting gets changed from the cost of binding/encoding the commands
now the annoying part. fixing grammar/typos/gltf across the whole thing and updating the website
ok so i have to update the website
the thing is.. how to arrange it
currently i have the whole chapter 1-N on the right bar
thats automatically made and i cant really change it without nuking the permanent links i think
and seems like nesting like the vkguide 2 wip thing doesnt work unless i become webdev for a bit
im thinking having the sidebar be Vkguide New : N and then Vkguide Old : N
and on the Extra articles change them with a note on wether they are more valid on old or new
can you not just move all the old stuff into an "Old" folder and keep the structure otehrwise, and in the header have a 2nd tab