]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
2 years agoConvert pixel components if necessary when async loading textures
Mikko Rasa [Tue, 28 Dec 2021 20:11:03 +0000 (22:11 +0200)]
Convert pixel components if necessary when async loading textures

2 years agoMove Texture2D::AsyncLoader back to the common part
Mikko Rasa [Tue, 28 Dec 2021 14:09:59 +0000 (16:09 +0200)]
Move Texture2D::AsyncLoader back to the common part

The backend-specific parts are now handled by AsyncTransfer.

2 years agoRefactor Texture2D::AsyncLoader to use sub_image_async
Mikko Rasa [Tue, 28 Dec 2021 14:07:48 +0000 (16:07 +0200)]
Refactor Texture2D::AsyncLoader to use sub_image_async

2 years agoAdd an asynchronous version of Texture2D::sub_image
Mikko Rasa [Tue, 28 Dec 2021 10:03:58 +0000 (12:03 +0200)]
Add an asynchronous version of Texture2D::sub_image

2 years agoRequire buffer to have storage for mapping
Mikko Rasa [Mon, 27 Dec 2021 23:05:20 +0000 (01:05 +0200)]
Require buffer to have storage for mapping

2 years agoMake Buffer::AsyncTransfer default-constructible and move-assignable
Mikko Rasa [Mon, 27 Dec 2021 21:26:25 +0000 (23:26 +0200)]
Make Buffer::AsyncTransfer default-constructible and move-assignable

2 years agoRedesign asynchronous buffer uploads
Mikko Rasa [Fri, 24 Dec 2021 10:25:46 +0000 (12:25 +0200)]
Redesign asynchronous buffer uploads

The Buffer class now offers an async version of sub_data, which can
better account for exactly how the data needs to be uploaded.

2 years agoReset staging buffers in TransferQueue once the transfers are done
Mikko Rasa [Mon, 20 Dec 2021 21:03:33 +0000 (23:03 +0200)]
Reset staging buffers in TransferQueue once the transfers are done

2 years agoImprove state setting in Sky
Mikko Rasa [Mon, 20 Dec 2021 00:13:41 +0000 (02:13 +0200)]
Improve state setting in Sky

Avoid leaking the effect's shader data to its content as it contains no
relevant uniforms.

2 years agoUse a streaming buffer for ProgramData only when needed
Mikko Rasa [Sun, 19 Dec 2021 23:26:15 +0000 (01:26 +0200)]
Use a streaming buffer for ProgramData only when needed

2 years agoRefactor ProgramData buffer (re)creation into a function
Mikko Rasa [Sun, 19 Dec 2021 12:10:12 +0000 (14:10 +0200)]
Refactor ProgramData buffer (re)creation into a function

2 years agoMultiplex streaming buffer contents on Vulkan
Mikko Rasa [Sun, 19 Dec 2021 11:39:08 +0000 (13:39 +0200)]
Multiplex streaming buffer contents on Vulkan

This ensures that the data stays valid until the draw commands using it
have finished executing.

2 years agoInstanceArray doesn't need to refresh the vertex arrays
Mikko Rasa [Sun, 19 Dec 2021 11:26:00 +0000 (13:26 +0200)]
InstanceArray doesn't need to refresh the vertex arrays

That's done in Renderer since 9b3bce7.

2 years agoAdd a flag to obtain an aligned size requirement from Bufferable
Mikko Rasa [Sun, 19 Dec 2021 10:53:48 +0000 (12:53 +0200)]
Add a flag to obtain an aligned size requirement from Bufferable

2 years agoUse a member function to set the dirty flag in Bufferable
Mikko Rasa [Sat, 18 Dec 2021 22:16:10 +0000 (00:16 +0200)]
Use a member function to set the dirty flag in Bufferable

2 years agoKeep track of the buffers of bound uniform blocks
Mikko Rasa [Sat, 18 Dec 2021 22:00:32 +0000 (00:00 +0200)]
Keep track of the buffers of bound uniform blocks

ProgramData may recreate the buffer when creating new blocks, but existing
block objects will be retained.  As such, the block object alone isn't
enough to determine whether the binding has changed.

