]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoSome more default member initializers
Mikko Rasa [Thu, 11 Nov 2021 11:37:09 +0000 (13:37 +0200)]
Some more default member initializers

3 years agoRemove default uniform block if it has no uniforms
Mikko Rasa [Thu, 11 Nov 2021 11:34:59 +0000 (13:34 +0200)]
Remove default uniform block if it has no uniforms

3 years agoRecognize push constant blocks when reflecting SPIR-V modules
Mikko Rasa [Thu, 11 Nov 2021 11:34:40 +0000 (13:34 +0200)]
Recognize push constant blocks when reflecting SPIR-V modules

3 years agoStore descriptor set in program reflection data
Mikko Rasa [Thu, 11 Nov 2021 11:24:29 +0000 (13:24 +0200)]
Store descriptor set in program reflection data

3 years agoHandle descriptor sets when allocating uniform locations
Mikko Rasa [Thu, 11 Nov 2021 10:56:28 +0000 (12:56 +0200)]
Handle descriptor sets when allocating uniform locations

3 years agoPropagate locations from existing variables before optimization
Mikko Rasa [Thu, 11 Nov 2021 10:49:08 +0000 (12:49 +0200)]
Propagate locations from existing variables before optimization

Uniform location and binding qualifiers should apply to all copies of the
variable even if the one originally containing them is optimized out.

3 years agoImprove layout qualifier handling with some more utility functions
Mikko Rasa [Thu, 11 Nov 2021 10:00:07 +0000 (12:00 +0200)]
Improve layout qualifier handling with some more utility functions

3 years agoAdd a utility function for following a chain of base types
Mikko Rasa [Wed, 10 Nov 2021 23:31:47 +0000 (01:31 +0200)]
Add a utility function for following a chain of base types

3 years agoRefactor a common part in LocationAllocator into a function
Mikko Rasa [Wed, 10 Nov 2021 22:59:22 +0000 (00:59 +0200)]
Refactor a common part in LocationAllocator into a function

3 years agoAssign the same specialization constant IDs in all stages
Mikko Rasa [Wed, 10 Nov 2021 22:35:45 +0000 (00:35 +0200)]
Assign the same specialization constant IDs in all stages

3 years agoEmit descriptor set decorations for interface blocks
Mikko Rasa [Wed, 10 Nov 2021 20:09:38 +0000 (22:09 +0200)]
Emit descriptor set decorations for interface blocks

3 years agoAdd basic Vulkan support to the shader compiler
Mikko Rasa [Wed, 10 Nov 2021 20:09:17 +0000 (22:09 +0200)]
Add basic Vulkan support to the shader compiler

3 years agoAdd a constant for Vulkan backend
Mikko Rasa [Wed, 10 Nov 2021 20:01:47 +0000 (22:01 +0200)]
Add a constant for Vulkan backend

3 years agoAccount for mipmap levels when computing texture data sizes
Mikko Rasa [Wed, 10 Nov 2021 18:31:17 +0000 (20:31 +0200)]
Account for mipmap levels when computing texture data sizes

This isn't 100% accurate, but good enough for resource management.

3 years agoPerform range checks in UniformBlock in debug builds
Mikko Rasa [Wed, 10 Nov 2021 18:10:18 +0000 (20:10 +0200)]
Perform range checks in UniformBlock in debug builds

3 years agoMove the Resource function override of Texture classes into backend
Mikko Rasa [Wed, 10 Nov 2021 18:08:34 +0000 (20:08 +0200)]
Move the Resource function override of Texture classes into backend

There's enough differences between APIs that these can't be sensibly kept
in the common classes.

3 years agoMove WindowView::render to the backend
Mikko Rasa [Wed, 10 Nov 2021 14:16:18 +0000 (16:16 +0200)]
Move WindowView::render to the backend

Presenting images work very differently in Vulkan so the swap_buffers
call can't be in the common part.

3 years agoRemove the LINE_LOOP primitive type
Mikko Rasa [Wed, 10 Nov 2021 14:13:09 +0000 (16:13 +0200)]
Remove the LINE_LOOP primitive type

