Commit Graph

72 Commits

Author SHA1 Message Date
Sasha Szpakowski d185eb8218 vulkan: fix validation errors when generating mipmaps for a compute-writable texture. 2024-09-27 19:50:11 -03:00
Sasha Szpakowski 8e2fc44a65 vulkan: fix texture<->buffer copying when there's an offset into the texture 2024-08-13 18:02:30 -03:00
Sasha Szpakowski 9b362dbef9 vulkan: narrow layout transitions to used mips/layers in a couple situations. 2024-07-21 17:12:38 -03:00
Sasha Szpakowski 304bf8bb83 metal: fix texture memory tracking 2024-07-16 17:44:58 -03:00
Sasha Szpakowski 9473c8d710 vulkan: fix validation error when creating a non-square array texture. 2024-05-05 09:40:28 -03:00
Sasha Szpakowski 1692573be6 vulkan: fix image layout mismatches when generating mipmaps and when copying from a buffer. 2024-04-07 09:13:21 -03:00
Sasha Szpakowski 44a6a81641 vulkan: improve depth/stencil texture support. 2024-03-31 17:56:36 -03:00
Sasha Szpakowski 6ac3c5f990 vulkan: fix one validation error when sending a depth-stencil texture to a shader. 2024-03-31 16:48:12 -03:00
Sasha Szpakowski 302da1b3af vulkan: potentially fix validation errors when creating a cubemap canvas. 2024-03-28 19:06:42 -03:00
Sasha Szpakowski b33afc4371 vulkan: love.graphics.clear fixes.
- Fix love.graphics.clear(color) when multiple canvases are active.
- Fix love.graphics.clear when an integer-format canvas is active.
2024-03-28 19:00:29 -03:00
Sasha Szpakowski bbaa55f8b8 vulkan: fix validation errors in layout transitions for depth-only and stencil-only images. 2024-03-21 21:32:03 -03:00
Sasha Szpakowski b08f35d341 vulkan: only set cubemap compatibility for array textures with >= 6 layers. 2024-03-09 16:01:26 -04:00
Sasha Szpakowski e20f018272 Change the 'viewformats' texture setting field to be a list of pixel formats.
Replace Texture:hasViewFormats with Texture:getViewFormats.
2024-02-24 23:42:28 -04:00
Sasha Szpakowski 42812ad521 Add texture views. Fixes #2022.
Add love.graphics.newTextureView(basetexture, viewsettings). Requires GLSL4 support.
Add 'viewformats' boolean setting to texture setting tables.
Add Texture:hasViewFormats.

The viewsettings table has the following fields:
  format = nil, -- set this to a pixel format to override the base format. It must have the same number of bytes per pixel as the original, and the 'viewformats' setting on the original texture must be true for this to work. Cannot be used for compressed or depth/stencil textures.
  type = nil, -- set this to a texture type to override the base texture type. 2d base textures can make [2d, array] views. [array, cube] base textures can make [2d, array, cube] views.
  mipmapstart = nil, -- set to a number to use a less detailed mipmap level as a base.
  mipmapcount = nil, -- set to a number to override the number of mipmaps in the texture view.
  layerstart = nil, -- set to a number to use a specific layer or cube face as a base.
  layers = nil, -- set to a number to override the number of layers in an array texture view.
2024-02-24 15:45:43 -04:00
Sasha Szpakowski d880c48502 Clean up some internal texture data upload parameters. 2024-02-17 14:10:38 -04:00
Sasha Szpakowski 64a30f177f Merge branch 'main' into 12.0-development 2024-02-10 12:24:48 -04:00
niki c8da517759 don't use optional for debugName 2023-12-14 00:42:19 +01:00
niki 7a25dfa7fc add texture:getDebugName and buffer:getDebugName 2023-12-14 00:09:08 +01:00
niki a5d7ba1589 implement #1992
add debugname to settings table for texture and buffer,
which can be used for debugging in e.g. RenderDoc.
2023-12-13 14:28:34 +01:00
Sasha Szpakowski 20ffe94349 vulkan: fix a consistency issue with texture samplers 2023-11-15 23:15:27 -04:00
Sasha Szpakowski 343d192f10 Compressed texture formats have explicit sRGB variants 2023-10-14 15:01:01 -03:00
Sasha Szpakowski 86eb6df05c vulkan: don't hold onto ImageData references after loading an image.
Reduces CPU memory usage.
2023-10-09 20:22:04 -03:00
Sasha Szpakowski cf26e39d1b vulkan: potential fix for compressed textures with mipmaps 2023-10-09 13:13:37 -03:00
Sasha Szpakowski f6cdbdc868 Merge branch 'main' into 12.0-development 2022-12-31 22:46:34 -04:00
slime b9da6d6ddc vulkan: always use optimal image tiling.
Linear is useful for intermediate texture copy steps between the CPU and GPU, but we use buffers instead of textures for that.
2022-09-25 22:05:18 -03:00
slime 1b89de4497 vulkan: clean up texture creation flags 2022-09-22 22:20:42 -03:00
slime 2b074fe90e vulkan: improve sRGB support for textures 2022-09-20 19:04:56 -03:00
niki eaa043c3ff vulkan: report approximate used texture memory 2022-09-20 12:36:56 +02:00
niki 58c801be58 vulkan: fix incorrect samplers 2022-09-19 19:51:48 +02:00
niki ba759f5bc0 vulkan: use SamplerState::toKey for caching 2022-09-19 14:23:46 +02:00
niki 87c9b74c8e vulkan: fix linux build attempt 5 2022-09-18 22:00:28 +02:00
niki cf099946a1 vulkan: fix depth stencil textures 2022-09-18 00:18:32 +02:00
niki e128f3453e vulkan: implement compressed textures 2022-09-17 20:32:34 +02:00
niki aec9e201f5 vulkan: implement volume textures 2022-09-16 13:49:31 +02:00
niki 4e59b563a4 vulkan: implement texture msaa 2022-09-14 14:15:57 +02:00
niki 726cd147c8 vulkan: render targets with mip and slice 2022-09-14 13:48:13 +02:00
niki 1658c89f3d vulkan: add support for custom depth/stencil tex 2022-09-11 01:57:23 +02:00
niki 816e3f01a2 vulkan: correctly order gpu commands 2022-09-10 19:21:31 +02:00
niki a93d153792 vulkan: adjust code styling 2022-09-10 17:40:46 +02:00
nikeinikei 502c1e83ab vulkan: more reserved usage flags of texture 2022-09-01 16:10:10 +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 ec5a3a50f9 vulkan: implement graphics readback 2022-08-30 17:11:59 +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 748f2676d5 vulkan: fix mip maps 2022-08-27 22:20:33 +02:00
niki b2771dd111 vulkan: fix cube textures 2022-08-15 00:06:50 +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 c51b12a177 vulkan: make api design more senseful 2022-08-08 21:36:43 +02:00
niki dcea056fcb vulkan: properly implement samplers 2022-08-01 18:51:09 +02:00
niki 224b9e84f0 vulkan: add support for 2d array textures 2022-08-01 15:53:31 +02:00