2 years agoIncrement frame after destroying objects instead of before
Mikko Rasa [Sat, 18 Dec 2021 18:19:55 +0000 (20:19 +0200)]
Increment frame after destroying objects instead of before

Things were getting destroyed one frame too early since the destroy queue
is ticked after rendering a frame.

2 years agoClamp depth reference for shadows to 1.0
Mikko Rasa [Tue, 14 Dec 2021 14:23:34 +0000 (16:23 +0200)]
Clamp depth reference for shadows to 1.0

This makes objects which are "behind" the shadow map volume sample the
shadow map correctly and not treat the clear value as a shadow caster.

2 years agoDefer transfer and barriers until the entire render pass is recorded
Mikko Rasa [Tue, 14 Dec 2021 12:57:34 +0000 (14:57 +0200)]
Defer transfer and barriers until the entire render pass is recorded

This ensures that all resources needed by the render pass are prepared
before executing the pass.

2 years agoUse secondary command buffers to record render pass contents
Mikko Rasa [Tue, 14 Dec 2021 12:37:57 +0000 (14:37 +0200)]
Use secondary command buffers to record render pass contents

This allows greater flexibility for ordering transfers and barriers
relative to render passes.

2 years agoCorrectly set framebuffer layers when cube map attachments are used
Mikko Rasa [Tue, 14 Dec 2021 11:24:13 +0000 (13:24 +0200)]
Correctly set framebuffer layers when cube map attachments are used

2 years agoRefactor projection matrix handling
Mikko Rasa [Tue, 14 Dec 2021 11:21:25 +0000 (13:21 +0200)]
Refactor projection matrix handling

Projection matrices in C++ side now always produce a depth range of 0 to
1 for the NDC Z coordinate.  Shaders will convert it to -1 to 1 when
targeting OpenGL.

Incidentally, the AmbientOcclusion effect's shaders were already written
as if the depth range was 0 to 1, so the effect was actually slightly
incorrect before this.

2 years agoFix incorrect lookup of GLSL interface variables
Mikko Rasa [Sun, 12 Dec 2021 21:48:40 +0000 (23:48 +0200)]
Fix incorrect lookup of GLSL interface variables

2 years agoRefactor handling of viewport Y axis
Mikko Rasa [Sun, 12 Dec 2021 21:44:04 +0000 (23:44 +0200)]
Refactor handling of viewport Y axis

Only invert it for the swapchain render target.  This makes it easier to
sample render target textures consistently.

2 years agoSet gl_Layer separately for each vertex
Mikko Rasa [Sun, 12 Dec 2021 11:17:30 +0000 (13:17 +0200)]
Set gl_Layer separately for each vertex

EmitVertex invalidates *all* output variables so they must be written
again for the next one.

2 years agoEnable geometry shaders by default
Mikko Rasa [Sun, 12 Dec 2021 11:01:38 +0000 (13:01 +0200)]
Enable geometry shaders by default

2 years agoFix render area Y coordinate calculation
Mikko Rasa [Sun, 12 Dec 2021 10:57:19 +0000 (12:57 +0200)]
Fix render area Y coordinate calculation

2 years agoDiscard render target contents only if the entire mip level is used
Mikko Rasa [Sun, 12 Dec 2021 09:49:19 +0000 (11:49 +0200)]
Discard render target contents only if the entire mip level is used

2 years agoMark PBR precalc parameters as push constants
Mikko Rasa [Sat, 11 Dec 2021 23:46:55 +0000 (01:46 +0200)]
Mark PBR precalc parameters as push constants

2 years agoRe-export desertpillars data with new vertex formats
Mikko Rasa [Sat, 11 Dec 2021 23:46:38 +0000 (01:46 +0200)]
Re-export desertpillars data with new vertex formats

2 years agoRefactor TransferQueue to require explicit finalization of transfers
Mikko Rasa [Sat, 11 Dec 2021 23:40:19 +0000 (01:40 +0200)]
Refactor TransferQueue to require explicit finalization of transfers

This allows the data for the transfer to be written asynchronously.

2 years agoUse const void * for the object pointers in TransferQueue
Mikko Rasa [Sat, 11 Dec 2021 23:33:10 +0000 (01:33 +0200)]
Use const void * for the object pointers in TransferQueue

