Commit Graph

26 Commits

Author SHA1 Message Date
bjorn 48c0b4c167 Rework Buffer formats;
Summary:

- Buffer length can be zero (indicates single value instead of array)
- Internally, arrays aren't coerced to array-of-single-struct
- Removes support for "flat table" data (array-of-structs w/o wrapping
  each struct in a nested table)
- Use consistent syntax for reading table data into buffers:
  - Numbers are numbers
  - Vectors are numbers, tables, or vectors
  - Structs are tables with any combination of integer/string keys
    - Fields are assigned from integer keys in order, then any remaining
      fields use the string keys
  - Arrays are tables of elements, formatted as above
- Try to improve error messages for Buffer:setData errors
2024-04-17 21:35:54 -07:00
bjorn cdecc1bae7 Add defer system; Rework exceptions; util cleanup;
Defer can be used to clean up resources when an error occurs.
2024-03-29 18:10:22 -07:00
bjorn dc643ad166 Shader:getBufferFormat improvements;
- Returns nil instead of erroring if variable does not exist.
- For runtime-sized arrays, returns nil for length instead of 4 billion.
2024-03-05 09:01:01 -08:00
bjorn 875a7f8237 Shader rework;
- Undeprecate ShaderType (it's good actually, kinda like a pipeline bind
  point and more specific than having lovr trying to make sense of a
  random set of stages).
- Use a default uniform block instead of push constants.  The Constants
  macro now maps to a uniform block declaration.
- It is no longer possible to create a shader by giving a single
  DefaultShader string (you can still give a per-stage DefaultShader
  though).
- lovr.graphics.compileShader now takes all stages instead of a single
  stage.  In general we need all stages when compiling GLSL because
  default uniforms require linking across stages.
2024-02-21 10:21:41 -08:00
bjorn 3cf76c81e7 Refactor shader stages; rm ShaderType;
Goal is to support more combinations of shader stages, both for
vertex-only shaders and mesh/raytracing shaders in the future.  In
general most of the logic that conflated "stage count" with "shader
type" has been changed to look at individual shader stages.
2024-01-05 14:59:19 -08:00
bjorn 860ebbd133 Fix Shader:getBufferFormat; 2023-09-22 20:44:06 -07:00
bjorn 9542d46f33 Buffer format cleanup; 2023-09-11 03:01:11 -07:00
bjorn e9776f98c6 Fix compatibility with Lua 5.2, 5.3, 5.4;
Part of this involved putting the Lua header back in api.h, since we
need to know the Lua version to define some macros properly.
2022-11-24 14:33:55 -08:00
bjorn a2ee485d41 Fix most windows warnings in graphics code;
Co-authored-by: mcc <andi.m.mcclure@gmail.com>
2022-08-06 18:05:30 -07:00
bjorn 642388709b Shader helper improvements; 2022-08-06 13:06:42 -07:00
bjorn 8e89026678 Shader:getLocalWorkgroupSize; 2022-07-09 23:39:03 -07:00
bjorn 8aa14ba42b Shader:hasAttribute; 2022-07-03 23:04:56 -07:00
bjorn 2c339dd944 Shader:hasStage; 2022-07-03 22:59:49 -07:00
bjorn a0db01959d Shader:clone; 2022-05-22 15:10:07 -07:00
bjorn d9e5ba8b9f Slightly broken compileShader/newShader; 2022-05-09 11:47:06 -07:00
bjorn 37221afbc6 rm graphics module; 2022-04-21 17:39:58 -07:00
bjorn e63099ba6a Flatten api.h; 2021-03-15 18:54:27 -06:00
bjorn 8164e0b6e8 TextureData is now named Image!;
The existing Image construct was renamed StorageImage.
2021-02-08 20:17:47 -07:00
bjorn 8c714c45b0 Clean up some includes; 2021-02-08 11:16:00 -07:00
bjorn 51f470cf85 Easier enums; 2020-09-27 17:13:00 -07:00
bjorn e553672b5a Fix sampler uniform error message enum;
Surprisingly, this appears to be the only place reading out of enum
arrays like this, so there shouldn't be any other places to fix.
2020-03-14 16:46:35 -07:00
bjorn 0d098410b3 Shader:send doesn't error on unknown uniform;
Instead it returns a boolean indicating if the send worked.
2020-02-27 20:20:02 -08:00
bjorn 18dcb07b98 Convert stuff over to use new enum system; 2020-02-16 18:31:02 -08:00
bjorn c9c5d43829 Shader:hasBlock; Shader:sendBlock errors on missing block; 2020-01-30 18:26:05 -08:00
bjorn 8c429e89ac Fix -Wshadow; 2020-01-23 11:18:04 -08:00
bjorn c9b1f257bf api: try new file naming convention; Tupfile: cleanup;
I assume full responsibility for any catastrophes this causes.
2019-12-31 19:31:44 -08:00
Renamed from src/api/l_shader.c (Browse further)