[prospect]Can vulkan be the basic resolution for Krita Gpu Compute future?

https://github.com/KomputeProject/kompute
https://github.leikaifeng.workers.dev/shuwang1/Example_1_Vulkan

I can’t say how many promotions it will bring, but it seems that we always expect gpu compute saves performance

3 Likes

‘Em……maybe we can talk about what gpu can optimize?I was surprised that nobody was interested.

Welcome to the club. Krita + GLSL - A viable way for Krita to use the GPU?

Also, until this moment what I know is this: When Krita eventually goes to Qt 6 the dev team pretends to port the ANGLE layer (it is a library that convert OpenGL to DirectX) and OpenGL into it. Because Qt 6 don’t have support for OpenGL, only Vulkan.

The problem is, as always, to get the pixel data to GPU memory and out of it. Or store all of it in GPU memory indefinitely, but then layer and image sizes will be limited. We’ve been discussing this well over fifteen years and have gone through a lot of experiments already. It’s not like we’re not aware of it…

An additional problem is that various GPU’s and drivers actually produce slightly different results using the same shaders, and that’s of course a big problem.

As for Daishishi’s remarks – I guess the misuse of “pretend” is just the result of English-as-a-second-language and not meant as an insult. But Qt6 doesn’t only have support for Vulkan, it has its own GPU abstraction layer, which, however, is not meant to be used by applications. The one thing that happened is that the Qt project removed the Angle build option from Qt, and we probably will have to put that back, since OpenGL drivers on Windows and macOS are detoriating and we want to keep our existing OpenGL canvas code working.

6 Likes

Will only using gpu simd improve performance? Of cause get pixel data temporary

I don’t know how to use that but it seems to be deterministic.

Vulkan SC

You’re 100% correct. :rofl: My first language is Portuguese and I fell victim for a false friend.
In Portuguese Pretender means: To plan, intent, wants.
Sorry for the confusion Halla and all others devs.

As for my remarks my idea was the ‘usefuness’ of shaders applied to the final (composed) image. Not a shader per layer but over the image being displayed in the canvas. This would bypass the Ram ↔ VRam limitation, as far as I understand.
However I doubt how useful this would truly be. A filter over the entire canvas.

Not to mention the problem Halla raise about inconsistencies using different GPUs and drivers.

Cheers

2 Likes

We already do something like that if OCIO is enabled: that does the color correction for the rendered image using shaders.

At the time the idea come to me while learning Godot Shaders. I thought about the halftone filter per example, being used as a shader over the image, instead of a layer filter. The use of a mask could even limit the area of influence of each shader (if multiple would be used).

However I can only imagine the nightmare it would be the relation between the layer stack, a shader over the rendered image and what the user expected to see

2 Likes

I think this would be interesting as a non-destructive layer that you could bake down to an image.

Thought being:

Add a GLSL script layer that gives access to input colour and vec2 coordinates, and drop it as a non-destructive layer.

Stack a few, apply different transforms/pixel remappings. Like a view transform layer, but allow it to be rendered down to a new image layer (transfer data back to CPU. This would give realtime convolution adjustments through uniforms, even the possibility of constructing a voxelization of current pixel data through raymarching or anything else you can pack into a fragment)

An example of this would be a recursive pixelate/extrude. This is something that’s very slow in photoshop but would be quick with a few layers of GLSL. If it could be a non-destructive layer you could tweak the uniforms of each layer in realtime and bake the output down to CPU when you’re happy with it.

Willing to admit this is possibly beyond the scope of what Krita is trying to do, but I find the idea really interesting. Would also open up some very creative and unique brushes as has been suggested in other posts on this forum (2D fluid simulation for brush paint flow comes to mind immediately, being able to paint a decimation and extrude selectively while feeding in tablet pen angle information as uniforms)

Just some brainstorming, I don’t see why Vulkan would be required necessarily for any of this. Can be done in frags or gl4 compute if absolutely required.

2 Likes

Check out shadertoy.com for a wide assortment of amazing shaders. There are ULTRA FAST liquefy effects, waveform visualizers for rendering audio waves, generative masks and models and even fully animated 3D scenes and fractals. You could also let the users define their own shaders and blend modes. Making the leap to OpenGL would revolutionize Krita. Drastic speed improvements in basic brushes are more than worth the confusion of swapping back and forth between GPU textures and CPU vectors.