2 years agoBind only the first mipmap level when prefiltering an envmap
Mikko Rasa [Sat, 11 Dec 2021 18:18:34 +0000 (20:18 +0200)]
Bind only the first mipmap level when prefiltering an envmap

2 years agoEmit a max invocations exec mode for geometry shaders
Mikko Rasa [Sat, 11 Dec 2021 17:34:25 +0000 (19:34 +0200)]
Emit a max invocations exec mode for geometry shaders

2 years agoCreate image views in VulkanFramebuffer if necessary
Mikko Rasa [Fri, 10 Dec 2021 13:53:46 +0000 (15:53 +0200)]
Create image views in VulkanFramebuffer if necessary

Using a specific mip level or array layer as an attachment requires a
view with suitable parameters.

2 years agoSupport binding individual mipmap levels of textures
Mikko Rasa [Fri, 10 Dec 2021 13:51:09 +0000 (15:51 +0200)]
Support binding individual mipmap levels of textures

Vulkan requires different layouts for sampling a texture and rendering
into, so reading from one mip level and rendering into another requires
separate views.

The OpenGL backend only allows binding level 0, since nothing currently
needs binding higher levels.  Full support requires the ARB_texture_view
extension.

2 years agoTrack the number of layers in Framebuffer
Mikko Rasa [Thu, 9 Dec 2021 13:34:27 +0000 (15:34 +0200)]
Track the number of layers in Framebuffer

2 years agoDon't remove individual mipmap levels from Synchronizer
Mikko Rasa [Thu, 9 Dec 2021 13:23:21 +0000 (15:23 +0200)]
Don't remove individual mipmap levels from Synchronizer

Keep them around until all levels have been transitioned to shader read
only optimal, to ensure that changing the layout of a split image as a
whole works correctly.

2 years agoTrack different kinds of bindings separately
Mikko Rasa [Thu, 9 Dec 2021 11:43:16 +0000 (13:43 +0200)]
Track different kinds of bindings separately

2 years agoPopulate used bindings in ReflectData
Mikko Rasa [Thu, 9 Dec 2021 10:23:04 +0000 (12:23 +0200)]
Populate used bindings in ReflectData

2 years agoDon't try to bind descriptor sets if there aren't any
Mikko Rasa [Thu, 9 Dec 2021 10:02:41 +0000 (12:02 +0200)]
Don't try to bind descriptor sets if there aren't any

2 years agoRefresh vertex setup in VulkanPipelineState::update
Mikko Rasa [Thu, 9 Dec 2021 09:50:42 +0000 (11:50 +0200)]
Refresh vertex setup in VulkanPipelineState::update

The buffers and offsets must be filled even if another vertex setup with
the same format has been used before.

2 years agoInitialize members of VulkanVertexSetup
Mikko Rasa [Thu, 9 Dec 2021 09:48:25 +0000 (11:48 +0200)]
Initialize members of VulkanVertexSetup

2 years agoUse an RGBA environment map in desertpillars
Mikko Rasa [Sun, 5 Dec 2021 08:53:38 +0000 (10:53 +0200)]
Use an RGBA environment map in desertpillars

2 years agoStore the number of mipmap levels in the Texture base class
Mikko Rasa [Sat, 4 Dec 2021 00:25:14 +0000 (02:25 +0200)]
Store the number of mipmap levels in the Texture base class

2 years agoUse default member initializers in Texture
Mikko Rasa [Sat, 4 Dec 2021 00:22:39 +0000 (02:22 +0200)]
Use default member initializers in Texture

2 years agoAvoid collisions with members of nameless interface blocks when inlining
Mikko Rasa [Sat, 4 Dec 2021 00:12:14 +0000 (02:12 +0200)]
Avoid collisions with members of nameless interface blocks when inlining

2 years agoUse RGBA as the default format for effect render targets
Mikko Rasa [Wed, 1 Dec 2021 08:55:04 +0000 (10:55 +0200)]
Use RGBA as the default format for effect render targets

2 years agoConvert RGB pixel data to RGBA when staging
Mikko Rasa [Wed, 1 Dec 2021 08:54:07 +0000 (10:54 +0200)]
Convert RGB pixel data to RGBA when staging

