Commit Graph

2121 Commits

Author SHA1 Message Date
Sasha Szpakowski ed6a50178c Filled polygons have texture coordinates computed from their bounds.
Fixes #1951.
2024-02-25 20:09:06 -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 007090af14 ImageData: remove automatic mutex locks. 2024-02-18 17:06:40 -04:00
Sasha Szpakowski d880c48502 Clean up some internal texture data upload parameters. 2024-02-17 14:10:38 -04:00
Sasha Szpakowski 81d0c720a2 Fix compressed texture uploads using the wrong pixel format. 2024-02-17 14:00:31 -04:00
Sasha Szpakowski 25e008e20c metal: remove a redundant memcpy when uploading pixels to a texture. 2024-02-10 23:17:10 -04:00
Sasha Szpakowski 64a30f177f Merge branch 'main' into 12.0-development 2024-02-10 12:24:48 -04:00
Sasha Szpakowski 94d5864144 update year for copyright notice 2024-02-10 12:13:22 -04:00
Sasha Szpakowski bf6a6f1237 metal: error when generated SPIR-V shader IR can't be parsed 2024-01-09 21:29:54 -04:00
Sasha Szpakowski 7ff6f74a92 metal: improve shader resource binding code. 2024-01-09 21:11:04 -04:00
Sasha Szpakowski fb002ee59b opengl: fixes for default storage buffer bindings. 2024-01-09 21:10:20 -04:00
Sasha Szpakowski 8bf04df6e1 Fix uninitialized pointers leading to crashes 2024-01-08 22:31:06 -04:00
Sasha Szpakowski 3e8345280f Move default texel and shader storage buffers to high level code. 2024-01-08 22:13:47 -04:00
Sasha Szpakowski ecd9b007aa Fix building vulkan Shader.cpp 2024-01-07 22:00:50 -04:00
Sasha Szpakowski a99d5afc57 update glslang 2024-01-07 21:14:01 -04:00
Sasha Szpakowski 501c41e10f Fix compiler warning 2024-01-06 15:44:39 -04:00
Sasha Szpakowski 131b6c51e0 graphics: fix recursion when creating a default texture. 2024-01-06 15:22:02 -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 621a7547d2 metal: tweak initial internal uniform buffer size 2024-01-05 20:37:49 -04:00
Sasha Szpakowski 04462ece30 graphics: clean up some stencil code 2024-01-04 21:35:52 -04:00
Sasha Szpakowski 404b2f2c4e address VS compiler suggestion about constexpr 2024-01-04 21:35:18 -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 77c5ea1d6b graphics: move buffer:clear error checking to high level code 2024-01-02 11:13:31 -04:00
Sasha Szpakowski af840bb2cf metal: texel buffers align their size according to device requirements 2024-01-01 16:12:24 -04:00
Sasha Szpakowski 0523aa6f8f metal: check for depth compare mode support before setting it on a texture. 2024-01-01 15:41:31 -04:00
Sasha Szpakowski 9b537ede2b Fix out of bounds memory access in Buffer:setArrayData with matrices.
Issue #1986
2023-12-31 16:32:12 -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
Sasha Szpakowski e42019c59e Add buffer stats to love.graphics.getStats.
- Add 'buffers' field, to count the total number of graphics buffer objects.
- Add 'buffermemory' field, to estimate the total number of bytes of graphics memory used by all buffers.
2023-12-25 23:25:46 +01:00
Sasha Szpakowski 9c6417776f metal: remove unneeded TODO 2023-12-25 23:24:07 +01:00
Ralty 1f8e3551aa Update wrap_Graphics.lua 2023-12-24 17:28:27 +07:00
Ralty b7362200c8 Fix deprecated love.graphics.stencil resetting stencilMode 2023-12-24 17:26:58 +07:00
Sasha Szpakowski eb552dfcb6 Fix compile warning 2023-12-23 16:54:00 +01:00
Sasha Szpakowski 059cab0364 metal: implement buffer/texture debug names. 2023-12-13 20:27:58 -04:00
Sasha Szpakowski 7b899fbc17 opengl: add version checks when setting debug names. 2023-12-13 20:27:31 -04:00
niki c8da517759 don't use optional for debugName 2023-12-14 00:42:19 +01:00
niki 364b5c3b7b adjust code styling 2023-12-14 00:16:38 +01:00
niki 7a25dfa7fc add texture:getDebugName and buffer:getDebugName 2023-12-14 00:09:08 +01:00
niki 834398335d fix buffer debugname is optional 2023-12-13 16:03:22 +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 910533edda Initial code for sending flat-array matrices to storage buffers (untested). 2023-11-24 14:12:47 -04:00
Sasha Szpakowski 20ffe94349 vulkan: fix a consistency issue with texture samplers 2023-11-15 23:15:27 -04:00
Sasha Szpakowski 17362b6844 Restore no-parameter variant of love.graphics.setColorMask. 2023-10-30 18:55:26 -03:00
Sasha Szpakowski 5a0a6a1a27 All constructors for making a TrueType font take an optional settings table.
This supersedes the existing optional hinting and dpi scale parameters. The table's fields are:
{
  hinting = "normal",
  dpiscale = 1, -- nil will default to the current window DPI scale.
}
2023-10-20 20:19:30 -03:00
Sasha Szpakowski 8c13943f64 ImageData can track whether they're meant to be loaded into a Texture with a non-sRGB format when gamma correct rendering is enabled.
Fixes #1556.

* Add ImageData/CompressedImageData:setLinear and ImageData/CompressedImageData:isLinear.
  The flag is used as a hint when loading a texture from the data to determine if the format should not be treated as sRGB-encoded. The 'linear' flag in newImage overrides this.

* love.graphics.readbackTexture automatically sets the linear flag on ImageData it returns when the texture's format is linear.
  This allows an ImageData generated via readback to be fed back into a new Texture and the format will match the original Canvas.

* Also clean up some image decoding code.
2023-10-14 20:48:21 -03:00
Sasha Szpakowski bd55100d56 metal: fix compile error 2023-10-14 15:02:28 -03:00
Sasha Szpakowski 343d192f10 Compressed texture formats have explicit sRGB variants 2023-10-14 15:01:01 -03:00
Sasha Szpakowski 9eec1754e7 opengl: fix clearing the depth buffer. 2023-10-14 10:30:51 -03:00