Mikko Rasa [Sat, 9 Apr 2022 13:22:21 +0000 (16:22 +0300)]
Fix GLSL test cases so they pass the basic tests
Some changes had changed the compiler output, particularly acd7bb6 adding
an extra statement to the end of vertex shaders in OpenGL mode. Some
idempotence tests still fail because of this.
Mikko Rasa [Sat, 9 Apr 2022 11:41:04 +0000 (14:41 +0300)]
Remove Vulkan checks from feature converters
Since the GLSL version is now consistent, features can be checked
against it. This also makes the GLSL output behave better if used
on a shader compiled for Vulkan.
Mikko Rasa [Thu, 17 Mar 2022 19:55:18 +0000 (21:55 +0200)]
Redesign InstanceArray
It now stores the instances contiguously in memory instead of allocating
them individually. Consequently only one type of instance is allowed in
any particular array.
Mikko Rasa [Wed, 16 Mar 2022 08:44:06 +0000 (10:44 +0200)]
Rewrite descriptor set management
Descriptor sets have been moved from PipelineCache to a dedicated class.
PipelineState refers to descriptor sets using slot indices, allowing the
descriptor pool to be recreated if more space is needed.
Dynamic uniform buffers are no longer used. Instead multiple copies of
the descriptor set are created if it contains dynamic uniform blocks.
Mikko Rasa [Tue, 15 Mar 2022 19:25:18 +0000 (21:25 +0200)]
Make use of the sorted nature of PipelineState resource arrays
Since descriptor set is in the high bits, lower_bound can be used to
find its first resource and then go through elements until the next set
is reached.
Mikko Rasa [Mon, 14 Mar 2022 07:10:12 +0000 (09:10 +0200)]
Use a per-camera cache in ZSortedScene
It's very common to have multiple cameras in a scene due to effects like
shadow and environment maps. Using a single cache for all of them is
detrimental since the order will be different for each.
Mikko Rasa [Sun, 13 Mar 2022 07:34:18 +0000 (09:34 +0200)]
Treat standard and camera shader data specially in Renderer
Don't add them to the generic shdata stack. Some effects apply their own
camera, which led to two overlapping ProgramData objects on the stack.
Although the results were correct, this caused PipelineState to flag the
uniform blocks as dirty every frame and do unnecessary work.
Mikko Rasa [Fri, 11 Mar 2022 22:11:49 +0000 (00:11 +0200)]
Remove unused stages from shader programs
A stage is deemed unused if it has no main function after optimization,
or if a SPIR-V entry point's interface variables all become unused during
specialization.
Mikko Rasa [Fri, 11 Mar 2022 21:37:05 +0000 (23:37 +0200)]
Refactor face cull settings in Blender
Meshes no longer have a winding test toggle. Instead mesh winding is
always set and material's backface culling flag is exported. The default
in RenderMethod has been changed to NO_CULL.
Mikko Rasa [Fri, 11 Mar 2022 12:53:32 +0000 (14:53 +0200)]
Change front face logic on Vulkan to match the OpenGL backend
Front face is always set, not only when face cull is enabled. Since we
pretend that NDC has the same orientation as on OpenGL, face winding gets
inverted.
This will probably produce incorrect results if anything rendering to a
swapchain image relies on winding.
Mikko Rasa [Fri, 11 Mar 2022 09:55:49 +0000 (11:55 +0200)]
Implement alpha cutoff for materials
Having to implement it separately in each material's shader is not
optimal, but since they each define their own uniform block, no better
solution is readily apparent.
The occluder shader also supports alpha cutoff so that objects with
such materials can cast proper shadows.
Mikko Rasa [Sat, 5 Mar 2022 08:50:04 +0000 (10:50 +0200)]
Redesign progress and error reporting in the Blender exporter
Progress is now tracked in a context object, which also holds the Blender
context. Tasks are represented by independent objects instead of a stack
structure.
The context/task objects also track which data object that task is about,
so the object path can be reported in errors.
Mikko Rasa [Mon, 17 Jan 2022 20:41:24 +0000 (22:41 +0200)]
Support multiple PipelineStates in Renderer
In the Vulkan backend it can be beneficial to keep separate pipeline
states and avoid having to repeatedly compute hashes and look them up
from the cache. The downside is that every time the used state object
changes, shader data has to be reapplied. But it's likely this would
be necessary anyway due to different shader or data being used.