Commit Graph

169 Commits

Author SHA1 Message Date
Erin Maus f7a7086604 Don't draw if not all writable images and/or buffers are set. 2026-07-29 15:11:09 -04:00
Erin Maus 7d09352e94 Relax storage restrictions on vertex/pixel shaders. 2026-07-23 06:22:48 -04:00
Sasha Szpakowski 2dacd058f4 allow vulkan backend even when wireframe or anisotropic filtering aren't supported.
Related: #2335.
2026-07-18 17:14:38 -03:00
Sasha Szpakowski 540e681454 vulkan: fix validation errors when VK_EXT_full_screen_exclusive is used 2026-07-05 11:11:19 -03:00
Sasha Szpakowski 4758d54af6 vulkan: handle swap chain surface loss errors. 2026-07-05 10:50:22 -03:00
Sasha Szpakowski 84fe074d06 vulkan+windows: tell the driver we don't want exclusive fullscreen, when in desktop-fullscreen mode. 2026-06-21 21:32:35 -03:00
Sasha Szpakowski 142ce87335 graphics: improve setScissor's handling of fractional DPI-scaled coordinates. 2026-06-21 14:58:22 -03:00
Sasha Szpakowski 8884fb3f10 graphics: clean up some shared backbuffer settings code. 2026-06-14 19:31:40 -03:00
niki 1a1265d646 fix validation warnings relating to swapchain
for more information: https://docs.vulkan.org/guide/latest/swapchain_semaphore_reuse.html
2026-03-23 22:38:14 +01:00
John Doe fc5eeb11a3 Fix copyright notice date 2026-01-21 18:49:11 +00:00
John Doe 6f08eb94c6 Update copyright notice with correct year 2025-07-12 23:19:22 +01:00
Sasha Szpakowski ae2e68f414 vulkan: populate oldSwapchain field during swap chain creation. Also fix crash if window is already closed, when quitting.
Fixes #2174
2025-04-07 20:56:22 -03:00
Sasha Szpakowski cc88b94ac4 vulkan: pick the first device with the highest score when multiple have the same score. 2025-02-02 10:57:22 -04:00
Sasha Szpakowski 25a2753b72 vulkan: fix 1 frame delay of backbuffer resize
Fixes #2128.
2025-02-01 17:08:33 -04:00
Sasha Szpakowski 92e79ab609 vulkan: reduce memory usage when many shaders are being used with many draw calls.
Descriptor pools are now shared among shaders that have the same descriptor counts, instead of being unique per shader.
2025-01-26 14:45:51 -04:00
Sasha Szpakowski 652b012b02 vulkan: improve module initialization code to exit to other backends if there's a device but it's not suitable for love.
Disallow software rendering (CPU devices) with vulkan by default. The environment variable LOVE_GRAPHICS_VULKAN_ALLOW_SOFTWARE can be set to 1 to override that behaviour.
2025-01-11 14:55:23 -04:00
Sasha Szpakowski b87aed937c vulkan: clean up framebuffers when textures they reference are deleted
Fixes corruption/crashing in some situations if a new texture's image view has the same pointer as a previously deleted texture's image view.
2024-12-20 23:37:06 -04:00
Sasha Szpakowski fe4fc84659 vulkan: implement MSAA textures. 2024-12-01 14:23:13 -04:00
Sasha Szpakowski eeec2429e2 vulkan: use subpass dependencies for layout transitions when switching canvases. 2024-09-30 23:04:58 -03:00
Sasha Szpakowski 1ee89154c0 vulkan: memory barrier after compute dispatches. 2024-09-30 19:58:45 -03:00
Sasha Szpakowski 50ff1e4d2b use location numbers for vertex input attributes, instead of name-based binding.
- add 'location' named field to buffer and mesh vertex format tables, replaces 'name' field.
- location numbers are expected to match 'layout (location = #)' qualifiers in vertex inputs in shader code.
- deprecate vertex inputs in shader code that don't have layout location qualifiers.
- love's default vertex attributes use location 0 for position, 1 for texcoord, and 2 for color.
- add new variants of Mesh:attachAttribute, setAttributeEnabled, and isAttributeEnabled which take location numbers instead of names.