It's not supported on Vulkan and can be replaced by LINE_STRIP by adding
one extra index at the end.

3 years agoMinor tweaks
Mikko Rasa [Wed, 10 Nov 2021 14:12:42 +0000 (16:12 +0200)]
Minor tweaks

3 years agoRemove some stray includes and add a missing one
Mikko Rasa [Wed, 10 Nov 2021 14:12:05 +0000 (16:12 +0200)]
Remove some stray includes and add a missing one

3 years agoEnsure that creating the system framebuffer doesn't change the binding
Mikko Rasa [Tue, 9 Nov 2021 23:52:27 +0000 (01:52 +0200)]
Ensure that creating the system framebuffer doesn't change the binding

Just in case it's for some reason created at an odd time.

3 years agoRestructure system framebuffer and make WindowView own it
Mikko Rasa [Tue, 9 Nov 2021 23:50:19 +0000 (01:50 +0200)]
Restructure system framebuffer and make WindowView own it

This works very differently on Vulkan, so the system framebuffer can't
be exposed from the Framebuffer class.

3 years agoCheck for empty attachments array instead of zero id in Framebuffer
Mikko Rasa [Tue, 9 Nov 2021 23:43:06 +0000 (01:43 +0200)]
Check for empty attachments array instead of zero id in Framebuffer

The id is an OpenGL implementation detail and shouldn't be used in the
common part.

3 years agoDon't store a View's target framebuffer in the base class
Mikko Rasa [Tue, 9 Nov 2021 12:53:34 +0000 (14:53 +0200)]
Don't store a View's target framebuffer in the base class

Instead access it through a virtual function.  Vulkan requires a separate
framebuffer per swapchain image.

3 years agoMove backend information into Device
Mikko Rasa [Tue, 9 Nov 2021 12:07:01 +0000 (14:07 +0200)]
Move backend information into Device

3 years agoRemove obsolete includes
Mikko Rasa [Tue, 9 Nov 2021 11:18:17 +0000 (13:18 +0200)]
Remove obsolete includes

3 years agoCreate a Device class to hold the graphics context
Mikko Rasa [Tue, 9 Nov 2021 10:37:15 +0000 (12:37 +0200)]
Create a Device class to hold the graphics context

This is necessary to make the selected backend transparent to
applications, and also because Vulkan needs access to the VkDevice.

3 years agoAlways apply feature conversion in the GLSL compiler
Mikko Rasa [Mon, 8 Nov 2021 21:10:34 +0000 (23:10 +0200)]
Always apply feature conversion in the GLSL compiler

Also convert structural features before allocating locations.  This
gives flattened push constant uniforms locations too.

3 years agoUse specially created features when compiling modules from GLSL
Mikko Rasa [Mon, 8 Nov 2021 20:18:38 +0000 (22:18 +0200)]
Use specially created features when compiling modules from GLSL

Set the latest version so all language features are retained, but limit
bindings to what the implementation actually supports.

3 years agoRequire passing features to SL::Compiler constructor
Mikko Rasa [Mon, 8 Nov 2021 19:50:00 +0000 (21:50 +0200)]
Require passing features to SL::Compiler constructor

Using the current context's features by default seems like it could lead
to some surprises down the road.

3 years agoMake the SL::Features factory functions more flexible
Mikko Rasa [Mon, 8 Nov 2021 19:19:15 +0000 (21:19 +0200)]
Make the SL::Features factory functions more flexible

Passing the backend API as an argument is much better than having
separate functions for each backend.

3 years agoSplit FeatureConverter into two parts
Mikko Rasa [Mon, 8 Nov 2021 17:56:45 +0000 (19:56 +0200)]
Split FeatureConverter into two parts

3 years agoRename LegacyConverter to FeatureConverter
Mikko Rasa [Mon, 8 Nov 2021 17:21:41 +0000 (19:21 +0200)]
Rename LegacyConverter to FeatureConverter

