]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
2 years agoAdd support for alpha to coverage
Mikko Rasa [Sat, 23 Apr 2022 16:33:58 +0000 (19:33 +0300)]
Add support for alpha to coverage

2 years agoUpdate pipeline handle if framebuffer changes
Mikko Rasa [Tue, 19 Apr 2022 10:01:37 +0000 (13:01 +0300)]
Update pipeline handle if framebuffer changes

The pipeline's sample count must match that of the render pass.

2 years agoImplement multisample resolve for Vulkan
Mikko Rasa [Tue, 19 Apr 2022 08:46:11 +0000 (11:46 +0300)]
Implement multisample resolve for Vulkan

2 years agoDon't set the storage bit in usage flags of multisampled images
Mikko Rasa [Tue, 19 Apr 2022 08:44:13 +0000 (11:44 +0300)]
Don't set the storage bit in usage flags of multisampled images

It requires a device feature to be set.  I'll add that later.

2 years agoSet mip levels of multisample textures to 1
Mikko Rasa [Tue, 19 Apr 2022 08:40:32 +0000 (11:40 +0300)]
Set mip levels of multisample textures to 1

2 years agoRework multisample resolve to use resolve attachments
Mikko Rasa [Tue, 19 Apr 2022 07:27:53 +0000 (10:27 +0300)]
Rework multisample resolve to use resolve attachments

Vulkan can only resolve a depth attachment as part of a subpass, and in
order to do that the attachments must all be in the same framebuffer.

2 years agoRemove unused parameter from VulkanPipelineState::synchronize_resources
Mikko Rasa [Tue, 19 Apr 2022 07:14:25 +0000 (10:14 +0300)]
Remove unused parameter from VulkanPipelineState::synchronize_resources

It got left over from an idea which didn't pan out.

2 years agoSupport compute shaders and compute operations
Mikko Rasa [Fri, 15 Apr 2022 21:17:05 +0000 (00:17 +0300)]
Support compute shaders and compute operations

2 years agoAdd support for storage images in Renderer and PipelineState
Mikko Rasa [Fri, 15 Apr 2022 20:10:37 +0000 (23:10 +0300)]
Add support for storage images in Renderer and PipelineState

2 years agoAdd a separate limit for storage texture binding range
Mikko Rasa [Fri, 15 Apr 2022 19:44:25 +0000 (22:44 +0300)]
Add a separate limit for storage texture binding range

2 years agoFix the version statement in the ARB_explicit_attrib_location extension
Mikko Rasa [Fri, 15 Apr 2022 19:40:52 +0000 (22:40 +0300)]
Fix the version statement in the ARB_explicit_attrib_location extension

2 years agoSupport compute shaders in the shader compiler
Mikko Rasa [Mon, 11 Apr 2022 11:44:16 +0000 (14:44 +0300)]
Support compute shaders in the shader compiler

2 years agoAdd support for storage images in shaders
Mikko Rasa [Mon, 11 Apr 2022 11:37:01 +0000 (14:37 +0300)]
Add support for storage images in shaders

2 years agoPreparatory refactoring of the texelFetch implementation
Mikko Rasa [Mon, 11 Apr 2022 11:35:16 +0000 (14:35 +0300)]
Preparatory refactoring of the texelFetch implementation

2 years agoUse the sampled image type for OpImageQueryLod
Mikko Rasa [Mon, 11 Apr 2022 11:24:07 +0000 (14:24 +0300)]
Use the sampled image type for OpImageQueryLod

2 years agoDon't resolve function call arguments with incorrect types
Mikko Rasa [Mon, 11 Apr 2022 11:22:48 +0000 (14:22 +0300)]
Don't resolve function call arguments with incorrect types

2 years agoRefactor function call argument type resolving logic a bit
Mikko Rasa [Mon, 11 Apr 2022 11:22:25 +0000 (14:22 +0300)]
Refactor function call argument type resolving logic a bit

2 years agoAdd multisampled texture types to the shader compiler
Mikko Rasa [Sun, 10 Apr 2022 10:03:20 +0000 (13:03 +0300)]
Add multisampled texture types to the shader compiler

2 years agoParse array sizes for interface blocks
Mikko Rasa [Sat, 9 Apr 2022 16:24:53 +0000 (19:24 +0300)]
Parse array sizes for interface blocks

