#Rosy
1 messages · Page 1 of 1 (latest)
ya
oh I should link to it https://github.com/btipling/Rosy
currently making iterative process on CSM, working on debug tooling to show the CSM layers in imgui image viewer
CSM has been taking me weeks, mostly because of side quests, where I switched to slang, switched to bindless, and experimented with multiview
plus work has been taking up tons of my free time and I'm preparing for an upcoming interview
better than what I got lol
Im still tryna figure out why my image aint blitting onto my swapchain image lmfao
oh no, hrm are you getting some kind of error?
nopre and thats the problem
#vulkan message
here if you think you could have any insight ^
made a CSM viewer debug tool
I gotta format that code in the bg heh
I guess next is add the CSM descriptors to the mega set, put the indicies in my camera buffer, and then I guess render shadows
I expect I will need to deal with shadow acne and panning and probably fix the projection once I have shadows, and then I will add PCF and then I will be done with CSM for a bit
my vulkan books have PCF techniques I will look at
I bought all these vulkan books and they've been mostly not useful so far
either it's all GPU stuff or it's render pass & pipeline nonsense
I also need to reorganize all this shadow debug stuff it's all over the place right now
my csm struct
struct allocated_csm
{
VkImage image;
VkImageView image_view_near;
VkImageView image_view_middle;
VkImageView image_view_far;
VmaAllocation allocation;
VkExtent3D image_extent;
VkFormat image_format;
VkSampler viewer_sampler;
VkSampler shadow_sampler;
VkDescriptorSet imgui_ds_near;
VkDescriptorSet imgui_ds_middle;
VkDescriptorSet imgui_ds_far;
uint32_t ds_index_sampler;
uint32_t ds_index_near;
uint32_t ds_index_middle;
uint32_t ds_index_far;
};
well I got shader code now to sample shadow maps but it's all wrong
I will look tomorrow
Make a descriptorset abstraction best thing I ever did
Also why are near middle and far all seperate sets, is this just an imgui requirement
I don’t need a descriptorset abstraction as I am bindless, what you see there is just imgui texture handles
It internally manages them they are not my application code
looking nice !
it's been very helpful already
Makes sense, but having a tiny little abstraction can be nice even with bindless
I have an index allocator for descriptors modeled after Jake’s
But with bindless you only need one descriptor set ever
So I don’t need to abstract it, just part of init code
not me with 3 descriptor sets even though they're all bindless
I dont need them but I like the organization
Heh
I'm going to go with csm from Lengyel's foundation
I just read through it, it's superb
I didn't expect CSM to be a forever project, but here we are
tons of debug tooling for this project
fixed a lot of stuff already this evening
alright alright I think my light matrix is okish, I added a little debug tool to show where the directional light is, and it is along the path I think I will use for my cascades, it's that little yellow tri fork, the lighter edge represents the light direction
I can also switch the camera to see from the perspective of the light
and I can also see the CSM ortho view, but that's still using the old matrix which I am replacing. I think the Lengyel approach will be a lot better than what I was doing
the light view doesn't have the sky attached to it, but you can see where the main camera is because that sphere is the sky wrapping its location
I miss the simpler times of using zig and opengl, but I actually really love Vulkan will probably use it for forever now
Vulkan is great

I got some kind of bug in my frustum code, it should not be changing dimensions based on light direction 😅
at least it's not a completely deformed frustum behaving unpredictably anymore, it's been really slow going but small progress wins along the way
it should just be a complete prefect cube based on Lengyel
some bad math somewhere
it should also be in my camera space and not centered around world origin
also the red box is the near plane and it's always negative z in world space
thats a win in and of itself
it's been a real struggle, frustum math has been my biggest hurdle in graphics programming so far, it's what caused me to give up my voxel game to go back and learn
I can now decompose a clipspace projection matrix into worldspace, that was what I couldn't do in my voxel game
but what I am struggling with now is aligning an infintely far away directional light's orthographic projection with my camera's frustum
the other thing I can do now that I couldn't is find those points that you're seeing in that debug view, I can find sliced planes in a frustum
good luck 😄
thanks 🙏
got the light debug display showing up where it is in the near plane
I had the dumbest bug this whole time, I was overwriting my frustum matrix with a debug value in the debug drawer 
a layer I never look at
the frustum is now directionaly correct with the light direction, but it's still not taking into account the camera position
this will generate some shadows for sure, it needs more work
once it's an orthro it won't shrink in the distance
just have anything would be nice
so I'll work with this and iterate on it
well
I licensed Lengyel's engine
and I found his CSM code in there
AND
well
his book leaves out a lot of details