Improves draw performance in vulkan and metal backends.
2024-09-07 18:06:03 -03:00
Sasha Szpakowski 654585ccc2 vulkan: don't try to enable blending with integer canvases. 2024-08-14 21:00:24 -03:00
Sasha Szpakowski b16e1d6e27 vulkan: don't periodically clean up render pass objects.
It's not needed.
2024-06-24 18:41:52 -03:00
Sasha Szpakowski 35f20eb053 vulkan: move cached PSO ownership to shaders.
Fixes issues with state corruption when a shader is created with the same memory address as a recently deleted shader.
2024-06-24 18:31:34 -03:00
Sasha Szpakowski a894c2f6a4 vulkan: fix validation errors related to scissors when drawing. 2024-05-03 20:24:25 -03:00
Sasha Szpakowski 8140817107 vulkan: fix a crash on minimization.
Use a fake backbuffer when the system reports 0 for swap chain dimensions.
2024-04-07 17:25:46 -03:00
Sasha Szpakowski 2bc9777c3b vulkan: limit render pass layout transitions to the active mipmap/layer. 2024-04-07 09:48:54 -03:00
Sasha Szpakowski 44a6a81641 vulkan: improve depth/stencil texture support. 2024-03-31 17:56:36 -03:00
Sasha Szpakowski a0ca3c148e vulkan: improve handling of vertex attribute bindings. 2024-03-31 12:55:40 -03:00
Sasha Szpakowski d82922f774 vulkan: let the system handle device rotation for us.
We'd need to inject a whole bunch of code into user shaders (for example to rotate derivates) if we wanted to reliably handle it ourselves, which isn't viable.
2024-03-27 20:00:05 -03:00
Sasha Szpakowski 7bfbd647ba Make shader clip space consistent across APIs and projection matrices.
- All shaders are expected to output clip space values that are effectively y-up, with [-1, 1] z, in NDC.
- The transform to a backend's expected clip space values from the above range now happens after user vertex shader code is run, instead of inside a projection matrix.
- Projection matrices no longer need to be flipped when rendering to a canvas versus the main screen.

This means custom projection matrices might need to be altered to account for the more consistent range.
2024-03-23 22:00:02 -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 60911c5181 vulkan: remove some newly dead code 2024-03-17 00:01:10 -03:00
Sasha Szpakowski 48aefd91fa vulkan: captureScreenshot improvements.
- Don't create several persistent screen-sized images and buffers for screenshots, only create one temporary buffer during a frame that requests a screenshot.
- Attempt to handle more out-of-memory situations.
- Make sure the final screenshot is opaque.
- Swap R and B channels in the screenshot ImageData when the backbuffer is BGRA.
2024-03-16 23:51:40 -03:00
niki 54f27a8277 vulkan: unify local uniform buffer 2024-03-10 14:41:37 +01:00
Sasha Szpakowski 32e777c156 vulkan: fix a crash. 2024-03-05 23:03:55 -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 1e97e09b28 Rework internal module registration to happen in constructors. 2024-02-24 15:21:38 -04:00
Sasha Szpakowski 64a30f177f Merge branch 'main' into 12.0-development 2024-02-10 12:24:48 -04:00
Sasha Szpakowski aaab9791d5 Improve backbuffer depth buffer.
- Setting the depth buffer for the backbuffer is now done as a boolean instead of a bit depth integer, in love.conf or love.window.setMode.
- Error if depth writes are enabled when the active canvas setup or backbuffer does not have a depth buffer (now it matches stencil behaviour).
- Don't allocate a backbuffer depth-stencil buffer if they're not requested. Metal also determines the format for that buffer based on which combination of depth and stencil is requested. OpenGL still has to allocate the depth-stencil buffer for the backbuffer all the time, because changing it requires the context to be recreated.
2024-01-06 15:21:06 -04:00
Sasha Szpakowski 04462ece30 graphics: clean up some stencil code 2024-01-04 21:35:52 -04:00
Sasha Szpakowski 9b5851e039 Move current love.graphics.setStencilMode functionality to setStencilState.
Add new higher level love.graphics.setStencilMode function.
- Add love.graphics.setStencilMode(mode [, value = 1])
- Add love.graphics.setStencilMode().
- Add mode, value = love.graphics.getStencilMode().

The possible modes are "off" (same as no parameters), "draw", and "test".
The "draw" mode disables color writes and sets the stencil state to ("replace", "always") using the given value.
The "test" mode enables color writes and sets the stencil state to ("keep", "equal") using the given value to compare to.
2024-01-04 16:23:49 -04:00
Sasha Szpakowski dbcdbc47d5 Add debugname field to shader options table. 2023-12-29 16:51:24 +01:00
Sasha Szpakowski 8872497561 graphics: handle default textures in high level code.
Previously each backend had to set up default textures with its own code, which needs some care for it to be robust.
2023-12-27 21:28:02 +01:00
niki 364b5c3b7b adjust code styling 2023-12-14 00:16:38 +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 343d192f10 Compressed texture formats have explicit sRGB variants 2023-10-14 15:01:01 -03:00
Sasha Szpakowski 983ea6c0e6 Remove explicit support for systems that don't support rgba8 canvases.
This is just a very small number of really old OpenGL ES 2 drivers.
2023-10-13 21:53:45 -03:00
niki 8f8afe3de5 vulkan: fix crash when using love.window.close() 2023-10-09 15:31:23 +02:00