This fixes the last failing test case.

2 years agoUse VariableDeclaration in Assignment::Target
Mikko Rasa [Sat, 9 Apr 2022 16:02:40 +0000 (19:02 +0300)]
Use VariableDeclaration in Assignment::Target

2 years agoDon't add depth range conversion if an assignment to gl_Position.z exists
Mikko Rasa [Sat, 9 Apr 2022 16:01:25 +0000 (19:01 +0300)]
Don't add depth range conversion if an assignment to gl_Position.z exists

This is kinda crude since it triggers from any such assignment, but it
allows the idempotence test cases to work.

2 years agoFix GLSL test cases so they pass the basic tests
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.

2 years agoMake it possible to specify a target API for GLSL test cases
Mikko Rasa [Sat, 9 Apr 2022 11:43:49 +0000 (14:43 +0300)]
Make it possible to specify a target API for GLSL test cases

2 years agoRemove Vulkan checks from feature converters
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.

2 years agoRefactor SL::Features::from_api_version to take the actual API version
Mikko Rasa [Sat, 9 Apr 2022 11:39:37 +0000 (14:39 +0300)]
Refactor SL::Features::from_api_version to take the actual API version

Vulkan features now have a sensible GLSL version.

2 years agoFix incorrect version for ARB_explicit_attrib_location
Mikko Rasa [Sat, 9 Apr 2022 11:34:44 +0000 (14:34 +0300)]
Fix incorrect version for ARB_explicit_attrib_location

2 years agoRefactor Renderer's texture management to make it more extensible
Mikko Rasa [Sat, 9 Apr 2022 06:33:21 +0000 (09:33 +0300)]
Refactor Renderer's texture management to make it more extensible

The same code can now be used for other kinds of resources as well.

2 years agoUnify handling of shader resources in PipelineState
Mikko Rasa [Fri, 8 Apr 2022 20:44:37 +0000 (23:44 +0300)]
Unify handling of shader resources in PipelineState

2 years agoFix an incorrect variable name
Mikko Rasa [Thu, 7 Apr 2022 20:54:10 +0000 (23:54 +0300)]
Fix an incorrect variable name

2 years agoRefresh target framebuffer before blitting
Mikko Rasa [Thu, 7 Apr 2022 20:50:31 +0000 (23:50 +0300)]
Refresh target framebuffer before blitting

It seems that this has been broken since ce36589 without getting noticed.

2 years agoUse a default sampler in Renderer if null was passed in
Mikko Rasa [Thu, 7 Apr 2022 07:38:21 +0000 (10:38 +0300)]
Use a default sampler in Renderer if null was passed in

2 years agoRefactor render pass operations into a helper struct
Mikko Rasa [Tue, 22 Mar 2022 07:53:09 +0000 (09:53 +0200)]
Refactor render pass operations into a helper struct

2 years agoSome adjustments to includes
Mikko Rasa [Tue, 22 Mar 2022 07:19:39 +0000 (09:19 +0200)]
Some adjustments to includes

2 years agoFix issues from the command recorder refactoring
Mikko Rasa [Mon, 21 Mar 2022 21:31:05 +0000 (23:31 +0200)]
Fix issues from the command recorder refactoring

2 years agoMake StructureBuilder return const references to the pointers
Mikko Rasa [Sat, 19 Mar 2022 22:45:57 +0000 (00:45 +0200)]
Make StructureBuilder return const references to the pointers

2 years agoAdd a wrapper class for recording Vulkan commands
Mikko Rasa [Sat, 19 Mar 2022 08:51:40 +0000 (10:51 +0200)]
Add a wrapper class for recording Vulkan commands

This makes the command syntax shorter by storing the command buffer
handle in the wrapper.

2 years agoMove environment map handling to its own shader file
Mikko Rasa [Sat, 19 Mar 2022 07:57:38 +0000 (09:57 +0200)]
Move environment map handling to its own shader file

2 years agoFix a copy-paste error
Mikko Rasa [Sat, 19 Mar 2022 07:54:49 +0000 (09:54 +0200)]
Fix a copy-paste error

2 years agoAdd files which were forgotten earlier
Mikko Rasa [Fri, 18 Mar 2022 22:57:03 +0000 (00:57 +0200)]
Add files which were forgotten earlier

These should have been in 370eb9e.