2 years agoUse the correct aspect mask for uploading texture data
Mikko Rasa [Wed, 1 Dec 2021 08:52:10 +0000 (10:52 +0200)]
Use the correct aspect mask for uploading texture data

2 years agoSubmit commands for isolated offscreen rendering
Mikko Rasa [Wed, 1 Dec 2021 08:35:23 +0000 (10:35 +0200)]
Submit commands for isolated offscreen rendering

2 years agoClear the begin semaphore if Renderer::begin() is called without one
Mikko Rasa [Wed, 1 Dec 2021 08:34:54 +0000 (10:34 +0200)]
Clear the begin semaphore if Renderer::begin() is called without one

2 years agoRemove the exception from Texture2DMultisample constructor
Mikko Rasa [Wed, 1 Dec 2021 08:32:13 +0000 (10:32 +0200)]
Remove the exception from Texture2DMultisample constructor

2 years agoImplement mipmap generation for the Vulkan backend
Mikko Rasa [Wed, 1 Dec 2021 08:31:43 +0000 (10:31 +0200)]
Implement mipmap generation for the Vulkan backend

2 years agoSupport transfers with no staged data
Mikko Rasa [Wed, 1 Dec 2021 07:53:10 +0000 (09:53 +0200)]
Support transfers with no staged data

This can be used to transfer data within VRAM, such as for mipmap
generation.

2 years agoTrack the order of transfers involving the same objects
Mikko Rasa [Wed, 1 Dec 2021 07:45:38 +0000 (09:45 +0200)]
Track the order of transfers involving the same objects

Mipmap generation requires barriers between the steps, since each level
is generated using the previous one.

2 years agoUse another callback for pre-transfer synchronization
Mikko Rasa [Tue, 30 Nov 2021 22:17:53 +0000 (00:17 +0200)]
Use another callback for pre-transfer synchronization

2 years agoTweaks and fixes to OpNames in SPIR-V
Mikko Rasa [Tue, 30 Nov 2021 21:46:59 +0000 (23:46 +0200)]
Tweaks and fixes to OpNames in SPIR-V

Interface blocks without an instance name must not have a non-empty
OpName or the reflection code gets confused.

2 years agoRefactor Synchronizer to deal with individual mipmap levels
Mikko Rasa [Tue, 30 Nov 2021 21:30:27 +0000 (23:30 +0200)]
Refactor Synchronizer to deal with individual mipmap levels

Some algorithms read from one mipmap level and write to another.  On the
other hand, there's currently no need for layer granularity.

2 years agoDon't create no-op barriers
Mikko Rasa [Tue, 30 Nov 2021 21:24:04 +0000 (23:24 +0200)]
Don't create no-op barriers

2 years agoApply implicit conversions to function arguments
Mikko Rasa [Sun, 28 Nov 2021 23:02:54 +0000 (01:02 +0200)]
Apply implicit conversions to function arguments

2 years agoAutomatically determine array sizes in GLSL if possible
Mikko Rasa [Sun, 28 Nov 2021 23:01:01 +0000 (01:01 +0200)]
Automatically determine array sizes in GLSL if possible

Consequently the SPIR-V backend no longer needs to deal with missing
array sizes.

2 years agoVulkan doesn't support uniform locations
Mikko Rasa [Sat, 27 Nov 2021 20:17:17 +0000 (22:17 +0200)]
Vulkan doesn't support uniform locations

2 years agoUnify handling of variables and interface blocks in the GLSL compiler
Mikko Rasa [Sat, 27 Nov 2021 19:25:03 +0000 (21:25 +0200)]
Unify handling of variables and interface blocks in the GLSL compiler

In SPIR-V interface blocks are just variables with a struct type marked
as block.  Treating them this way in the AST reduces duplcation a fair
bit.

2 years agoFixes for handling extended alignment in GLSL
Mikko Rasa [Sat, 27 Nov 2021 18:00:27 +0000 (20:00 +0200)]
Fixes for handling extended alignment in GLSL

2 years agoUse correct variable to access values
Mikko Rasa [Sat, 27 Nov 2021 10:58:18 +0000 (12:58 +0200)]
Use correct variable to access values