I'm glad he makes his code available for licensing
I will use zero of it, it's against the license to
but I am learning from it
anyway, pretty cool stuff, it'll eventually help me make my own CSM better
it's time actually render some shadows with what I have for now though
I am the biggest moron
I literally had working shadows this entire fucking time
except
bool InNearShadow = nearColor.z < csm.near.z; -> bool InNearShadow = nearColor.x > csm.near.z;
that was it
I just had to spend time in renderdoc
needs some pcf though
some other minor bugs
but CSM!
I need to pick the map to sample based on distance to camera
pcf
and there's still an orientation issue with the frustum at some angles
but these are small potatoes compared to not working at all because I only had values on x because of the image format 
I learned a lot again about a lot of things by having some bug and being way off course on fixing it and learning all sorts of other things along the way
like my understanding of orthographic perspectives is solid now
like how to make them from scratch and how they behave
I also frequently lose time on code bugs that would never be possible in zig 
well would be possible if you intentionally wanted to
what's cool though
is how awesome vulkan is
because all of this makes sense
and I was able to debug it so nicely in renderdoc
I could see my image and sampler create info, I could see the indexes for them in the descriptor, I could see all my matrices, all the color values, depth values for every image (that part is awesome about renderdoc)
just a great ecosystem 🤗
Nice
I need to keep the shadow maps within my frustum
I will follow up later and make it better
I want to work on loading sponza
I'm going to add tracy profiling next
wait, c++? what happen with zig? 😮
zig is great, I just want to use a lot of C++ libraries without writing bindings
I am installing Powershell Tools for Visual Studio so I can configure a powershell project to run as a build step to build my slang shaders as a build dependency for the engine
then I need to figure out how to create a new startup profile for the project to set default macros to add all the ztracy stuff
this is all stuff that was really easy to do in a build.zig lol
in premake I just use lua to run the command, and this works with my vs solution, can you really not run commands in cmake or whatever you're using?
I don't use cmake I use msbuild
yes I can run commands
but I think it makes sense for a separate project to run the command and then I put all the slang files in that project
premake sounds cool, I have just been trying to contain everything to visual studio defaults
not working
maybe I switch to premake 
I mean it works as part of a build
but I can't get it run the script when the shader files change
it just can't seem to see anything other than C++ files as source and exe/dll as targets
I just run my script prebuild every time by putting it in the premake prebuild commands
that's the thing I don't want to run anything I just want to push the build button and stuff happens
Yeah
It does it when you push build
It runs it every time you build tho
Not when you change shaders
I want me changing my shaders to trigger them to build that's not too much to ask is it :(((
maybe I need a custom file watcher thing
I'm going to write a powershell script to do that
4 ms to render just deccer cubes (plus 3 CSM)
mostly the gigga barrier vkguide style takes only about 1 ms
the buffer swap takes another ms
and then 2 ms to render the cubes
unfortunately I wrote my code in a way that made gpu tracing not work well
I will have to refactor that
anyway, next I will add some hidden surface culling, using vkguide's strategy, I need to pull colors out of materials and then I try sponza. I don't have any support for translucent meshes right now those would just look broken
after sponza I want to do skeletal animation
after that I just want to go back and go through my books again and learn more
@astral hinge I had pointed out before that running the new shader object commands felt slow, they really are slow you can't call them in a draw loop, they as a whole take over 100 micro seconds, I was calling them per draw at first, I sparingly set them now, they're like each 10 microseconds 😅
like to call any of those vkCmdSet*
I bet if I used pipelines I'd wipe 1ms off my frame time
eh it's ok
use timestamp queries
yeah, I would not create shader objects per frame personally
I don't create shader objects per frame
I was talking about calling the functions you have to record in a command buffer before you can render
setting depth enabled, setting polygon mode etc
all the new vkCmdSet* functions that were added in addition to the shader objects themselves
with pipelines you don't have to call them as you set all that in the pipeline create info
I think that they're slower than binding pipelines
it's no big deal, it's not that much slower and I rather use them than not :/
thanks I will check that out!
Ohhhhh
Yeah
I need to read up on variable shading rate https://github.com/KhronosGroup/Vulkan-Docs/blob/main/proposals/VK_KHR_fragment_shading_rate.adoc
this is pretty cool
I am not going to worry about it right now though
I want to add frustum culling, and I need to pull in more gltf material data, I just pull in the textures right now
and then it's just loading in the gltf and see what breaks or is slow
then I will work on skinned animations, then I will start making an actual game
I'm going to make my robot escape game
where you're a little obsoleted robot trying to escape being reclaimed
a small level puzzle game
Very cool, frustum culling on GPU or CPU?
I'm also looking forward to the robot concept art
Hit me up, if you want some music
CPU to start, I am not spending a lot of CPU time on much right now
we'll see though I don't really know what I am doing
:P
you got the cubes at least