2 years agoBegin creating a new demo program
Mikko Rasa [Fri, 18 Mar 2022 22:49:32 +0000 (00:49 +0200)]
Begin creating a new demo program

2 years agoMostly cosmetic changes
Mikko Rasa [Thu, 17 Mar 2022 20:12:20 +0000 (22:12 +0200)]
Mostly cosmetic changes

2 years agoMake it possible to export instance arrays from Blender
Mikko Rasa [Thu, 17 Mar 2022 20:08:13 +0000 (22:08 +0200)]
Make it possible to export instance arrays from Blender

2 years agoAdd a loader to InstanceArray and make them loadable in scenes
Mikko Rasa [Thu, 17 Mar 2022 20:06:10 +0000 (22:06 +0200)]
Add a loader to InstanceArray and make them loadable in scenes

2 years agoAdd instancing support to standard shaders and RenderMethod
Mikko Rasa [Thu, 17 Mar 2022 20:04:52 +0000 (22:04 +0200)]
Add instancing support to standard shaders and RenderMethod

2 years agoCall set_matrix from ObjectInstance's transform loader
Mikko Rasa [Thu, 17 Mar 2022 20:00:58 +0000 (22:00 +0200)]
Call set_matrix from ObjectInstance's transform loader

2 years agoFix instance attribute description updates in VertexSetup on Vulkan
Mikko Rasa [Thu, 17 Mar 2022 19:57:09 +0000 (21:57 +0200)]
Fix instance attribute description updates in VertexSetup on Vulkan

It was ignoring padding attributes when calculating which index to use
for the first instance attribute, resulting in a bogus description.

2 years agoSort shader program input attributes by name
Mikko Rasa [Thu, 17 Mar 2022 19:56:40 +0000 (21:56 +0200)]
Sort shader program input attributes by name

The lookup requires this.  It seems to have gotten broken in 2576b61, but
since the only user is InstanceArray, it wasn't noticed until now.

2 years agoRedesign InstanceArray
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.

2 years agoRebind all descriptor sets if push constant layout changes
Mikko Rasa [Thu, 17 Mar 2022 19:47:01 +0000 (21:47 +0200)]
Rebind all descriptor sets if push constant layout changes

2 years agoFurther refactoring of instance handling in the Blender exporter
Mikko Rasa [Thu, 17 Mar 2022 10:17:48 +0000 (12:17 +0200)]
Further refactoring of instance handling in the Blender exporter

2 years agoMove the utility functions in export_material into MaterialExporter
Mikko Rasa [Thu, 17 Mar 2022 09:06:47 +0000 (11:06 +0200)]
Move the utility functions in export_material into MaterialExporter

2 years agoRemove support for material atlases from the Blender exporter
Mikko Rasa [Thu, 17 Mar 2022 08:46:50 +0000 (10:46 +0200)]
Remove support for material atlases from the Blender exporter

Support for PBR materials was never added and it's unknown if it even
works anymore.  Baking and vertex colors are better solutions.

2 years agoSet debug names for pipeline and descriptor set layouts on Vulkan
Mikko Rasa [Wed, 16 Mar 2022 16:28:27 +0000 (18:28 +0200)]
Set debug names for pipeline and descriptor set layouts on Vulkan

2 years agoAdd a missing function import
Mikko Rasa [Wed, 16 Mar 2022 16:27:38 +0000 (18:27 +0200)]
Add a missing function import

2 years agoDon't try to draw world properties if there's no world
Mikko Rasa [Wed, 16 Mar 2022 16:27:23 +0000 (18:27 +0200)]
Don't try to draw world properties if there's no world

2 years agoExport instances created through geometry nodes
Mikko Rasa [Wed, 16 Mar 2022 16:26:47 +0000 (18:26 +0200)]
Export instances created through geometry nodes

2 years agoRefactor object prototype discovery in the blender exporter
Mikko Rasa [Wed, 16 Mar 2022 16:26:12 +0000 (18:26 +0200)]
Refactor object prototype discovery in the blender exporter

2 years agoFix handling of descriptor set bindings when shader stages change
Mikko Rasa [Wed, 16 Mar 2022 15:56:30 +0000 (17:56 +0200)]
Fix handling of descriptor set bindings when shader stages change

Also set only the present stages for descriptor set layouts.