2 years agoConsider arrays to have matching size if both are unsized
Mikko Rasa [Sat, 27 Nov 2021 10:19:53 +0000 (12:19 +0200)]
Consider arrays to have matching size if both are unsized

2 years agoRefactor adding types in SL::Parser
Mikko Rasa [Sat, 27 Nov 2021 00:49:14 +0000 (02:49 +0200)]
Refactor adding types in SL::Parser

2 years agoFix a GLSL testcase
Mikko Rasa [Wed, 24 Nov 2021 22:22:08 +0000 (00:22 +0200)]
Fix a GLSL testcase

The constant IDs got perturbed in 8c379c40.

2 years agoAdd missing includes
Mikko Rasa [Wed, 24 Nov 2021 22:21:19 +0000 (00:21 +0200)]
Add missing includes

2 years agoReuse previously allocated command buffers
Mikko Rasa [Mon, 22 Nov 2021 11:34:00 +0000 (13:34 +0200)]
Reuse previously allocated command buffers

2 years agoSet push constants only for enabled shader stages
Mikko Rasa [Mon, 22 Nov 2021 11:33:14 +0000 (13:33 +0200)]
Set push constants only for enabled shader stages

2 years agoImplement textures and samplers for Vulkan
Mikko Rasa [Sun, 21 Nov 2021 23:41:45 +0000 (01:41 +0200)]
Implement textures and samplers for Vulkan

Currently render target textures get a useless layout transition to
SHADER_READ_ONLY_OPTIMAL if there's any transfers on the same frame.

Mipmap generation and asynchronous uploading of textures does not work
yet.

2 years agoMove PipelineState refresh to just before draw call
Mikko Rasa [Sun, 21 Nov 2021 23:29:09 +0000 (01:29 +0200)]
Move PipelineState refresh to just before draw call

Shouldn't matter much, but it makes more sense here

2 years agoAlways apply push constants
Mikko Rasa [Sun, 21 Nov 2021 23:23:13 +0000 (01:23 +0200)]
Always apply push constants

