Better HN
topnewbestaskshowjobs
Log inSign up

asdftway1

18 karma · joined Nov 12, 2021 (5y ago) · 3 submissions

Submissions

comment 5y ago · link · parent

So there are two separate "pre-compile" steps with Vulkan: #1. Compiling shader source code to SPIR-V bytecode; #2. compiling SPIR-V bytecode to native GPU shader instructions. #2 is always done at runtime (though the vendor driver may silently use a cached previous run result), and yes, it is possible to do it async. But like you speculated, you have to figure out something for the user to do while this async compilation happens. In an open world 3D game this adds considerable complexity. If your hero is approaching the Ice Cave of Wonders you need to smoothly preload your fancy ice shaders before the cave mouth is in sight and this preload shouldn't make the current framerate drop. In simpler times past with simpler shaders (like OpenGL 2.1 / ES 2.0 GLSL) you could compile shaders from source in perhaps a single 1/60th second frame.

It's funny how 1980s Nintendo cartridges loaded instantly but now that we have hardware at least 10 million times faster we have long load times for games.

comment 5y ago · link · parent

> Which to me implies the Vulkan API is so simple, and close to metal, that it doesn't differ between implementations

As someone with 20 years 3D programming experience including paid work in DirectX and OpenGL ES 2.0, I attempted vulkantutorial.com but gave up because it is too hard. It really is 1000 lines of C/C++ to even get a flat shaded triangle on screen. Vulkan has validation layers to help with writing conformant portable code, but the validation layers are written by your GPU manufacturer and so you can get things that pass on an Intel GPU but fail on nVidia. If you've ever tried porting your "portable" ISO C++ code that works with GCC over to Visual C++ and dealt with 1000s of lines of compiler errors it's kinda the same thing. Vulkan has shaders that precompile to "portable" bytecode but I also noticed that the time delay of loading these "precompiled" bytecode shaders was instant on one Intel GPU but took about 5 seconds on an nVidia GPU. The nVidia driver then cached the results (I know not where) so that subsequent runs were faster, but the cache can be invalidated by either a driver update or a shader update, so your game level loader will need an "ifShaderLoadingSlowerThanMolasses() {...}" code path to deal with your users experiencing slow load times after a video card driver update, etc.

Summary: in ages past it was possible for mere mortals to write visualizations and simple games directly in OpenGL/DirectX, but with Vulkan most of us will need a middleware layer on top of it to get anything done within a deadline. If you want an open source portable solution I instead recommend Godot. If you want to make a 3D game that makes millions of dollars with less than 3 years of development and can deploy to Nintendos and Playstations with a button click I recommend Unreal Engine or Unity.

comment 5y ago · link · parent

Slippery wet leaves on bicycle/pedestrian paths are also a health hazard. Had an ugly spill once trying to turn my bicycle on a path with wet leaves, the front tire turned in the direction I wanted but kept sliding straight ahead.

Wet leaves don't help automobile traction, either, but at least no one seems to be calling for banning diesel-fume belching street sweeping trucks. Enlightened journalists are only calling for effectively banning economical leaf removal of narrower pathways used by pedestrians and bicyclists.