3 years agoStore object transform in a push constant block
Mikko Rasa [Mon, 8 Nov 2021 16:19:12 +0000 (18:19 +0200)]
Store object transform in a push constant block

3 years agoAllow a push constant block to be specified, but flatten it for now
Mikko Rasa [Mon, 8 Nov 2021 16:17:51 +0000 (18:17 +0200)]
Allow a push constant block to be specified, but flatten it for now

It's needed for Vulkan, but OpenGL does not have push constants.

3 years agoFix flattening of GLSL interface blocks
Mikko Rasa [Mon, 8 Nov 2021 16:15:39 +0000 (18:15 +0200)]
Fix flattening of GLSL interface blocks

Anonymous interface blocks are treated as nameless variables since
dfcf8eb, so the member accesses need to be converted to plain variable
references when the block is flattened.

3 years agoCopy layout of InterfaceBlock
Mikko Rasa [Mon, 8 Nov 2021 13:49:29 +0000 (15:49 +0200)]
Copy layout of InterfaceBlock

3 years agoTweak eye position calculation in shaders
Mikko Rasa [Mon, 8 Nov 2021 13:31:07 +0000 (15:31 +0200)]
Tweak eye position calculation in shaders

3 years agoActually call the collect_builtins function in Program
Mikko Rasa [Mon, 8 Nov 2021 13:28:43 +0000 (15:28 +0200)]
Actually call the collect_builtins function in Program

This was forgotten from f82ef71.

3 years agoWrite access can't get into an unary operator from outside
Mikko Rasa [Mon, 8 Nov 2021 13:27:43 +0000 (15:27 +0200)]
Write access can't get into an unary operator from outside

3 years agoCache texture bindings when the shader program does not change
Mikko Rasa [Mon, 8 Nov 2021 13:23:54 +0000 (15:23 +0200)]
Cache texture bindings when the shader program does not change

3 years agoRestore variable load IDs for the else branch of a conditional
Mikko Rasa [Mon, 8 Nov 2021 13:23:23 +0000 (15:23 +0200)]
Restore variable load IDs for the else branch of a conditional

3 years agoIsolate expressions from surrounding composite access
Mikko Rasa [Mon, 8 Nov 2021 13:23:02 +0000 (15:23 +0200)]
Isolate expressions from surrounding composite access

3 years agoRecognize increment/decrement operators as modifying the target variable
Mikko Rasa [Mon, 8 Nov 2021 13:21:18 +0000 (15:21 +0200)]
Recognize increment/decrement operators as modifying the target variable

3 years agoBlock further inlining of a variable after component assignment
Mikko Rasa [Mon, 8 Nov 2021 00:09:11 +0000 (02:09 +0200)]
Block further inlining of a variable after component assignment

3 years agoRefactor assignment target overlap check into a function
Mikko Rasa [Mon, 8 Nov 2021 00:03:54 +0000 (02:03 +0200)]
Refactor assignment target overlap check into a function

3 years agoProcess loop initialization outside the body in UnusedVariableRemover
Mikko Rasa [Mon, 8 Nov 2021 00:01:26 +0000 (02:01 +0200)]
Process loop initialization outside the body in UnusedVariableRemover

If it's processed inside the scope of the loop, assignments to the
iteration variable may get discarded.

3 years agoMark the start of a SPIR-V function as reachable
Mikko Rasa [Sun, 7 Nov 2021 17:17:09 +0000 (19:17 +0200)]
Mark the start of a SPIR-V function as reachable

This fixes erroneously generated OpUnreachable instructions which
appeared at the end of some functions.

3 years agoCompute correct size for SPIR-V structs if the last member is an array
Mikko Rasa [Sun, 7 Nov 2021 17:15:14 +0000 (19:15 +0200)]
Compute correct size for SPIR-V structs if the last member is an array

3 years agoRemove support for array size specialization from the engine as well
Mikko Rasa [Sun, 7 Nov 2021 17:14:36 +0000 (19:14 +0200)]
Remove support for array size specialization from the engine as well

