The C4255 warning in MSVC complains about function lacking explicit list
of arguments (`f()` instead of `f(void)`). Disabling this warning allows
joltc to build on windows platform.
The current implementation might spin forever if only one thread is
starting/waiting on jobs, since nothing will be waiting on the jobs
(i.e. freeing up queue slots) while spinning.
The correct thing to do is to return NULL and let the caller handle
backpressure. It's a bit more annoying to program since you might not
get a job back and need to handle it, but it's the right thing to do.
Shader == NULL wasn't clearing the dirty uniform flag, so if the
uniforms were dirty when you set a default shader we would try to
allocate and bind a zero-size uniform buffer.
Instead, let's avoid making a new uniform buffer if the shader doesn't
have any uniforms!
- Jobs can now throw exceptions using job_abort. This will store an
error message on the job and immediately stop the job. The method
will never return. It must be called from the worker thread running
the job, so in practice it should only be called by the job function.
- After waiting for the job to complete or abort using job_wait, the
error message can be checked using job_get_error. This is the raw
pointer passed to job_abort, caller is responsible for freeing it or
doing whatever necessary cleanup is required.
- job_free must be used to recycle the job after waiting on it.
Yes it uses longjmp.
There's also some general cleanup, and job_start just does random jobs
when the queue is full instead of returning NULL.
- You can nest texture views (make a view of a view).
- You can do transfers on views (copies, clears, blits, etc.).
- You can give labels to views.
- API changes
- Rename Texture:newView to lovr.graphics.newTextureView.
- Constructor takes a table of options (order was too confusing).
- Remove Texture:isView/getParent, since views can be used for everything now.
- Better matches what LÖVE ended up doing.
- Fix bug where :getType on a view returned parent type.
Previously, when switching shaders, resource bindings would be preserved
for resources with matching slots/types. This doesn't make sense in a
world where binding numbers are internal. Instead, match up resources
by name/type.
Additionally, rewire all the uniforms by name/size so uniforms with the
same name get preserved (name/type would be too hard for e.g. structs).
This seems like it would be horribly slow and may need to be optimized,
optional, or removed.
I didn't test any of this lol, but I will I promise.
The vertex-only shader requires too much juggling of shader stage flags
and pipeline layout compatibility when e.g. binding push constants and
descriptor sets.
This is a little slower, but means indirect draws can use Transform and Color.
There are other solutions for this. For example LÖVR could reserve
BaseInstance and use a compute shader to rewrite indirect buffers.
For now we choose to be correct and a little slower.
- 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.