2 years agoFix binding of descriptor sets of the new pipeline has more than the last
Mikko Rasa [Wed, 16 Mar 2022 15:54:05 +0000 (17:54 +0200)]
Fix binding of descriptor sets of the new pipeline has more than the last

2 years agoInitialize pipeline handle
Mikko Rasa [Wed, 16 Mar 2022 11:34:37 +0000 (13:34 +0200)]
Initialize pipeline handle

2 years agoSkip binding of low-numbered descriptor sets if they haven't changed
Mikko Rasa [Wed, 16 Mar 2022 11:29:09 +0000 (13:29 +0200)]
Skip binding of low-numbered descriptor sets if they haven't changed

2 years agoAnnotate uniforms with descriptor set layout qualifiers
Mikko Rasa [Wed, 16 Mar 2022 11:27:47 +0000 (13:27 +0200)]
Annotate uniforms with descriptor set layout qualifiers

Higher numbered sets are used for data which is expected to change
more often.

2 years agoMask out the descriptor set part of bind point when creating layouts
Mikko Rasa [Wed, 16 Mar 2022 11:20:59 +0000 (13:20 +0200)]
Mask out the descriptor set part of bind point when creating layouts

2 years agoRemove set layout qualifiers on OpenGL
Mikko Rasa [Wed, 16 Mar 2022 11:17:25 +0000 (13:17 +0200)]
Remove set layout qualifiers on OpenGL

But only if a binding qualifier is not present.  This allows using
multiple descriptor sets on Vulkan without breaking OpenGL.

2 years agoReplace some local pointers with references in VulkanCommands
Mikko Rasa [Wed, 16 Mar 2022 09:28:11 +0000 (11:28 +0200)]
Replace some local pointers with references in VulkanCommands

2 years agoOnly mark Result as checked if that specific value was checked
Mikko Rasa [Wed, 16 Mar 2022 09:23:31 +0000 (11:23 +0200)]
Only mark Result as checked if that specific value was checked

2 years agoRewrite descriptor set management
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.

2 years agoMake use of the sorted nature of PipelineState resource arrays
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.

2 years agoSome tweaks to vector component handling
Mikko Rasa [Mon, 14 Mar 2022 07:16:52 +0000 (09:16 +0200)]
Some tweaks to vector component handling

2 years agoUse default member initializers for ZSortedScene::SortedRenderable
Mikko Rasa [Mon, 14 Mar 2022 07:13:37 +0000 (09:13 +0200)]
Use default member initializers for ZSortedScene::SortedRenderable

2 years agoUse a per-camera cache in ZSortedScene
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.

2 years agoUse is_ortographic in Camera instead of checking fov directly
Mikko Rasa [Mon, 14 Mar 2022 07:07:49 +0000 (09:07 +0200)]
Use is_ortographic in Camera instead of checking fov directly

2 years agoAdapt to changes in mspmath
Mikko Rasa [Mon, 14 Mar 2022 07:07:09 +0000 (09:07 +0200)]
Adapt to changes in mspmath

2 years agoMove frustum culling from Scene to Camera
Mikko Rasa [Sun, 13 Mar 2022 09:42:53 +0000 (11:42 +0200)]
Move frustum culling from Scene to Camera

Also refactor it so that the camera's object matrix is accounted for
when computing the frustum planes.

2 years agoMake it possible to disable Vulkan validation
Mikko Rasa [Sun, 13 Mar 2022 08:02:06 +0000 (10:02 +0200)]
Make it possible to disable Vulkan validation

This can be useful when profiling an optimized debug build.

2 years agoUse persistent tags for the model matrix uniforms in Renderer
Mikko Rasa [Sun, 13 Mar 2022 08:00:56 +0000 (10:00 +0200)]
Use persistent tags for the model matrix uniforms in Renderer

Re-hashing the names every time takes enough time to show up in a
profile.

2 years agoTreat standard and camera shader data specially in Renderer
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.

2 years agoSet debug names for shader modules on Vulkan
Mikko Rasa [Fri, 11 Mar 2022 22:31:27 +0000 (00:31 +0200)]
Set debug names for shader modules on Vulkan

2 years agoRemove unused stages from shader programs
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.

2 years agoFlip normal if a surface faces away from the camera
Mikko Rasa [Fri, 11 Mar 2022 21:48:17 +0000 (23:48 +0200)]
Flip normal if a surface faces away from the camera