3 years agoAlways set uniform array size to at least one
Mikko Rasa [Sun, 7 Nov 2021 17:12:14 +0000 (19:12 +0200)]
Always set uniform array size to at least one

This makes it consistent between GLSL and SPIR-V.

3 years agoMove default uniform block sizing to OpenGL backend
Mikko Rasa [Sun, 7 Nov 2021 17:11:59 +0000 (19:11 +0200)]
Move default uniform block sizing to OpenGL backend

3 years agoBuild the list of glUniform* calls even for SPIR-V modules
Mikko Rasa [Sun, 7 Nov 2021 17:09:42 +0000 (19:09 +0200)]
Build the list of glUniform* calls even for SPIR-V modules

This is relevant since SPIR-V supports default block uniforms when
targeting OpenGL.

3 years agoRearrange shader reflection calls
Mikko Rasa [Sun, 7 Nov 2021 17:07:34 +0000 (19:07 +0200)]
Rearrange shader reflection calls

The OpenGL-specific query calls are now done from the OpenGL backend.

3 years agoFix reflection of vector and matrix types from SPIR-V
Mikko Rasa [Sun, 7 Nov 2021 16:56:07 +0000 (18:56 +0200)]
Fix reflection of vector and matrix types from SPIR-V

3 years agoFix GLSL matrix construction from individual elements
Mikko Rasa [Sun, 7 Nov 2021 14:12:11 +0000 (16:12 +0200)]
Fix GLSL matrix construction from individual elements

3 years agoGenerate correct OpPhi instructions for nested ternary expressions
Mikko Rasa [Sun, 7 Nov 2021 14:06:09 +0000 (16:06 +0200)]
Generate correct OpPhi instructions for nested ternary expressions

The parent blocks must be immediate predecessors of the block containing
the OpPhi instruction.

3 years agoDon't try to access parameters with a pointer access instructior
Mikko Rasa [Sun, 7 Nov 2021 14:01:06 +0000 (16:01 +0200)]
Don't try to access parameters with a pointer access instructior

3 years agoPadding is required at the end of certain SPIR-V struct members
Mikko Rasa [Sun, 7 Nov 2021 13:59:13 +0000 (15:59 +0200)]
Padding is required at the end of certain SPIR-V struct members

If the member is is itself a struct or an array, the next member must not
begin before the next alignment boundary.

3 years agoChange max_lights to a fixed constant
Mikko Rasa [Sun, 7 Nov 2021 12:38:49 +0000 (14:38 +0200)]
Change max_lights to a fixed constant

3 years agoDisallow specialization constants in certain contexts
Mikko Rasa [Sun, 7 Nov 2021 12:32:33 +0000 (14:32 +0200)]
Disallow specialization constants in certain contexts

The initialization of a specialization constant must not use other
specialization constants.

Arrays sized by a specialization constant inside structures are broken
by design because member offsets in SPIR-V are required to be literals.
Changing the size through specialization would at best leave empty space
in the struct and at worst overlap other members.

3 years agoFix size calculation for GLSL arrays
Mikko Rasa [Sun, 7 Nov 2021 12:31:38 +0000 (14:31 +0200)]
Fix size calculation for GLSL arrays

3 years agoApply implicit conversion to return expressions in GLSL functions
Mikko Rasa [Sun, 7 Nov 2021 10:46:29 +0000 (12:46 +0200)]
Apply implicit conversion to return expressions in GLSL functions

3 years agoAdd unsigned integer types to Program reflection and ProgramData
Mikko Rasa [Sun, 7 Nov 2021 09:54:01 +0000 (11:54 +0200)]
Add unsigned integer types to Program reflection and ProgramData

3 years agoDisallow bool variables in shader interface blocks
Mikko Rasa [Sun, 7 Nov 2021 09:21:35 +0000 (11:21 +0200)]
Disallow bool variables in shader interface blocks

Although OpenGL allows them in uniform blocks, SPIR-V says they can't be
used with externally visible storage classes.