The changed flag is no longer valid at this point.  This could in theory
result in unnecessary CmdPushConstants calls, but in practice they change
for every draw call (if they're used in the first place).

2 years agoTrack the in-use state of resource bindings in PipelineState
Mikko Rasa [Sun, 21 Nov 2021 13:26:22 +0000 (15:26 +0200)]
Track the in-use state of resource bindings in PipelineState

2 years agoUpdate all descriptor sets when the used shader changes
Mikko Rasa [Sun, 21 Nov 2021 12:59:38 +0000 (14:59 +0200)]
Update all descriptor sets when the used shader changes

2 years agoSet color write mask if no blending is used
Mikko Rasa [Sun, 21 Nov 2021 12:57:45 +0000 (14:57 +0200)]
Set color write mask if no blending is used

2 years agoAdd a subpass dependency to ensure the rendering result is available
Mikko Rasa [Sun, 21 Nov 2021 12:52:38 +0000 (14:52 +0200)]
Add a subpass dependency to ensure the rendering result is available

2 years agoOnly do layout transitions in render pass for swapchain images
Mikko Rasa [Sun, 21 Nov 2021 12:41:29 +0000 (14:41 +0200)]
Only do layout transitions in render pass for swapchain images

Transitions for other images will be handles through Synchronizer.

2 years agoMake framebuffer attachment accessors public
Mikko Rasa [Sun, 21 Nov 2021 10:10:11 +0000 (12:10 +0200)]
Make framebuffer attachment accessors public

2 years agoAdd a synchronization helper class to the Vulkan backend
Mikko Rasa [Sun, 21 Nov 2021 10:09:40 +0000 (12:09 +0200)]
Add a synchronization helper class to the Vulkan backend

2 years agoUse PRESENT_SRC as the initial layout for swapchain images
Mikko Rasa [Sat, 20 Nov 2021 22:42:26 +0000 (00:42 +0200)]
Use PRESENT_SRC as the initial layout for swapchain images

This makes the layout transition work if for some reason a clear command
is not used for the swapchain.

2 years agoConvert some constructors to default member initializers
Mikko Rasa [Sat, 20 Nov 2021 22:11:26 +0000 (00:11 +0200)]
Convert some constructors to default member initializers

2 years agoUse RGBA format render target for Bloom
Mikko Rasa [Sat, 20 Nov 2021 22:06:59 +0000 (00:06 +0200)]
Use RGBA format render target for Bloom

2 years agoDon't generate warnings about internal types with duplicate names
Mikko Rasa [Sat, 20 Nov 2021 22:06:00 +0000 (00:06 +0200)]
Don't generate warnings about internal types with duplicate names

2 years agoUse extended alignment in SPIR-V struct layout when necessary
Mikko Rasa [Sat, 20 Nov 2021 21:59:16 +0000 (23:59 +0200)]
Use extended alignment in SPIR-V struct layout when necessary

2 years agoDo discard-clears in individual postprocessors, not the sequence
Mikko Rasa [Sat, 20 Nov 2021 21:43:33 +0000 (23:43 +0200)]
Do discard-clears in individual postprocessors, not the sequence

It should be done just before rendering into the target starts.

2 years agoCache framebuffer and viewport in VulkanCommands
Mikko Rasa [Fri, 19 Nov 2021 22:42:00 +0000 (00:42 +0200)]
Cache framebuffer and viewport in VulkanCommands

Since PipelineState is not immutable, this is necessary to detect when
they have changed.

2 years agoCheck if render target is swapchain and set to_present accordingly
Mikko Rasa [Fri, 19 Nov 2021 22:39:53 +0000 (00:39 +0200)]
Check if render target is swapchain and set to_present accordingly

2 years agoTreat clear() with null parameter as invalidate
Mikko Rasa [Fri, 19 Nov 2021 22:36:52 +0000 (00:36 +0200)]
Treat clear() with null parameter as invalidate

Also use it in Sequence for postprocessor render targets, since
postprocessors are supposed to render the entire screen.

2 years agoCreate specialized copies of SPIR-V modules
Mikko Rasa [Fri, 19 Nov 2021 19:00:52 +0000 (21:00 +0200)]
Create specialized copies of SPIR-V modules

It turns out Vulkan does want all declared resources in the descriptor
sets, even if they're unused.  Manual specialization avoids the need to
deal with them when binding stuff.

2 years agoInitial implementation of Vulkan backend
Mikko Rasa [Thu, 18 Nov 2021 15:13:13 +0000 (17:13 +0200)]
Initial implementation of Vulkan backend

Some functionalities are still missing, in particular textures and
samplers.  Drawing simple geometry works.

2 years agoAdd checks for invalid state in OpenGLCommands
Mikko Rasa [Thu, 18 Nov 2021 10:48:08 +0000 (12:48 +0200)]
Add checks for invalid state in OpenGLCommands

2 years agoRefactor low-level state management
Mikko Rasa [Thu, 18 Nov 2021 10:09:57 +0000 (12:09 +0200)]
Refactor low-level state management

The global context state is now held in Device.

The changes mask in PipelineState was also moved to the backend class,
because pipeline state is applied very differently in Vulkan.

2 years agoColorize the debug output of the GLSL compiler
Mikko Rasa [Wed, 17 Nov 2021 20:27:08 +0000 (22:27 +0200)]
Colorize the debug output of the GLSL compiler

2 years agoStore primitive type in PipelineState
Mikko Rasa [Wed, 17 Nov 2021 19:51:26 +0000 (21:51 +0200)]
Store primitive type in PipelineState

Vulkan needs it to be here

2 years agoCreate default context options in the device backend
Mikko Rasa [Wed, 17 Nov 2021 19:31:30 +0000 (21:31 +0200)]
Create default context options in the device backend

2 years agoUse emplace_back when a new object is being constructed
Mikko Rasa [Wed, 17 Nov 2021 15:12:19 +0000 (17:12 +0200)]
Use emplace_back when a new object is being constructed

2 years agoDon't try to apply push constants as uniforms in OpenGL
Mikko Rasa [Wed, 17 Nov 2021 14:56:50 +0000 (16:56 +0200)]
Don't try to apply push constants as uniforms in OpenGL

They shouldn't exist anyway.