thespydog / sdl_gpu_examples Goto Github PK
View Code? Open in Web Editor NEWWIP example collection for the SDL_Gpu API proposal
WIP example collection for the SDL_Gpu API proposal
It seems a bit strange in this code snippet:
if (SDL_GpuGetDriver(device) == SDL_GPU_DRIVER_VULKAN)
{
shader = SDL_GpuCreateShader(device, &shaderInfo);
}
else
{
shader = SDL_CompileFromSPIRV(device, &shaderInfo, SDL_FALSE);
}
It seems the design intent of these examples is to load up the SPIR-V blobs and cross compile them. This would make shipping the SPIR-V blobs a cross-platform shader solution. Is this correct? If so, why should I, as a user, need to ever call SDL_GpuCreateShader, unless I write a platform-dependent shader? Even if I'm targeting Vulkan, can I not just also call SDL_CompileFromSPIRV?
There are now examples in the main SDL repo, so let's move to that system so it can get merged along with the API!
For example, ClearScreen.c could probably be 01-clearscreen.c, and we can organize the rest to either be good for a learning resource or for porting to a new target.
First of all, this is fantastic work.
On my machine, the ComputeSpriteBatch is the only one failing: nothing shows up, and instead it's a flow of error logs:
WARN: Failed to recreate swapchain!
ERROR: Device does not support requested present mode!
I am on Ubuntu Linux 24.04, with a AMD Radeon 5700XT, a decent GPU:
INFO: Welcome to the SDL_Gpu example suite!
INFO: Press A/D to move between examples!
INFO: STARTING EXAMPLE: ClearScreen
INFO: Validation layers enabled, expect debug level performance!
INFO: SDL_Gpu Driver: Vulkan
INFO: Vulkan Device: AMD Radeon RX 5700 XT (RADV NAVI10)
INFO: Vulkan Driver: radv Mesa 24.0.5-1ubuntu1
INFO: Vulkan Conformance: 1.2.1
All other examples work as expected.
ComputeSpriteBatch seems to be using SDL_GPU_PRESENTMODE_IMMEDIATE.
Many other Vulkan apps do work as expected on my workstation, not sure which presentation mode they do use.
I can try on a Windows machine with different GPU on Monday.
We're using stb for PNG but for official examples we can settle with BMP since the files are very tiny!
Cycling transfer buffers isn't as trivial as GPU buffers on the library side, but it should be easy for the app side - we should demonstrate this to avoid having to cobble together host-memory cycling in SDL.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.