added a little bit of stats ui
no display of afps 
idk what that is
I think I heard of it before though
ah #1311466891415519302 message
was about to link it haha
let me add that
yay
my code is a mess. I need to clean it up, I looked at some other code bases, I really like Lengyel's C4 engine organization (I licensed it to learn from him), I think I would like to go for that
Did you ask him when his new books are coming out too
No I just filled out a payment form and got access to a private GitHub repo
Checked out the latest c4 vids and there is a real need for newer assets
I get the engine is 15+ years old but you cant tech demo today with what was good then
https://youtu.be/0-rPe3WaTJ8?si=6Ze3EY8hmCoRmd6M looks retro cool tho XD
This video shows the velocity buffer used to render motion blur during post-processing in the C4 Engine. The 2D screen-space velocity accounts for the motion of the camera, the motion of objects, and the motion of individual vertices for cloth and skinned meshes. This technique is described in FGED2, Section 10.7.
I haven’t looked at what api it uses. The code is really good though. It’s like a crystal palace
Just sparkling beauty and clean
It’s great for understanding his math and technique which is what I am interested in. I haven’t run it
He doesn’t use STL I think
I am also going to stop using STL as much as possible
Why not? (Also STL terminology is my pet peeve) I feel like std::vector, span, algorithm, make code look really nice
I will keep vectors
(Technically STL refers to an obsolete SGI library, what we have now is the standard library or std)
I just will stop using shared/optional/unique/expected and just use actual pointers
It is slow and I don’t like raii
Slow to build
Yeah I guess it is your code, you get to choose how you do it. 😔 as much as I like unique_ptr
So why did you switch to C++ btw? I though you were big into zig?
Ecosystem in C++ is better for games and graphics
No vk bindings in zig?
I don’t want to use bindings they are problematic and depend on a single maintainer working in their free time to maintain
I think STL clarifies the template stuff is what I don’t want to use
But that’s true
https://github.com/Snektron/vulkan-zig
it's autogenerated from that xml api defenition and does error handling etc. best library made in zig imo
are you using vma?
I'm curious what you're using for textures also, are you using ktx or dds? are you generating your own mipmaps?
it's not just mipmaps that you get from something like libktx you also get the compression
you can roll your own mipmaps with C++ but if you're still shoving in pngs idk, probably not as good
as something like ktx or dds and I don't know what other formats exist that do that, but there probably are
I guess it's all specified in the spec
VkImageCompressionFixedRateFlagBitsEXT etc
I use bc7enc for compression + a lanczos3 filter for mipmaps
once you have the compressed data you can stick it in a dds ktx or custom format
Where can I find the 3d model please ?
The cubes?
omg i forgot about the image 
I cant tell if its cobbled together clipart or ai art
the latter
why is deccer white color
it's just a placeholder skybox I found online I need to replace
I actually had to fix it in blender
#bikeshed-😇 message
im so sorry that you got jumped by 999 lv 1 gl people 😔
I dunno why but AI art always looks like it has a insanely strong local tonemapper applied to it
The the contrast levels are wild
well I mean
it starts from noise
so contrast is usually pretty 50/50 throughout the image
or atleast so I've heard
I do not like ai art
same
it's not art
it looks the same no matter what you "generate"
it's just ai pictures
This isn't the worst I've seen but generally it's pretty awful
youtube is being flooded with ai shit too 😦
I Literally click away as soon as I hear that awful ai voice over
does anyone have any recommendations where to find good sky art? I am using a sphere now
I prefer it to a skybox
Theres alot of hdris on polyhaven
I use rayDir * .5 + .5 for mine
why doesn't google show me stuff like polyhaven
I used this one for a while https://polyhaven.com/a/kloofendal_48d_partly_cloudy_puresky
I search for skyboxes and I get junk
Search engines are dead
they really are, I just watched freya's recent video it was so depressing
even kagi is affected
The only way to find stuff is to ask people on discord
I've accepted that I cant escape it
when epic announced FAB i thought all sites they "own"? will be merged and just point to fab.com, but they dont, like sketchfab/polyhaven/textures.com etc
But there are legit real people making quality content, why waste my time on AI slop
this is a nice one too https://polyhaven.com/a/industrial_sunset_02_puresky
I dont purposely click it
Its only in short form content brainrot
I have to assume everything its telling me is AI hallucinated misinformation
You should know hardware mitigates this problem
My oldish windows laptop takes about 10 mins to build my engine due to my tons of template stuff
But my macbook does it in about 20 seconds tops
So I see that as a windows laptop issue not a C++ issue in this context
The next windows machine will do it just as fast or faster than the mac
So while I'm sure you can learn (and should) lots from c4, keep in mind it was made by someone who made games a couple of decades ago on hardware from a couple of decades ago with languages and libraries from a couple of decades ago
Or dunno dont listen to me I may be talking out of my ass here XD
Templates are C++'s greatest strength because they allow you to write less C++ by having C++ write itself
Writing less C++ is always good in my book
Also play some games from a couple of decades ago or older, see how great they run on new hardware
Truly peak engineering must've been
I'm not taking shots at old games or what the devs had to do to make them work because making games is hard and focusing on supporting generic hardware from 20 years into the future is a waste of resources for many reasons, just not agreeing with how you randomly picked c4 and went with "this is good I will do everything like this"
Be more selective and critical of stuff, is my advice
Use the stuff that helps you be productive whatever that may be and you're productive when you add or change features to the thing you're building
Fixing bugs is not being productive, debugging is not being productive, stepping through code is the least productive part of the already unproductive debugging, fighting the language is not being productive and indeed dealing with modern C++'s occasional bs is not being productive
These are I think good guidelines to follow, use the stuff that helps you build what you want faster
You may argue that fixing bugs is not being unproductive because they're necessary to not ship something broken and I agree with the 2nd part especially they're necessary but also a day of bugfixing pushes the release date by an extra day while the features of the product stay the same
So anything that helps you avoid bugs is worth considering
In these 2+ years I've been working on my engine those days are the only ones I really regret, when I wanted to add something new or change something but instead had to fix some bugs to make it happen or to try and get something to compile or work the way I want it and need to research the magical incantation C++ wants
At the end I'm of course happy because finally I get to do what I want
But on the other hand jesus christ what a fucking waste of time
Yeah, that’s why I turned on Werror yesterday. To avoid wasting time on bugs. It really does suck to lose hours on bug fixes
I am not just trying to blindly copy C4, I really dislike RAII, and my code actually is a mess and I have been learning about good code structure in C++
I don’t have time to write good code at work, I want to write good code
My thing is just a hobby, nobody will likely ever play anything I make. It’s just a thing I like doing, plans to ship a game on steam would stress me out even more on top of work stress
There are already a ton of games out there, many indie games much better than I could ever do. I am just building a game for me. I can take my time in my case
I appreciate your perspective though, you make a lot of good points
I do want to make progress
Just not with what I currently have, it is garbage
I turned up errors to W4, and fixed all those errors and learned how to ignore errors in third party code. I tried turning Wall on but it freezes Visual Studio lol. I think I will have to enable those warnings one at a time
I have found actual bugs
Like I was setting maxLod to num levels on sample create info, which must have been a copy paste failure??
I kind of just want to write C but in C++ so I can use C++ libraries
what is it about RAII you don't like btw?
It's so much simpler to just allocate memory for something and pass a pointer around to that memory. I do a pretty good job of understanding the ownership of what code owns what memory and when it can be modified. It's all my own code. The magic of RAII is hidden control flow I don't like, I like explicit deinits. I can think about it better. I don't like std::move and std::copy and std::shared and managing all that. I can just track pointers. I did it with zig and never had any problems
also my build is really slow when I change a header and I have very little code, and I attribute that to: bad code organization that I am fixing and template usage, so I want to remove them for that reason too
I hardly have any code, my build shouldn't take 2+ minutes 0_o
I kind of went all in on RAII to try it out though
I wonder if I can get more verbose output during building to see what actually is taking up time
when I first started writing C++ for this project I kind of just was writing it as I would write zig and that didn't work at all. But now that I know more about C++ I think I can actually understand a path where I can write C++ as I would zig, but with the understanding of how translation units work in C++. In zig you don't have to worry about that, have to worry about import order and that has been something I have had to learn. This is for C, not C++ but I like this too https://www.lysator.liu.se/c/pikestyle.html
I want to try to have a single include and then include cpp files intead of the mess I have right now
I remember finding the flags for deccer but I forgot them already
it's like -ftime-trace and one other
so that it ends up building a single tu for the renderer
one is clang-specific and gets you really nice flamegraph data
What compiler are you using @cloud rivet ?
msvc in visual studio
Cool
Seems like most of us are
Well technically I use clang-cl most of the time but I'm still in the MS ecosystem
I used msvc for zig too
well the zig compiler for compiling, I forget what I used msvc for in zig 🤔 I am already forgetting things
You should check out clang-cl it's really easy to set up in VS with an existing project
ok thanks
It's good to see sometimes it gives better error messages
yep clang is pretty cool
plain MSVC with verbose error reporting gives me the best numeric UB feedback of the big 3, I've found
Build insights
the third being gcc?
yes
Thank you so much!
My debug build is MSVC and my release build is clang-cl so I exercise both compilers
oh, and you never have issues that something builds in one and not the other?
inevitably you do lol, that's why you check
I build with gcc and msvc, but use clangd as my language server
All the time, but usually that's because my code is wrong lol
Now I know my code is more or less compliant
nice
do you use resharper C++?
would that help? it has a clang tidy check I already use
it's not free unfortunately
Nah, I don't use it
i think there is a clang plugin for vs, which provides clang tidyisms, without resharper
I never got ReSharper pilled
Resharper is great
I probably would not add it to a big existing project though?
probably better to try it out on a new project if you're ever interested
It's important to test multiple compilers and preferably multiple platforms regularly just so you get extra confidence that your code is ok if nothing else
yeah, I don't have multliple platforms but I will try the clang compiler for sure
i could never tell how much i hate C++ before joining DevSH 
what is DevSH?
@ devsh's sweatshop 
oh you guys are coworkers, neat
I am going to use a bit field to track what I vk objects I initialized instead of std::optional. I see everyone seems to call abort() without cleaning anything up when they encounter something that isn't VK_SUCCESS and I don't want to do that. I guess RAII handles it in that case. I want to deinit everything I inited on any type of exit and not just exit the program. I was using std::optional but I am getting rid of that too.
Destructors of variables with automatic, thread local(since C++11) and static storage durations are not called. Functions registered with std::atexit() and std::at_quick_exit(since C++11) are also not called. Whether open resources such as files are closed is implementation defined. An implementation defined status is returned to the host environment that indicates unsuccessful execution.
ah nah it doesn't even do RAII? lol
no way am I doing that
oh I don't really understand what that means I guess, nm
abort is the lazy way out
OS will free ur memory anyways 
Sometimes you gotta make sure things happen in the right order
Yeah
A lot of memory management solutions create more problems than they fix ime
I'm going to fix it
I am going to fix it by starting over
as in Rosy 2?
Rosier
I'll add a git tag on what I have and reboot the current project
Rerosed
make it based of wrenderer which is the pinnacle of rendering code and there is obviously no pitfalls in my design

