flat assembler
Message board for the users of flat assembler.

Index > Projects and Ideas > CPU Shader Framework

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4403
Location: vpcmpistri
bitRAKE 12 Mar 2026, 20:30
Who can afford a new video card? So, play with shaders on your CPU.

Win32 CPU-shader host for experimenting with image shaders, ray-tracing studies, interactive widgets, text rendering, and scene-reduction POCs.

https://github.com/bitRAKE/C-CPUShader

It isn't meant to be particularly good at anything, but can do many things. Perhaps I'll better align the c-shader language with other shader language(s) - probably not.

There are a number of Proof-of-Concepts (POCs):
- shader logic reused as a standalone tool window
- low-tech fixed-grid SDF text
- more advanced MTSDF text rendering
- Blender-driven scene reconstruction

* this is a tool for programmers - you'll probably need to recompile.

Image

_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.


Last edited by bitRAKE on 14 Mar 2026, 06:51; edited 1 time in total
Post 12 Mar 2026, 20:30
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4403
Location: vpcmpistri
bitRAKE 14 Mar 2026, 00:23
The start of this work was to produce HDR UI through shaders. You might think HDR isn't a big deal but I can see the different now, and so can you if your monitor supports HDR.

The presentation backend was completely re-engineered because HDR support sucks outside of DX. So, although backends exist for DX12, OpenGL, and Vulkan; they all route though DXGI to produce consistent results.

Shader features are expanded: they select the color space and the backend tries to present/capture correctly.

Capture frames to PNG - yes, HDR PNG from shader with alpha.

New sprite capture POC! Yes, write a shader get a sprite.


* Don't trust any performance metrics, yet - kind of on the back-burner.
Post 14 Mar 2026, 00:23
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4403
Location: vpcmpistri
bitRAKE 16 Mar 2026, 02:07
bitRAKE wrote:
The presentation backend was completely re-engineered because HDR support sucks outside of DX. So, although backends exist for DX12, OpenGL, and Vulkan; they all route though DXGI to produce consistent results.
Not totally true. Fixed the Vulkan backend - it's a complete, valid backend for HDR, but it still uses DXGI to validate the capability.

Switched to NMAKE build with LLVM/Clang dependency tracking (insures edits trigger the correct rebuilds). This is to make the modify-build-test loop faster; but that won't really matter in the future.

Expanded the command line (because this is ultimately a scripting tool). Capturing and parametric shaders can all generate assets from scripts. Shader variables are script only for now, but they allow creative variation.

Also, chased down some nasty threading bug that only happened when headless.

_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.
Post 16 Mar 2026, 02:07
View user's profile Send private message Visit poster's website Reply with quote
sylware



Joined: 23 Oct 2020
Posts: 550
Location: Marseille/France
sylware 16 Mar 2026, 11:58
Is HDR just 16bits per color?
Post 16 Mar 2026, 11:58
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4403
Location: vpcmpistri
bitRAKE 16 Mar 2026, 17:04
scRGB (CCCS), DXGI_FORMAT_R16G16B16A16_FLOAT, Linear
HDR10 (ST.2084), DXGI_FORMAT_R10G10B10A2_UNORM, Non-Linear

... are both considered HDR on the presentation side. HDR10 is weird and requires complex color space conversion, but it's closer to what monitors are actually supporting. I still need to make some more color space tests to ensure round-trip works in the different formats.

1.0f is equal to 80 nits in scRGB. So, although it's linear, monitor range matters in color conversion (if we assume component ranges are [0.0,1.0]).

The obvious question to me is: To what extent can conversion be avoided? Can shaders produce the expected color form?

_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.
Post 16 Mar 2026, 17:04
View user's profile Send private message Visit poster's website Reply with quote
sylware



Joined: 23 Oct 2020
Posts: 550
Location: Marseille/France
sylware 16 Mar 2026, 18:56
Then I guess ARGB16161616 is HDR ?
Post 16 Mar 2026, 18:56
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4403
Location: vpcmpistri
bitRAKE 17 Mar 2026, 13:27
At the application layer.

_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.
Post 17 Mar 2026, 13:27
View user's profile Send private message Visit poster's website Reply with quote
sylware



Joined: 23 Oct 2020
Posts: 550
Location: Marseille/France
sylware 18 Mar 2026, 12:10
Well, in my wip wayland compositor, the framebuffer actually scanned out is native ARGB16161616 (no color banding). It seems many apps are currently limited to ARGB8888 (I have to blit/convert on the fly).
Post 18 Mar 2026, 12:10
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4403
Location: vpcmpistri
bitRAKE 18 Mar 2026, 19:29
No monitor actually displays ARGB16161616, though.

For me the better goal is trying to display in a manner that matches the expressiveness of the monitor. The CPU shaders prefer 4 floats because of SIMD.

_________________
¯\(°_o)/¯ AI may [not] have aided with the above reply.
Post 18 Mar 2026, 19:29
View user's profile Send private message Visit poster's website Reply with quote
sylware



Joined: 23 Oct 2020
Posts: 550
Location: Marseille/France
sylware 18 Mar 2026, 23:34
Mine is a 10 years old iiyama 1080p monitor, in 16bits color, I do not get color banding (I did visual tests).
Post 18 Mar 2026, 23:34
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 2724
Furs 19 Mar 2026, 21:30
sylware wrote:
Mine is a 10 years old iiyama 1080p monitor, in 16bits color, I do not get color banding (I did visual tests).
Most monitors do some sort of dithering though, usually time-dithering, since they can't render all those colors.
Post 19 Mar 2026, 21:30
View user's profile Send private message Reply with quote
HSE



Joined: 13 Jan 2019
Posts: 16
HSE 19 Mar 2026, 22:32
Just there is a problem to run GDI Cool


Last edited by HSE on 21 Mar 2026, 22:59; edited 1 time in total
Post 19 Mar 2026, 22:32
View user's profile Send private message Reply with quote
sylware



Joined: 23 Oct 2020
Posts: 550
Location: Marseille/France
sylware 20 Mar 2026, 13:12
Furs wrote:
sylware wrote:
Mine is a 10 years old iiyama 1080p monitor, in 16bits color, I do not get color banding (I did visual tests).
Most monitors do some sort of dithering though, usually time-dithering, since they can't render all those colors.


Then 16bits color encoding is even more appropriate, namely in the worst case scenario it will be done by the monitor hardware.

Could not see any color banding or dithering artifacts with my visual tests with full screen 16bits color gradients, "my noze touching the panel" (10years old panel).
Post 20 Mar 2026, 13:12
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4403
Location: vpcmpistri
bitRAKE 21 Mar 2026, 02:37
I need to research this deeper to verify my current understanding: some cheap monitors don't have a lot of processing hardware and lean on the video card more for color processing. Where in this "extra" processing can software intercept?
Post 21 Mar 2026, 02:37
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2026, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.