This gives correct two-sided lighting for non-closed meshes, which may
be used for tree leaves and such.

2 years agoUse mesh as the task object when exporting it
Mikko Rasa [Fri, 11 Mar 2022 21:43:54 +0000 (23:43 +0200)]
Use mesh as the task object when exporting it

2 years agoUse R8 format when extracting a single channel from an image
Mikko Rasa [Fri, 11 Mar 2022 21:42:57 +0000 (23:42 +0200)]
Use R8 format when extracting a single channel from an image

2 years agoRefactor face cull settings in Blender
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.

2 years agoChange front face logic on Vulkan to match the OpenGL backend
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.

2 years agoDetect and export alpha cutoff in Blender
Mikko Rasa [Fri, 11 Mar 2022 10:14:55 +0000 (12:14 +0200)]
Detect and export alpha cutoff in Blender

2 years agoFix the recognition of additive blending in the Blender exporter
Mikko Rasa [Fri, 11 Mar 2022 10:13:53 +0000 (12:13 +0200)]
Fix the recognition of additive blending in the Blender exporter

2 years agoImplement alpha cutoff for materials
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.

2 years agoEnable shadow map for the blended method when exporting
Mikko Rasa [Fri, 11 Mar 2022 09:25:46 +0000 (11:25 +0200)]
Enable shadow map for the blended method when exporting

Blended objects may want to receive shadows even though they can't
cast them.

2 years agoSupport specifying enabled methods in effect templates
Mikko Rasa [Fri, 11 Mar 2022 09:24:39 +0000 (11:24 +0200)]
Support specifying enabled methods in effect templates

2 years agoCreate specialized versions of SPIR-V modules with default spec values
Mikko Rasa [Fri, 11 Mar 2022 09:22:23 +0000 (11:22 +0200)]
Create specialized versions of SPIR-V modules with default spec values

It's important to remove unused resources in this case too.

2 years agoTake care of SPIR-V load IDs in ternary expressions
Mikko Rasa [Thu, 10 Mar 2022 06:54:56 +0000 (08:54 +0200)]
Take care of SPIR-V load IDs in ternary expressions

2 years agoNormalize vertex normal and tangent vectors in vertex shader
Mikko Rasa [Wed, 9 Mar 2022 18:31:03 +0000 (20:31 +0200)]
Normalize vertex normal and tangent vectors in vertex shader

If the normal matrix has scaling, that can throw things off.

2 years agoAvoid allocating buffers and images too close together
Mikko Rasa [Tue, 8 Mar 2022 14:00:22 +0000 (16:00 +0200)]
Avoid allocating buffers and images too close together

Vulkan requires that both types of resources do not reside on the same
"page" in memory.

2 years agoMinor tweaks to MemoryAllocator
Mikko Rasa [Tue, 8 Mar 2022 13:58:57 +0000 (15:58 +0200)]
Minor tweaks to MemoryAllocator

2 years agoAdd a function to request debug information from MemoryAllocator
Mikko Rasa [Tue, 8 Mar 2022 13:31:15 +0000 (15:31 +0200)]
Add a function to request debug information from MemoryAllocator

2 years agoHandle certain shader graph patterns that occur in imported glTF files
Mikko Rasa [Sun, 6 Mar 2022 11:21:28 +0000 (13:21 +0200)]
Handle certain shader graph patterns that occur in imported glTF files

2 years agoRemove unnecessary import statements from the Blender exporter
Mikko Rasa [Sun, 6 Mar 2022 10:37:35 +0000 (12:37 +0200)]
Remove unnecessary import statements from the Blender exporter

2 years agoUse bpy.path.basename instead of a custom function
Mikko Rasa [Sun, 6 Mar 2022 10:32:49 +0000 (12:32 +0200)]
Use bpy.path.basename instead of a custom function

2 years agoChange some leftover .tex2d extensions in the exporter
Mikko Rasa [Sun, 6 Mar 2022 10:30:58 +0000 (12:30 +0200)]
Change some leftover .tex2d extensions in the exporter

2 years agoHandle arbitrary channel inversions in material inputs.
Mikko Rasa [Sat, 5 Mar 2022 17:56:34 +0000 (19:56 +0200)]
Handle arbitrary channel inversions in material inputs.