I'm not going to go crazy different, just be more conservative and apply what I have learned so far and hope it goes better
I'm also going to explicitly create the create info structs in each case that I use them and not use helper functions
idgaf
I'm just going to avoid abstractions as much as possible
and fancy C++ pointers
still use std::string and std::vector etc
Is this just because your build times are bad?
You can maybe try putting less code in header files
Also PCH or modules
Your biggest compile time seems to be headers from that graph
Instead of starting from scratch again why not try a deep refactoring (I always find that fun)
it's because I didn't know any C++ and wrote code like you might expect, I have a huge dependency tree problem where I basically have really unstable headers because I just didn't really understand TUs and it is just a mess
I can't really easy reason about what is included by what at this point
I will make a change somewhere and something totally unrelated starts erroring
I looked at a deep refactoring
I think that would be more work than starting from scratch I hardly have any meaningful code
it's mostly vk setup and a rendering pass
and gltf ingestion
and a camera
its totally fine to start over and over
and then apply what you learned the previous iteration
that will make those actual refactors simpler in the future, when you actually "have" or want to
I think so too, especially now where I hardly have any code that does anything
im doing the same now with that HowToScript learning project thing, which was Toadwart before 🙂 and now becomes OpenSpace or perhaps one more step in between, not sure yet hehe
I do want to have something at some point that lasts and I can work on for the long haul, like uninvestigate
I will read up on C++ modules
tear or allmight (i always mix the two) were also fiddling with modules, perhaps speak to them too about their experience with it
get on my level
those comments aren't gonna write themselves
I'm gonna try and avoid vcpkg this go around and add manual build instructions for third party deps
instructions for me when I want to run this on my laptop
maybe I'll write some powershell at somepoint to add them
not naming header .hpp 
that takes too long to write
hehe
we are efficient programmers here
isnt that an oxymoron, in the context of cpp
oh no 😄
anyway
nah its alright, ignore me
I use those buttons too
But I have to fix the formatting in the cmake every time 😄
we need a no version of 👌🏽
the whole engine code is in one line, checks out
that's just 🖕
alright I will add sdl3 then
then vulkan init, then render, then camera, then shadow and boom back to where I was
ezpz
oh and the gltf stuff
and the image stuff
ezpz
and then you draw the nice owl
time to switch the programming language
✅ SDL3 Window ezpz
took like 5 minutes to do that
also this time I went with a blank C++ application
I don't have this msbuild litter in my flie system anymore
just the files I have created
it's really nice
Vulkan init next
after a break
remove #include <iostream> it will get faster
how do I cout ?
don't 
write logs to a file?
fwrite
in c++23 we get https://en.cppreference.com/w/cpp/io/print
but std::format() + fwrite works good
iostreams are widely considered to have some design mistakes
I don't really like any of the streams
If you do wanna use streams for logging, I recommend create a log.cpp and only including streams in there
yeah std::format is pretty safe tho
std::format is std::print but to a string
but std::print is 23 only
yeah so you have to write ugly code to print the result of std::format until then
@cloud rivet which C++ standard are you on?
the other nice thing about printf is that its header is very light
man it sucks that nice features hurt compile times 
oh ok I will dump it
I can't deal with slow compile times I don't care how nice the feature is
I need a fast dev loop
I mean iostream isn't even that ergonomic
Don't use spdlog then
look into precompiled headers
Even though it has a nice API, it destroys compile times ime
I am going to write a debug logging thing that will have log levels and stuff abstracts things
in game engine architecture they have a browser view of their debug logs that they can filter 
different logging systems for different subsystems
hot reload will help with fast dev loop eventually too
I wish I had all this advice last go around, I appreciate the help 
thank you
No worries
Tbh I don't even worry about compile speed optimization as long as it's fast enough
I put stl includes in headers all the time
But the biggest thing is probably having a 5950X
Yeah I spend more time optimizing my engine load time
I'm using a 3900x which is a bit old these days, but it can still chew through C++ code
i had a 3800x before this 5950x there is not much difference, despite double the thread count
compiling firefox or ue might be a bit faster
or LLVM 
hehe
(`・ω・´)ゞ XD
i just looked at your latest PR and that rabbit gets mad if you tell it to stfu 😄
if you keep optimizing your build time in the back of your head you end up with decent enough results
just being extremely stingy about including anything unnecessary, maximizing forward decls, etc.
forwardmaxxing decclmizing?
something like that
yoo deccer is orange again. not the right orange tho
time to write a vulkan renderer in asm
frog_agony.png
the real frog agony is no fastgltf c api 😔 🔫
That is the plan, really limiting the includes
there's also a pin in bikeshed iirc with a bunch of compile time optimization tips
I will look thank you
#bikeshed-😇 message
that's a great list
I think minimizing headers is interesting
I guess I don't need to stick anything into a header that isn't going to be used by a different TU yeah
I just always declared everything and all things in a header
but I guess I don't need to 
new(std::nothrow) 🎉
TIL
I can just check nullptr instead and not have any try except and can still clean deinitialize after an oom just like I can in zig
I do miss errdefer and defer :(
You shouldn't make exceptions part of the program's regular flow because they'll bring in a lot of overhead and catching is especially slow
catching being slow is fine
If you crash right after yeah
you usually want to exit your shit anyway when an exception occurs
or when you have IO involved (connecting to some http service for some reason, or something like that)
I want 0 try catch
I will have to for file loading I think unless there's something I don't know about yet
but keep them to as close to 0 as I can
I don't want try catch messes
yup that's the goal
Well you want them for cases where you can recover from except the case where you catch anything at the top level to log some info and then crash
Like can you recover in a game if the file finalboss.bin is missing, nope
So crash
Can you recover in an editor if the file finalboss.fbx is missing, yes, so catch
You can remove its asset entry, emit a warning etc.
Maybe in a game like elder scrolls that lets you load and unload mods you could attempt to recover from missing files but even the game tells you it's not a good idea to continue
Exceptions are just one type of error handling mechanism, use the best one for the case you're in I guess
you can recover very easily from that though
no
I think std::expected when it becomes more common will help a lot in making error checking easier mainly because you can't get the value without doing the check
if you expect files and they are not there, you skip or use placeholders instead, or decide to peace out
you can use try catch I am not using them, I don't care what utility they offer I don't want any
I also do not use std::expected or any of those templated things
the whole c file FILE* api also has functions to check
I got I think all the files set up now that I will need until I have game play I am not allowed to add anymore files until then
ok I'm going to walk Rosy and then come back and add vk init
Exceptions considered harmful, don't use them
Do use templates though
they are good for you
do you have any error propagation mechanism or is it just inshallah
I created a result enum I return to handle errors
I do not leave them unhandled
In zig I would use a union but here it will be just the result type and and the actual return value pass in as pointer just like Vulkan APIs
No templates, no exceptions no std::expected
alternatively you could cook an expected type yourself
then you dont have to use enums
That would require templates
ye, one 🙂
why hate templates?
compile times
They don't always do that
yeah avoiding templates like that is kinda cargo culty
@cloud rivet how long could you tolerate? for compile time
If I have to use templates I will, but I don’t think I need to for this
the only way templates hurt compile times is through redundant instantiations, which you can theoretically remediate with extern template
Like a clean build of ASO + dependencies (Bullet, SoLoud & SDL) 1:27 minutes
an incremental build is near instantaneous
Nice
I use templates and standard library all over the place
How fast do you want it to be?
Do you have /MP set?
I just have whatever is default I don’t understand all the options yet
actually is this cmake?
You should figure them out before you mangle your code
Oh good idea
@cloud rivet https://devblogs.microsoft.com/cppblog/recommendations-to-speed-c-builds-in-visual-studio/
In this blog, I will discuss features, techniques and tools you can use to reduce build time for C++ projects. The primary focus of this post is to improve developer build time for the Debug Configuration as a part of your Edit/Build/Debug cycle (inner development loop). These recommendations are a result of investigating build issues […]
may i suggest a rename, of log to logger
log is what the logger writes into 🙂
log* new_log reads a little funny too
perhaps Logger* logger or logger_t* logger?
or TLogger* logger 🙂
TLogger will trigger resharper to yell at me
I have reread the template metaprogramming section of GEA and they advocate for a case by case basis
also
in defense of what I have said so far, I am not going to bend over backwards to avoid templates, I'm not cargo culting, I think what I have explained I would do for returning results is just like all the vulkan code I use all the time, it's not exceptional
logger is not a real word, is what bugs me about it
I don't like nouning verbs
or verbing nouns
I guess it is a noun, but it describes someone who fells trees
oh right I was going to look at what the parallel build option was, I use -j with make all the time, but it's not always ideal
/MP is the parallel build flag
You know if I ever want to take a break on graphics programing for a short while and work on something else I think I would want to help out on the slang visual studio extension, and fix some of the issues with it, and maybe just on the actual slang project itself if they accept PRs
I don't think I will want to take any breaks any time soon though
you could take a break to work on gameplay 
I
git log -S
-S<string>
Look for differences that change the number of occurrences of the specified string (i.e. addition/deletion) in a file. Intended for the scripter’s use.It is useful when you’re looking for an exact block of code (like a struct), and want to know the history of that block since it first came into being: use the feature iteratively to feed the interesting block in the preimage back into -S, and keep going until you get the very first version of the block.
Binary files are searched as well.
they accept prs
current frame rate report:
going through the vk init is just a grind
about halfway I think now
I think though I won't have to do this again any time soon
I think this engine is now much better
short term grind long term success, or whatever the alpha males say or something
long term grind long term success
the grind is not short term
the grind never stops
DROP AND GIVE ME 50 HWRT PIPELINES, NOW!
8 more init functions to implement
maybe I can get a clear color by EOD
with no abstractions and helpers my loc is much bigger than before but this is much more readable
it's a zero abstraction init, I am hoping to just have a fully zero abstraction rendering engine, I do have a descriptor index allocator, but that's not really abstracting away any vk stuff, it's just something I have to have
my full build, after a clean is still under 3 seconds
hasn't gone up at all
"Judy: Trent, we need to go faster."
tiny headers, no templates, just a few files, it's working out for me
my graphics.cpp is going to have a massive loc eventually
I bet fastgltf will add like 1 second to the build
linking massive cpp files also takes ages
it's ok, I don't think I'm going to end up with another 80 second build once I am done with this, this is already a huge improvement
i also have ccache and mold setup, but im not really sure if they do anything
fastgltf is worth 1 second
set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_STANDARD 23)
if(!${MSVC})
set(CMAKE_CXX_LINKER_LAUNCHER "/usr/bin/ccache")
set(CMAKE_LINKER_TYPE MOLD)
#set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "-ftime-report")
endif()
oh I wonder if I can use a different linker than whatever's the default
sudo pacman -S mold ccache
maybe I quarantine gltf to a separate cpp file so I don't build/link fastgltf whenever I touch Graphics.cpp
some years ago i was playing around with a little c# program which would constantly compile modified files and link whatever lib/o was there into whatever binary i needed, so that i constantly have a binary ready to run at my fingertips, i need to pick that one up again eventually
that's neat, wow
yeah my overall build from beginning to end is probably faster like this, but I am probably destroying incremental build times
so some tradeoff to be had
anyway still better than 80 seconds
im also quite annoyed by build times > 1s because im so spoiled with what delphi/c# can do
but yeah, it is what it is, you cant always make this c++ shit that fast magically without tricks 🙂
I assume anything that is feeling bad in my dev loop is a skill issue on my side
yes 😅
simple is nice to work with
holy shit im building slang with all options for a pr rn and this shit is lagging my entire pc
thats nice
slang people also cooked up some RHI 🙂
it was suggested to me on ze github feed few weeks ago
I wonder if it's as cooked as slang is
its some vulkan soup, i didnt look into it yet 🙂
but it made me think about anari, nvrhi, filament for a split second
and then i used the rubber band to snap my self out of it
based
"the game" doesnt write itself : >
And every one and their mom is making an unnecessary graphics api abstraction
I'm just not in the market for any of these things anymore, I don't want an engine, I don't want a graphics library, I just want my vulkan
finished vulkan init 😅
I'll do the color clear tomorrow, then add imgui back in and then work on adding gltf and skybox back in
I have a pure zero abstraction vulkan init again though, that's nice
still under 3 second clean to build time
This has been super worth it
I actually found some issues in my init code
cleaning out all that optional mess also is great
you can probably move VMA and Volk into their own targets and link them statically?
in my Fuk project, i have vma, volk, vbkootstrap as submodules for some reason
Those are those are files with a single #include and have a stb style impl #define directive
I could move them to the libs directory
I will do that
these examples are great
the graphics to graphics sync says to use subpasses
which with dynamic rendering and SO means using the VK_KHR_dynamic_rendering_local_read extension
I'm getting rid of my ALL_COMMANDS
i dont think i will look into vk anymore, all those outdated guides out there, and no matter whom you ask, its always different on what you should do now
yeah, a real challenge figuring out your own path right now
im also too old to learn new shit, opengl is hard already
I think opengl is harder in many ways than VK
the explicit api and VVL layer errors really help
sync is explicitly documented and an explicit api whereas to me all that stuff seems less understandable and less well documented with no validation with opengl
i think i should read the spec more next time (vk's spec) to understand sync better, but i didnt quite understand it last time when fiddling with Fuk
the first time I did init with vulkan it took me 2 weeks full time? It took me 1.5 days this time
i guess you are right that vk makes more sense there, since its much more documented than with opengl : )
of course opengl will always take like 5 minutes
hehe
I take short cuts with my sync with ALL_COMMANDS and sync in vulkan is hard, you get that explicitly handled for you with opengl, but given the common uses cases I can follow the sync examples and figure out any custom stuff I want to do later
I'm also doing some things that aren't thread safe right now
one step at a time
Here's my current pedestrian understanding of vk sync some of it which may be wrong:
basically nothing is ordered for you, everything is out of sync, if you need something synchronized it has to be done intentionally. You don't get ordering guarantees even between/across queues or submits.
if you need the cpu to read from device you need a fence
if you need to read memory you wrote to from gpu to gpu you need a memory barrier, and if you need an execution to happen in order you need an execution barrier, a memory barrier is also an excecution barrier.
You can use pipeline barriers or events for that.
Semaphores synchronize queues, pipeline barriers & events synchronize cmds, fences sync gpu to host.
a subpass I think also behaves like a pipeline barrier, but that's render pass stuff
someone shared this on the vulkan discord I liked this:
the ALL_COMMANDS is a giga barrier shortcut that just says "fuck you, flush all caches" and is super inefficient, but basically guarantees order, based on my metrics for the few barriers I had it probably cost me about 1ms for all of them combined per frame
vkCmdWaitIdle(); vkFinish(); basically
There are also flags to refer to “all commands”, ALL_COMMANDS_BIT, which basically drains the entire queue for work.
hrm well it's gpu to gpu
glFinish is really slow
i will look at it when i decide to unalive Fuk
I use ALL_COMMANDS_BIT several times a frame
but I will get rid of it
vkguide uses ALL_COMMANDS_BIT
i keep seing people mention timeline semaphores and whatnot
yeah I don't need those right now
vkguide doesnt do anything "performant" i believe or "best practice", it just gets the vulkan ball rolling
no vkguide loads a full big gltf scene at the end of it
yeah that hangar thing
but still
just like logl it just gets you enough knowledge to start using vk
exactly
you can use it if you want to manage descriptors like they did in the stone age
that means, it lets you know enough to get started, but it wont be the "best" way of doing vk
idk I am not a source of information about vk, I am happy to explain what I know but it is probably incorrect, I just know I like using it
its all good
he should know 🙂
and really helpful
one last thing about vk vs opengl, I think the tooling for vk is also better than opengl, I think it's not keeping up anymore for opengl (also maybe relevant to @wraith urchin 's question)
like renderdoc opengl support is just mostly in maintenance mode at this point, is a fair thing to say
yeah that is true unfortunately
bindless and vvl and all that shit is >>>>>>>>> opengl
all the opengl note are "bug fixes" and not in the "features" list on https://github.com/baldurk/renderdoc/releases
hes not actively supporting any opengl nonsense really anyway
timeline semaphores make thinking about and implementing stuff simpler, so they're 100% worth it
clear color ✅
I'm going to fix minimize and resize and then add imgui back in
then add gltf and camera back in and the csm and back to where I was 🎉
maybe a week for the full reboot is not bad
still sub 3 second build time
full rebuild after clean
this was a necessary exercise I keep finding things I had wrong actually
my rendering is also zero abstractions
+300 lines to render
Nice
removing all the helper functions for vk create objects dramatically increases loc, but I don't care, I hated those functions. They hide important information and they required adding multiple versions or logic to handle variations
I much prefer putting the explicit create structs right there where I use them 
Yeah
my frames right now with just a clear color
I have a bunch of functions(like 6 lmfao) that all do their specified task in one function, and then an Initrenderer function that also sets up some other stuff as well as calling those functions personally
nice
resize/minize functional ✅
oh there's a validation error
take 2! ✅
also cleaned up volk and vma
that's a pretty clean code base that builds under 3 seconds, I just don't actually see how it's going to end up back at 79 seconds again I am sure I fully fixed the build speeds and made my code so much better I'm gonna have a game real soon
does build time include compiling shaders? 😛
My shaders before were tiny anyway
Just shadow and texture sampling and basic lighting
i also realised something this morning under the shower 😄 i have been doing basic ndotL lighting wrong the whole time
I am going to try to use local attachments instead of render input attachments for multiple passes so I can just have one rendering block and fewer pipeline barriers I bet it will wipe like 1 or more ms from my previous frame time
How do you fuck that up?
blinn phong is considerably more complex than simple ndotl
Right it has the half angle
i never used the FRAGMENT position 😛
l = normalize(fragment position - light position)
n = normalize(n)
light = n dot l
color = diffuse * light
That should look pretty wrong with big surfaces with large distances between vertices
It’s kinda like gouraud
idk why i fooked it up the whole time
You mean the interpolated vertex position yes?
you need to calculate the light direction from the light to your fragment
and do the ndotl based on that
oh you had a basis issue?
yeah you have to either put the normal into world space or put the light into TBN space
You don't need to with a directional light 
: D
honestly I haven't bothered with point lights in so long I didn't notice the mistake
my game will be mostly point lights
since it will all be inside
I'm putting game play begin deadline beginning on feburary
like february if I'm not done with the code stuff bikeshedding I will be done and will be working on gameplay
What about spot lights?
yes
You only need 1 face instead of 6
the camera distance from the characters will be large, so I don't think I need a lot of crazy detail, I'm trying to be inspired by The Ascent
with respect to shadows
we'll see though
small levels, large camera distance == cheating
@true moon to not spam deccer's thread too much with my own thing, I am even planning to set the origin at a corner of the level so that all cordinates in all directions will be positive, regarding:
#1019740157798273024 message
its totally fine if you spam in my fred, thats what they are made for 🙂
ok sorry just felt bad about that full discussion going on in there
Yeah we can't allow deccer to get any actual work done 
i started ripping out glfw earlier : >
all the topics in our threads is what keeps me here 🙂
offtopic or not doesnt matter
Are you using SDL @cloud rivet ?
How different is SDL3 compared to SDL2?
for just windows and events not much
just minor api changes, but I like those changes
I probably won't update any time soon but I'm curious
there is a new way to use SDL, I think it is new, where you just provide hooks and don't even have a main function
If you're just using SDL for windows and events I don't think it will be a lot of work to update
the way SDL kinda works is already cursed
and SDL finds them magically and calls those
because it replaces your main function
like your GameTick and init function iirc
the benefit is that you can support all sorts of platforms which work differently, like mobile and consoles
without any jumping through hoops
I'm more worried about new bugs, SDL2 is very stable
its kinda cool actually, but weird when you are used to wire it up yourself
im also going with sdl2
You should only include SDL_main.h from one file (the umbrella header, SDL.h, does not include it), and know that it will #define main to something else, so if you use this symbol elsewhere as a variable name, etc, it can cause you unexpected problems.
main becomes a macro
SDL3 will probably happen around the time of my theoretical vulkan port
yeah i dont get that release bs either
everyone is celebrating SDL3 IS OUT NOW
but its not really
yeah
it's not released yet
im on 2.30.10 😛
It's a minor upgrade if you're just using windows and events https://github.com/libsdl-org/SDL/blob/main/docs/README-migration.md
its good that they cleaned up naming
and that errors are now returned as bools and you call SDL_GetError() I love that
like if (!SDL_DoThing()) { // handle error } // all good
yeah thats better too
That is better, but that could be annoying to find all those spots
As I suspect it won't produce a compile error
Not too bad tho
Yeah but it might be an error that happens only when I put in a gamepad or something
yeah
Because they flipped success and failure
Tbh I'd just put it at the center
I think it was the right choice, but the potential to introduce those bugs is not worth the benefits at this point in time
Yeah if you are starting from scratch that makes sense
vk shader objects doesn't work on linux afaik? could be
and I'm picking up the new VK_KHR_dynamic_rendering_local_read extension
When are we gonna get robot running around sponza?
february I'm commited to game play starting feb 1st
that's it. I'm done with the project bikeshedding
I don't think there's really a benefit to keeping your coordinates positive
Your math is generally going to be basis-independent except for the up dimension
So the values don't matter much
And by keeping them all positive you're throwing away a lot of floating point precision
I was thinking it would be a nice bounds check, negative numbers == bad math, but thinking about it would only bounds check in half the possible directions so maybe not a great idea
in fact
yeah placing origin at center and then absolute ceiling is even better
Yeah because then you have sort of a soft limit in all directions
yes
Having a hard limit somewhere is going to cause pain eventually
yeah more of a warning I think when it happens
I wouldn't worry about it too much loss of precision is a pretty seamless error
If you wanted you could just log a warning if something is far away
But generally it's not really a major issue
If you have debug visualization for things like raycasting and bounding volumes and stuff, then the actual geometric ramifications of precision loss will be visible graphically
So if your raycasts are missing for some reason and you go debug to see why it'll be obvious what's happening
But generally speaking graphical instability becomes significant long before physical stuff does
Since less than a millimeter of jitter is very obvious graphically but not really significant for most gameplay/physics purposes
100μm precision is about where you want to be (2048 meters) but you can get away with around 0.25mm I think (4096)
thank you, that sounds good
imgui ✅
also this time drawing my imgui to my draw image instead of to the swapchain so I don't have srgb issues lol?
what was I going to do next I forget
hrm
sponza 
heh
I need to add a camera back
but what would the camera look at
chicken and egg problem
ok
I will add sponza
and then uh
Gotta get that gltf loading
change things until it's not broken anymore
yeah
none of this toy geometry, straight into sponza, I like it
Might wanna start with Crytek sponza, Intel sponza is gonna be painful to deal with
ok
how are they different?
Crytek Sponza is the "original", Intel sponza is insanely detailed
ok I get 60 fps on crytek sponza and then I try and get 60fps on intel sponza?
Yeah, basically, you will probably need some culling to do intel sponza reasonably
also intel sponza will take longer to load, so it will be a pain to deal with while you are just trying to debug stuff
it takes 2s when done semi properly
60 fps on crytek sponza -> 6 fps on intel sponza 
i've not managed to download intel sponza yet 
its like 5gb 
The blanks were either really good days days or really bad days,
The one in May I took a train from Milano to Rome and back, it was a nice day
Walked around Rome
When I got back I was exhausted and just went to bed and had to fly home the next day
I am going to start with incremental loading that reads bits per frame and shows a progress bar. I can’t have the app freeze while it loads large files anymore. I don’t like that
It’s single threaded still
what if you use std::async to spawn the loading in another thread and have it write its progress to an atomic string or something
Hrm yeah could do that
doing it single threadedly sounds hard to reason about
I'm aware how ironic it is that I'm suggesting multithreading
pinned
I don't like these jpgs
I am going to make a tool to convert these gltfs to binary format, I'm just going to start with vertices, index and normals, then add materials
I am going to gzip that and load the gzip
I don't want to deal with any jpegs so I will convert those to ktx2
I'm going to load sponza at first with just normals as the color
then I'll add materials and textures
yeah there's going to be no fastgltf code in my actual engine I think
I don't think this is a lot of work
if it's not ktx or dds I don't want it
they did textures in jpeg?
some versions of old spoonza yeah
genius 
theres a tga version too
yeah, I remember using targas
i was finking of doing something similar as bjorn wants though
or screw all that, and do demon style development, i dont need to load any arbitrary model from sketchfab, but my own shit i made with blender
I have a custom binary format that has a simple header with a magic word and textures, meshes and stuff like that is serialized to it
it's turbo fast for everything and I don't have to use Assimp or other format importers at all after compiling assets
loading pngs from .png take 50x longer than using my custom binary format
yeah I just want one format for intake for everything
getting just vertices, indicies and normals in should be quick and then I can write a camera
and then go back and add the other stuff
perhaps split your geometry into 2 things
vertexpositions and all the rest
then you don thave to send the whole geometry for things like depth prepass or shadowmapping, where normals/uv/colors might not be needed
for the long haul