3 years agoHide the allow_gl_calls member of Mesh::Loader
Mikko Rasa [Sun, 7 Nov 2021 09:04:36 +0000 (11:04 +0200)]
Hide the allow_gl_calls member of Mesh::Loader

3 years agoRemove the deprecated srgb_conversion flag from Resources
Mikko Rasa [Sun, 7 Nov 2021 08:36:42 +0000 (10:36 +0200)]
Remove the deprecated srgb_conversion flag from Resources

By now it didn't even have any effect anymore

3 years agoUse asynchronous resource loading in desertpillars
Mikko Rasa [Sun, 7 Nov 2021 08:23:56 +0000 (10:23 +0200)]
Use asynchronous resource loading in desertpillars

3 years agoRe-export desertpillars textures using external data storage
Mikko Rasa [Sun, 7 Nov 2021 08:23:07 +0000 (10:23 +0200)]
Re-export desertpillars textures using external data storage

3 years agoAvoid incorrect access to VertexSetup while async loading Mesh
Mikko Rasa [Tue, 2 Nov 2021 11:36:06 +0000 (13:36 +0200)]
Avoid incorrect access to VertexSetup while async loading Mesh

3 years agoDon't use resource manager for builtin data
Mikko Rasa [Tue, 2 Nov 2021 11:32:33 +0000 (13:32 +0200)]
Don't use resource manager for builtin data

Detecting them by the underscore at the beginning of the name feels a
little dodgy, but it will do for now.

3 years agoExplicitly cast regex match to boolean
Mikko Rasa [Tue, 2 Nov 2021 11:13:41 +0000 (13:13 +0200)]
Explicitly cast regex match to boolean

3 years agoExport texture's mipmap levels as 1 if mipmaps are not used
Mikko Rasa [Tue, 2 Nov 2021 11:11:03 +0000 (13:11 +0200)]
Export texture's mipmap levels as 1 if mipmaps are not used

3 years agoExport raw texture data to a separate file
Mikko Rasa [Tue, 2 Nov 2021 11:02:14 +0000 (13:02 +0200)]
Export raw texture data to a separate file

3 years agoSupport loading raw texture data from an external file
Mikko Rasa [Tue, 2 Nov 2021 10:17:24 +0000 (12:17 +0200)]
Support loading raw texture data from an external file

This enables async loading of pixel formats not supported by standard
image files.

3 years agoUse default member initializers in async loaders
Mikko Rasa [Tue, 2 Nov 2021 08:47:31 +0000 (10:47 +0200)]
Use default member initializers in async loaders

3 years agoMove the whole-texture image call and raw data loading to base class
Mikko Rasa [Mon, 1 Nov 2021 12:42:49 +0000 (14:42 +0200)]
Move the whole-texture image call and raw data loading to base class

This reduces duplication in the loading code and promotes uniform
behaviour across the different texture classes.

3 years agoCombine the external_image functions in Texture::Loader
Mikko Rasa [Mon, 1 Nov 2021 11:50:20 +0000 (13:50 +0200)]
Combine the external_image functions in Texture::Loader

Since DataFile::Loader now supports bound arguments, it can be used to
set the srgb flag.

3 years agoReorder functions in Sampler
Mikko Rasa [Sat, 30 Oct 2021 21:12:22 +0000 (00:12 +0300)]
Reorder functions in Sampler

3 years agoFix the type of a location variable
Mikko Rasa [Sat, 30 Oct 2021 21:11:30 +0000 (00:11 +0300)]
Fix the type of a location variable

3 years agoAdd some checks for invalid arguments
Mikko Rasa [Sat, 30 Oct 2021 20:32:18 +0000 (23:32 +0300)]
Add some checks for invalid arguments

3 years agoMake the Limits struct more robust
Mikko Rasa [Sat, 30 Oct 2021 20:29:48 +0000 (23:29 +0300)]
Make the Limits struct more robust

3 years agoAdd missing implementation of RenderMethod::set_image_based_lighting
Mikko Rasa [Sat, 30 Oct 2021 20:02:51 +0000 (23:02 +0300)]
Add missing implementation of RenderMethod::set_image_based_lighting

