Commit Graph

36 Commits

Author SHA1 Message Date
niki f4c38eb00a Revert "vulkan: use push constants for builtin uniforms"
This reverts commit 47e3fc85d2.
2022-09-15 15:55:47 +02:00
niki 47e3fc85d2 vulkan: use push constants for builtin uniforms
when available
2022-09-15 15:17:06 +02:00
niki 7866dde319 vulkan: use sdl to dynamically load vulkan 2022-09-14 13:31:09 +02:00
niki fd951909c0 vulkan: add more optional extensions
VK_KHR_dedicated_allocation, VK_KHR_buffer_device_address,
and VK_EXT_memory_budget can get used by VMA.
VK_KHR_spirv_1_4 can get used by the Shader.

VK_KHR_spirv_1_4 depends on VK_KHR_shader_float_controls.
VK_KHR_dedicated_allocation depends on VK_KHR_get_memory_requirements2
2022-09-11 15:03:40 +02:00
niki ef80e11b4d vulkan: add support for uniform texture arrays 2022-09-11 13:02:38 +02:00
niki 294761713f vulkan: fix bug: incorrect uniform values 2022-09-11 04:20:45 +02:00
niki 1658c89f3d vulkan: add support for custom depth/stencil tex 2022-09-11 01:57:23 +02:00
niki a93d153792 vulkan: adjust code styling 2022-09-10 17:40:46 +02:00
niki 57207606c0 vulkan: implement Shader::getVertexAttributeIndex 2022-09-10 15:27:45 +02:00
niki 9025631231 vulkan: modify descriptor set allocation
Setting the size of each descriptor pool to one
was a hack introduced to make the code work on android.
Changing the code to now allocate all descriptor sets at once
should fix the previous crash.
Not tested yet.
2022-09-09 12:02:30 +02:00
nikeinikei adc02a4939 vulkan: optionally use VK_KHR_PUSH_DESCRIPTOR 2022-09-01 15:01:40 +02:00
niki b28d2df6f8 vulkan: fix crash 2022-08-31 02:35:56 +02:00
niki a0ee9f7b9b vulkan: implement compute shaders
A lot of stuff probably isn't implemented yet, however the
following code already works:

```lua
local shader = love.graphics.newComputeShader [[
    layout (local_size_x = 1, local_size_y = 1) in;

    layout(r32f) uniform highp image2D out_tex;

    uniform float time;

    void computemain() {
        imageStore(out_tex, ivec2(love_GlobalThreadID.xy), vec4(time, 1.0, 1.0, 1.0));
    }
]]

local tex = love.graphics.newTexture(64, 64, {computewrite = true,format = "r32f"})

function love.draw()
    shader:send("out_tex", tex)
    shader:send("time", love.timer.getTime() % 1)
    love.graphics.dispatchThreadgroups(shader, 64, 64, 1)

    love.graphics.print("compute shader test")
    love.graphics.draw(tex, 25, 25)
end
```
2022-08-31 02:07:46 +02:00
niki d123021e26 vulkan: fix canvas rendering (on android)
Before this patch, sometimes rendering a texture
on an android device would result in random things
appearing in the canvas, apart from the stuff
that has been drawn properly.
With these changes this does not seem to appear anymore.
2022-08-29 17:43:54 +02:00
niki 7a67983b3d vulkan: fix some crashes relating to memory mngmt 2022-08-27 17:37:02 +02:00
niki a577be8a6d vulkan: fix a few bugs in Shader 2022-08-23 01:38:47 +02:00
niki 23666b1fde vulkan: fix android build
It compiles now, but it's not working correctly yet
2022-08-20 19:38:59 +02:00
niki be8778b4eb vulkan: remove dep on VK_KHR_push_descriptor
It's not sure if this extension is supported everywhere
This commit uses normal descriptor pools, sets and writes,
which are all availabel in base vulkan.
2022-08-19 16:44:59 +02:00
niki b2771dd111 vulkan: fix cube textures 2022-08-15 00:06:50 +02:00
niki bc0b5f81f5 vulkan: uniforms in custom shaders
things like `uniform float time;` or `uniform sampler2D tex` now work
2022-08-14 22:15:24 +02:00
niki 84df8fee03 vulkan: fix video rendering
When rewriting the shader part rendering videos was broken.
This commit fixes that again.
2022-08-14 20:45:57 +02:00
niki f9ad1842b5 vulkan: first iteration for generic uniforms
Until now we only considered the builtin uniform variables.
This commit attempts to make the code in the vulkan Shader
implementation more general, as to allow for custom uniforms.
This is not possible yet, but should be easier to implement now.
2022-08-14 04:56:20 +02:00
niki fbb64a07af vulkan: partially implement mipmaps
There is no real effect yet when rendering, however debugging the
application with renderdoc reveals that the mipmap generation is
already correct. There's probably something weird going on with the
sampling. I'll have to look into that next.
2022-08-09 00:57:07 +02:00
niki 0ebb34e037 vulkan: avoid usage of general image layout 2022-08-08 22:06:01 +02:00
niki dcea056fcb vulkan: properly implement samplers 2022-08-01 18:51:09 +02:00
niki 845fd16b4b vulkan: dynamically increase size of available memory for uniforms 2022-07-31 03:31:35 +02:00
niki 7bbc042fce vulkan: remove redundant tabs
this makes reading the source files easier
and is more in line with the rest of the löve codebase
2022-07-30 01:16:56 +02:00
niki 94c58e1599 vulkan: fix video rendering 2022-07-30 00:26:49 +02:00
niki 1096b76054 vulkan: fix clean up
We now don't do any more greedy waiting when destroying vulkan objects.
2022-07-29 22:59:15 +02:00
niki 7a3e9ed71e vulkan: fix uniform buffer descriptor
There was a bug where the count of used builtin uniform buffer objects
was not advanced. This caused another problem since vulkan requires
a certain alignment for the buffer. This commit fixes both of those
things.
2022-07-29 21:04:35 +02:00
niki 6d7bd645fc vulkan: use vkCmdClearColorImage to clear texture
using the vulkan functionality probably leads to less bugs.
Until now it was assumed that any image was in the rgba8 format,
which is of course not correct. Clearing a texture to white or black
should now work for any format.
2022-07-24 13:43:48 +02:00
niki fb6457f57d vulkan: move descriptor set logic into Shader
Using the extension VK_KHR_push_descriptor makes the code a lot easier.
Using it makes us able to set set descriptor sets dynamically.
2022-07-19 02:36:02 +02:00
niki 00974b5820 vulkan: move shader compilation into Shader 2022-07-18 22:28:41 +02:00
niki 6916182a79 vulkan: implement getAPIStats 2022-07-16 23:46:03 +02:00
niki 197dfb9738 start implementing vulkan Shader type 2022-02-06 22:56:24 +01:00
niki 65074dae15 hello world triangle 2022-02-04 23:45:58 +01:00