Commit Graph

47 Commits

Author SHA1 Message Date
Alex Szpakowski f88eecf482 Allow texel buffers in OpenGL ES, when supported by the system. 2022-01-01 18:06:50 -04:00
Alex Szpakowski fb77e64f61 Allow plain arrays of a base type as shader buffer block declarations. 2021-11-06 16:42:41 -03:00
Alex Szpakowski 63e3bd1823 use 'thread' and 'threadgroup' terminology in compute shader code.
Also fix compute shaders including some rendering-specific code.
2021-08-14 20:42:46 -03:00
Alex Szpakowski a551fcd492 Initial support for writing to textures in compute shaders. 2021-08-13 14:43:03 -03:00
Alex Szpakowski cffd485976 Allow rendering to integer textures. 2021-08-12 17:43:33 -03:00
Alex Szpakowski 48b3a4e860 Initial support for integer format textures.
They can't be rendered to and ImageData can't use the formats, for now.
2021-08-12 16:38:54 -03:00
Alex Szpakowski 4caeb27047 Slightly less heavy-handed compute memory barrier implementation.
Also validate whether there are any unbound writable resources when dispatching compute shader work.
2021-08-11 18:41:38 -03:00
Alex Szpakowski 92d0d1d60f love.graphics.validateShader no longer errors if the system doesn't support the shader 2021-07-18 14:09:28 -03:00
Alex Szpakowski 00494ec3b5 Error if image load/store is used since it's not supported yet. 2021-07-18 13:38:10 -03:00
Alex Szpakowski b644d00bf7 Add a more specific error message when compute shaders aren't supported
It already correctly errored, but the message was generic enough (GLSL 4 support) that it might be confusing.
2021-07-18 13:18:43 -03:00
Alex Szpakowski 80f051b97d Merge pull request #1715 from bjornbytes/compute-shaders
Compute Shaders
2021-07-18 13:09:48 -03:00
bjorn b28e61d00d Shader:getLocalThreadgroupSize; 2021-07-17 19:54:54 -07:00
bjorn 085ba2cb6e Add compute ShaderStage; 2021-07-17 19:46:05 -07:00
bjorn a1c79c45d8 Shader:hasStage; 2021-07-17 19:38:46 -07:00
Alex Szpakowski 433190d1df Merge branch 'master' into 12.0-development 2021-06-06 11:43:54 -03:00
Alex Szpakowski 14cda7818f Rename internal enum 2021-04-07 20:43:22 -03:00
Alex Szpakowski 21f5ba86d3 Merge branch 'master' into 12.0-development 2021-04-07 20:33:44 -03:00
Alex Szpakowski f89aabb0bb Update copyright year for 2021 2021-04-04 16:14:45 -03:00
Alex Szpakowski 694d448e83 Vertex shaders can write to gl_PointSize (fixes #1603).
If a shader uses gl_PointSize then it can only be used when drawing points. If a shader doesn't use gl_PointSize then it can't be used when drawing points.

Added 'ConstantPointSize' and 'CurrentDPIScale' built-in shader uniforms.

ConstantPointSize is in DPI-scaled points, whereas gl_PointSize is in pixels, so to get the correct default behaviour a shader needs to do gl_PointSize = ConstantPointSize * CurrentDPIScale
2021-01-23 13:47:12 -04:00
Alex Szpakowski 50ff86bd92 Graphics Buffers can be used as Shader Storage Buffers. 2021-01-10 17:53:12 -04:00
Alex Szpakowski 0ec7ea73de Improve error message slightly 2020-12-30 11:46:00 -04:00
Alex Szpakowski 2a5a90ccef Add 'vertexmain' and 'pixelmain' shader entry points.
These are low level 'raw' entry points which don't declare any inputs or outputs themselves. They require GLSL 3 to use.
2020-12-27 19:17:47 -04:00
Alex Szpakowski 65bfeedd4e Merge branch 'master' into 12.0-development 2020-12-26 22:48:08 -04:00
Alex Szpakowski 0c7793e195 Fix detection of #pragma language glsl3 in shaders 2020-07-19 15:41:04 -03:00
Alex Szpakowski 2cff535eb1 Move shader parsing code from Lua to C++. 2020-03-03 19:30:22 -04:00
Alex Szpakowski f9248d478c Refactor sampler state parameters for textures. 2020-02-02 22:26:28 -04:00
Alex Szpakowski 5f9b5a21d0 Merge default into minor
--HG--
branch : minor
2020-01-03 22:45:36 -04:00
Alex Szpakowski fc4847c69d Update copyright for the new year 2020-01-03 22:40:36 -04:00
Alex Szpakowski 3435a6bcbf Change the internal constant color from a (per-draw) vertex attribute to a uniform. Pack most built-in uniforms into a single vec4 array and update them all with a single glUniform call.
--HG--
branch : minor
2019-11-18 21:13:54 -04:00
Alex Szpakowski 0752f27bdf Update copyright year for 2019 2019-01-03 21:09:05 -04:00
Bart van Strien e80247c191 Happy new year! 2018-01-03 19:47:35 +01:00
Alex Szpakowski e5b0d96b27 Restructured some Shader code. Added runtime temporary caching and sharing of shader stages. Resolves issue #1235.
--HG--
branch : minor
2017-10-21 03:08:18 -03:00
Alex Szpakowski d338f274ff Update naming convention for builtin shader matrices.
- ClipSpaceFromLocal replaces TransformProjectionMatrix
- ViewSpaceFromLocal replaces TransformMatrix
- ClipSpaceFromView replaces ProjectionMatrix
- ViewNormalFromLocal replaces NormalMatrix

--HG--
branch : minor
2017-07-29 01:25:56 -03:00
Alex Szpakowski 54a049e206 Restructured internal code for graphics capabilities. Added love.graphics.getTextureTypes which returns a table of Texture Type to boolean supported fields.
--HG--
branch : minor
2017-06-27 22:26:30 -03:00
Alex Szpakowski a0ef2ac28b Add Depth compare / shadow sampler support. Officially this is only supported in glsl3 shaders.
- Add Texture:setDepthSampleMode(comparemode). Only works on textures with depth pixel formats. A texture with the depth sample mode set will only work with a depth sampler.
- Add DepthImage, DepthArrayImage, and DepthCubeImage sampler keywords to glsl3.

--HG--
branch : minor
2017-04-12 20:26:06 -03:00
Alex Szpakowski 018a3831cb Add a new “stencil8” pixel format for Canvases (resolves issue #1003).
Also fixed Canvas MSAA (resolves issue #1271).

stencil-formatted Canvases can’t be drawn, and can only be used as the value for a new ‘depthstencil’ field to the table-argument variant of love.graphics.setCanvas.

--HG--
branch : minor
2017-04-11 00:00:22 -03:00
Alex Szpakowski 5ce084051a Fix for gles shader profiles when validating shaders.
--HG--
branch : minor
2017-03-09 19:38:51 -04:00
Alex Szpakowski ceb9cd1c0b Rename internal “GLSLES” references to “ESSL”.
--HG--
branch : minor
2017-03-07 21:03:23 -04:00
Alex Szpakowski 66b299822a Array textures can be easily drawn without a shader (resolves issue #1111).
Added love.graphics.drawLayer(texture, layerindex, …). ‘texture’ must be an array texture.
Added SpriteBatch:add/setLayer.

Added Quad:get/setLayer. This applies to array textures that are drawn without specifying an explicit layer index in the draw call.

Added love.graphics.newQuad variants which have layer arguments.

--HG--
branch : minor
2017-02-26 17:11:22 -04:00
Alex Szpakowski ff8358a979 Removed void effects(…) pixel shader prototype. Added void effect(). Allows calling love.graphics.draw with textures of different types with a custom shader without having an extra sampler2D.
effect() takes no arguments and returns nothing, you are responsible for assigning a value to either love_PixelColor or love_Canvases[n] in the function. You can declare ‘MainTex’, which will be whatever texture is used with any Drawable drawn with love.graphics.draw. You can also declare ‘VaryingColor’ and ‘VaryingTexCoord’, which are passed down from the vertex shader by love automatically. love_PixelCoord is also available.

--HG--
branch : minor
2017-02-25 17:52:27 -04:00
Alex Szpakowski 73fd45558b Implement Array, Cubemap, and Volume texture types (issue #1111).
- Add love.graphics.newArrayImage, newCubeImage, and newVolumeImage.
- Add love.graphics.newCanvas(w, h, layers) and newCanvas(w, h, layers, settings). Add ‘type’ field to the settings table of newCanvas.

- Add new love.graphics.setCanvas variants: setCanvas(canvas, slice), and setCanvas(canvastable) where canvastable is in the format: {{canvas1, layer=2}, {canvas2, face=5}}

- Add Texture:getTextureType, getDepth, getLayerCount, getMipmapCount, and getFormat.

- Remove Image:getData and Image:refresh.
- Add Image:replacePixels(imagedata [, slice] [, mipmap]).

- Update Canvas:newImageData to accept a slice argument.

- Add love.image.newCubeFaces(imagedata).

--HG--
branch : minor
2017-02-20 14:58:13 -04:00
Alex Szpakowski d990044288 love.graphics internal Buffer objects are no longer OpenGL-specific.
--HG--
branch : minor
2017-01-28 19:26:57 -04:00
Alex Szpakowski 470098b7e6 Shader code cleanup
--HG--
branch : minor
2017-01-27 23:19:04 -04:00
Alex Szpakowski 731b5d5cf0 Added support for GLSL 3 shaders (GLSL 3.30 and GLSL ES 3.00).
To use GLSL 3 in a shader, the first line of the shader has to be: #pragma language glsl3

glsl1 is the default language.

Added “glsl3” graphics feature as part of the table returned by love.graphics.getSupported().

Added love.graphics.validateShader(boolean gles, shadercode). It returns a boolean along with an error string if the shader code has errors for its target language and platform (gles or desktop).

Implemented support for Core Profile OpenGL 3.3 in love.graphics.

--HG--
branch : minor
2017-01-22 18:54:04 -04:00
Alex Szpakowski 8899c03651 Add C++ side support for unsigned int shader uniforms. Note that the shader languages love currently supports (glsl 1.20, glsl es 1.00) don’t support uints at the moment.
--HG--
branch : minor
2017-01-02 20:41:07 -04:00
Alex Szpakowski abb72cb813 Happy new year! 🥂
--HG--
branch : minor
2017-01-02 01:28:29 -04:00
Alex Szpakowski f12596dd19 More code restructuring.
Move all love.graphics functionality that doesn’t call OpenGL out of the OpenGL backend Graphics class.

--HG--
branch : minor
2016-12-30 18:36:54 -04:00