3 years agoImprove material handling in RenderMethod
Mikko Rasa [Sat, 30 Oct 2021 20:02:39 +0000 (23:02 +0300)]
Improve material handling in RenderMethod

3 years agoAdd uint vector types to DataType
Mikko Rasa [Sat, 30 Oct 2021 20:01:38 +0000 (23:01 +0300)]
Add uint vector types to DataType

3 years agoRename "renderable" to "content" in Effects and Scenes
Mikko Rasa [Sat, 30 Oct 2021 19:59:09 +0000 (22:59 +0300)]
Rename "renderable" to "content" in Effects and Scenes

This name better describes the relationship.

3 years agoClean up some more unused things
Mikko Rasa [Sat, 30 Oct 2021 19:54:00 +0000 (22:54 +0300)]
Clean up some more unused things

3 years agoUpdate and improve documentation
Mikko Rasa [Sat, 30 Oct 2021 19:51:30 +0000 (22:51 +0300)]
Update and improve documentation

3 years agoUse size_t to store sizes of buffers and such
Mikko Rasa [Sat, 30 Oct 2021 19:25:15 +0000 (22:25 +0300)]
Use size_t to store sizes of buffers and such

Shader reflection data can stick to 32-bit sizes, since SPIR-V's
decorations only take 32-bit operands.

3 years agoUse a sorted vector in place of set for small data
Mikko Rasa [Sat, 30 Oct 2021 19:07:48 +0000 (22:07 +0300)]
Use a sorted vector in place of set for small data

Despite having worse algorithmic performance, cache effects make the
vector faster for total data size of up to about 8 kB (YMMV).

The GLSL compiler can keep its sets for now, I'll create a proper class
for this at some point.

3 years agoRemove the exclusion mechanism from Renderer
Mikko Rasa [Sat, 30 Oct 2021 18:35:15 +0000 (21:35 +0300)]
Remove the exclusion mechanism from Renderer

It was only ever used by EnvironmentMap, which can do the filtering
itself.  Removing it makes the rendering process more straightforward,
with less function calls.

3 years agoMove sigc::trackable base from View to WindowView
Mikko Rasa [Fri, 29 Oct 2021 09:49:52 +0000 (12:49 +0300)]
Move sigc::trackable base from View to WindowView

3 years agoExplicitly specify enum values which are relied upon
Mikko Rasa [Fri, 29 Oct 2021 09:49:10 +0000 (12:49 +0300)]
Explicitly specify enum values which are relied upon

3 years agoUse default member initializers in some more classes
Mikko Rasa [Fri, 29 Oct 2021 09:48:39 +0000 (12:48 +0300)]
Use default member initializers in some more classes

3 years agoMove Bufferable::refresh_async's definition to the header
Mikko Rasa [Fri, 29 Oct 2021 09:23:32 +0000 (12:23 +0300)]
Move Bufferable::refresh_async's definition to the header

3 years agoRemove some unused and unnecessary things
Mikko Rasa [Fri, 29 Oct 2021 09:22:52 +0000 (12:22 +0300)]
Remove some unused and unnecessary things

3 years agoMake it an error to try to refresh a Bufferable without a buffer
Mikko Rasa [Fri, 29 Oct 2021 09:11:37 +0000 (12:11 +0300)]
Make it an error to try to refresh a Bufferable without a buffer

3 years agoAssign unneeded values to _ when unpacking
Mikko Rasa [Wed, 20 Oct 2021 13:06:22 +0000 (16:06 +0300)]
Assign unneeded values to _ when unpacking

3 years agoAdd an include path option to the command-line shader compiler
Mikko Rasa [Wed, 20 Oct 2021 13:05:01 +0000 (16:05 +0300)]
Add an include path option to the command-line shader compiler

3 years agoAdd debug names to things in viewer
Mikko Rasa [Wed, 20 Oct 2021 13:02:05 +0000 (16:02 +0300)]
Add debug names to things in viewer