]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoDecorate builtin variables in the global scope
Mikko Rasa [Sun, 10 Oct 2021 12:48:46 +0000 (15:48 +0300)]
Decorate builtin variables in the global scope

3 years agoRemove output variables which are not referenced
Mikko Rasa [Sun, 10 Oct 2021 12:37:07 +0000 (15:37 +0300)]
Remove output variables which are not referenced

3 years agoSupport redeclaring builtins defined in an interface block
Mikko Rasa [Sun, 10 Oct 2021 11:49:59 +0000 (14:49 +0300)]
Support redeclaring builtins defined in an interface block

3 years agoRemove support for redeclaring user-defined variables
Mikko Rasa [Sun, 10 Oct 2021 11:40:52 +0000 (14:40 +0300)]
Remove support for redeclaring user-defined variables

... with the exception of redeclaring a previously unsized array.
Builtin array sizes can also now be redeclared.

3 years agoRemove some unused code from UnusedVariableRemover
Mikko Rasa [Sun, 10 Oct 2021 11:14:54 +0000 (14:14 +0300)]
Remove some unused code from UnusedVariableRemover

The interface_block variable has always been null since dfcf8eb.

3 years agoOnly remove load IDs of variables actually assigned in a loop
Mikko Rasa [Sun, 10 Oct 2021 08:54:24 +0000 (11:54 +0300)]
Only remove load IDs of variables actually assigned in a loop

Some variables like function arguments are not pointers and can't be
loaded again.

3 years agoFix the type of a loop variable
Mikko Rasa [Sun, 10 Oct 2021 08:51:54 +0000 (11:51 +0300)]
Fix the type of a loop variable

This was a transcription error introduced in e9a898f.

3 years agoDon't dismantle aggregates which are function parameters
Mikko Rasa [Sun, 10 Oct 2021 08:51:04 +0000 (11:51 +0300)]
Don't dismantle aggregates which are function parameters

3 years agoDetermine the default uniform block size regardless of module format
Mikko Rasa [Sun, 10 Oct 2021 08:48:24 +0000 (11:48 +0300)]
Determine the default uniform block size regardless of module format

3 years agoChange various generated texture names to use the unified extension
Mikko Rasa [Sat, 9 Oct 2021 17:59:44 +0000 (20:59 +0300)]
Change various generated texture names to use the unified extension

3 years agoAdd attenuation calculations and related export code for point lights
Mikko Rasa [Sat, 9 Oct 2021 17:58:14 +0000 (20:58 +0300)]
Add attenuation calculations and related export code for point lights

3 years agoPass the queried position as an argument to get_shadow_factor
Mikko Rasa [Sat, 9 Oct 2021 17:54:27 +0000 (20:54 +0300)]
Pass the queried position as an argument to get_shadow_factor

3 years agoSome refactoring of light calculations in shaders
Mikko Rasa [Sat, 9 Oct 2021 17:47:39 +0000 (20:47 +0300)]
Some refactoring of light calculations in shaders

3 years agoAdd export_light to the list of reloadable files in the Blender exporter
Mikko Rasa [Sat, 9 Oct 2021 17:09:45 +0000 (20:09 +0300)]
Add export_light to the list of reloadable files in the Blender exporter

3 years agoAlso break up arrays which are only indexed by constants
Mikko Rasa [Sat, 9 Oct 2021 16:58:51 +0000 (19:58 +0300)]
Also break up arrays which are only indexed by constants

3 years agoRecognize unknown index as matching any index
Mikko Rasa [Sat, 9 Oct 2021 16:46:27 +0000 (19:46 +0300)]
Recognize unknown index as matching any index

If an array is accessed with an unknown index, all assignments to the
array must be kept.

3 years agoBreak up struct variables if they're not used as a whole
Mikko Rasa [Sat, 9 Oct 2021 16:44:06 +0000 (19:44 +0300)]
Break up struct variables if they're not used as a whole

This lets the optimizer inline or discard individual members depending
on how or if they're used.

3 years agoUse default member initializers for simple types
Mikko Rasa [Sat, 9 Oct 2021 11:11:09 +0000 (14:11 +0300)]
Use default member initializers for simple types

Also mark special member functions as defaulted instead of defining them
as empty.

3 years agoMake Light's constructor protected and add a virtual destructor
Mikko Rasa [Sat, 9 Oct 2021 10:24:37 +0000 (13:24 +0300)]
Make Light's constructor protected and add a virtual destructor

3 years agoAdd an option to use a fixed position in EnvironmentMap
Mikko Rasa [Sat, 9 Oct 2021 09:52:29 +0000 (12:52 +0300)]
Add an option to use a fixed position in EnvironmentMap

This allows environment maps which are not tied to a particular object.

It's required for 0b76663 but I forgot to commit it before that.

3 years agoConsider expressions in array sizes when comparing types for equality
Mikko Rasa [Fri, 8 Oct 2021 07:14:22 +0000 (10:14 +0300)]
Consider expressions in array sizes when comparing types for equality

3 years agoRemove unfinished light properties panel from the blender exporter
Mikko Rasa [Fri, 8 Oct 2021 06:53:56 +0000 (09:53 +0300)]
Remove unfinished light properties panel from the blender exporter

This was accidentally added in 7ae4af7 even though the things it's going
to be used with are not ready yet.  I will add it back later.

3 years agoUse image-based lighting in the entire desert pillars scene
Mikko Rasa [Fri, 8 Oct 2021 06:52:47 +0000 (09:52 +0300)]
Use image-based lighting in the entire desert pillars scene

3 years agoAdd a shadowing term from the planet to atmospheric transmittance
Mikko Rasa [Fri, 8 Oct 2021 06:16:41 +0000 (09:16 +0300)]
Add a shadowing term from the planet to atmospheric transmittance

This makes the sky properly dark if the sun is below the horizon.

3 years agoUse the shadow camera's projection matrix to form the shadow matrix
Mikko Rasa [Thu, 7 Oct 2021 15:04:19 +0000 (18:04 +0300)]
Use the shadow camera's projection matrix to form the shadow matrix

This makes it easier to support different types of projection, such as
perspective projection for point lights.

3 years agoRe-export desertpillars data to incorporate recent changes
Mikko Rasa [Thu, 7 Oct 2021 13:07:14 +0000 (16:07 +0300)]
Re-export desertpillars data to incorporate recent changes

3 years agoLoad textures in a type-generic way
Mikko Rasa [Thu, 7 Oct 2021 13:04:57 +0000 (16:04 +0300)]
Load textures in a type-generic way

3 years agoAdd keywords for light and material to Resources::Loader
Mikko Rasa [Thu, 7 Oct 2021 12:58:53 +0000 (15:58 +0300)]
Add keywords for light and material to Resources::Loader

Since they're loaded with a generic loader now, the standard keyword
mechanism can't handle them.

3 years agoUse set_manager instead of passing the manager to the constructor
Mikko Rasa [Thu, 7 Oct 2021 08:23:57 +0000 (11:23 +0300)]
Use set_manager instead of passing the manager to the constructor

This allows always using the parameterless constructor, making some
things easier.

3 years agoRename OpenGLTexture::generate_id to create
Mikko Rasa [Thu, 7 Oct 2021 08:22:00 +0000 (11:22 +0300)]
Rename OpenGLTexture::generate_id to create

3 years agoAlways delay texture creation until it is allocated
Mikko Rasa [Thu, 7 Oct 2021 08:19:44 +0000 (11:19 +0300)]
Always delay texture creation until it is allocated

This allows greateer flexibility with setting a resource manager.

3 years agoFix loading of inline materials and lights
Mikko Rasa [Wed, 6 Oct 2021 21:04:37 +0000 (00:04 +0300)]
Fix loading of inline materials and lights

3 years agoSplit the Light class into subclasses by light type
Mikko Rasa [Wed, 6 Oct 2021 08:15:42 +0000 (11:15 +0300)]
Split the Light class into subclasses by light type

There are some cases where it would be inconvenient for a light to
suddenly change type.

3 years agoStore materials and scenes using actual types
Mikko Rasa [Tue, 5 Oct 2021 22:19:53 +0000 (01:19 +0300)]
Store materials and scenes using actual types

3 years agoAdjust creator and notify functions in Resources
Mikko Rasa [Tue, 5 Oct 2021 21:05:53 +0000 (00:05 +0300)]
Adjust creator and notify functions in Resources

3 years agoUse DynamicObjectLoader for Material and Scene generic loaders
Mikko Rasa [Tue, 5 Oct 2021 11:49:25 +0000 (14:49 +0300)]
Use DynamicObjectLoader for Material and Scene generic loaders

3 years agoRemove collection-less constructor overloads from most loaders
Mikko Rasa [Tue, 5 Oct 2021 10:18:52 +0000 (13:18 +0300)]
Remove collection-less constructor overloads from most loaders

These classes are extremely likely to require references to other
objects, and requiring a collection makes the code more straightforward.

3 years agoUnify the loader wrappers for Material and Scene
Mikko Rasa [Mon, 4 Oct 2021 17:10:19 +0000 (20:10 +0300)]
Unify the loader wrappers for Material and Scene

3 years agoRefactor ShadowMap to support multiple lights
Mikko Rasa [Mon, 4 Oct 2021 17:09:08 +0000 (20:09 +0300)]
Refactor ShadowMap to support multiple lights

3 years agoSet viewport and scissor before clear commands
Mikko Rasa [Sun, 3 Oct 2021 18:39:33 +0000 (21:39 +0300)]
Set viewport and scissor before clear commands

Since this requires applying the pipeline state, using DSA for the clear
commands seems pointless and was removed to simplify the code.

3 years agoRemove conditional and iteration statements with no effect from GLSL
Mikko Rasa [Sun, 3 Oct 2021 13:15:05 +0000 (16:15 +0300)]
Remove conditional and iteration statements with no effect from GLSL

3 years agoFix a compile error in the GLSL compiler test runner
Mikko Rasa [Sun, 3 Oct 2021 11:47:16 +0000 (14:47 +0300)]
Fix a compile error in the GLSL compiler test runner

3 years agoSupport multiple lights in a single pass
Mikko Rasa [Sun, 3 Oct 2021 10:57:19 +0000 (13:57 +0300)]
Support multiple lights in a single pass

Light direction is now computed in fragment shader because interface
variable locations can't use specialization constants.

Shadow map currently only affects the first light but will be improved
soon.

3 years agoRemove unused world_halfway_dir variable from common.glsl
Mikko Rasa [Sun, 3 Oct 2021 10:44:15 +0000 (13:44 +0300)]
Remove unused world_halfway_dir variable from common.glsl

3 years agoRe-export desertpillars data
Mikko Rasa [Sun, 3 Oct 2021 00:13:02 +0000 (03:13 +0300)]
Re-export desertpillars data

3 years agoRename RenderPass to RenderMethod
Mikko Rasa [Sat, 2 Oct 2021 16:23:36 +0000 (19:23 +0300)]
Rename RenderPass to RenderMethod

This is mostly to avoid confusion with Vulkan's render passes, which are
an entirely different thing.

3 years agoRemove deprecated interfaces from material and lighting code
Mikko Rasa [Sat, 2 Oct 2021 11:05:00 +0000 (14:05 +0300)]
Remove deprecated interfaces from material and lighting code

3 years agoAccess the tag name map with a function
Mikko Rasa [Sat, 2 Oct 2021 10:57:01 +0000 (13:57 +0300)]
Access the tag name map with a function

Otherwise declaring tag constants as static members of classes is
unreliable because of the undefined initialization order of globals
in different translation units.

3 years agoUse constructor delegation instead of init functions when possible
Mikko Rasa [Fri, 1 Oct 2021 19:09:54 +0000 (22:09 +0300)]
Use constructor delegation instead of init functions when possible

3 years agoDon't use an internal depth test in ShadowMap
Mikko Rasa [Fri, 1 Oct 2021 18:22:18 +0000 (21:22 +0300)]
Don't use an internal depth test in ShadowMap

It's expected that the content renderable is a Sequence which supplies
the necessary state.

3 years agoSome more cleanup of includes and forward declarations
Mikko Rasa [Fri, 1 Oct 2021 18:03:34 +0000 (21:03 +0300)]
Some more cleanup of includes and forward declarations

3 years agoStore query pool size separately, in the common part of the class
Mikko Rasa [Fri, 1 Oct 2021 17:00:17 +0000 (20:00 +0300)]
Store query pool size separately, in the common part of the class

3 years agoMove all OpenGL-specific code to a separate directory
Mikko Rasa [Fri, 1 Oct 2021 16:58:11 +0000 (19:58 +0300)]
Move all OpenGL-specific code to a separate directory

3 years agoUse QueryPool in OccludedScene
Mikko Rasa [Fri, 1 Oct 2021 16:43:35 +0000 (19:43 +0300)]
Use QueryPool in OccludedScene

3 years agoRefactor VertexSetup format checking
Mikko Rasa [Fri, 1 Oct 2021 16:35:32 +0000 (19:35 +0300)]
Refactor VertexSetup format checking

3 years agoAlways require EXT_texture3D and ARB_shadow for samplers
Mikko Rasa [Fri, 1 Oct 2021 16:11:51 +0000 (19:11 +0300)]
Always require EXT_texture3D and ARB_shadow for samplers

These are fairly old extensions and can be assumed to be always
available.

3 years agoTweak handling flags in PipelineState::set_framebuffer
Mikko Rasa [Fri, 1 Oct 2021 15:26:07 +0000 (18:26 +0300)]
Tweak handling flags in PipelineState::set_framebuffer

Viewports work slightly differently on Vulkan, so set only the
framebuffer flag here and instead check both when applying the state.

3 years agoUse friend declaration to access hidden data in Batch
Mikko Rasa [Fri, 1 Oct 2021 14:00:56 +0000 (17:00 +0300)]
Use friend declaration to access hidden data in Batch

3 years agoAdd an abstraction for queries
Mikko Rasa [Fri, 1 Oct 2021 09:51:31 +0000 (12:51 +0300)]
Add an abstraction for queries

3 years agoAdd color write mask to blend state
Mikko Rasa [Fri, 1 Oct 2021 09:48:01 +0000 (12:48 +0300)]
Add color write mask to blend state

3 years agoMake backend idenfication more generic
Mikko Rasa [Thu, 30 Sep 2021 21:11:46 +0000 (00:11 +0300)]
Make backend idenfication more generic

The API and version queries are now in their own file and extension.h is
reserved for the OpenGL extension mechanism.

3 years agoStore GLSL features in DeviceInfo
Mikko Rasa [Thu, 30 Sep 2021 20:57:16 +0000 (23:57 +0300)]
Store GLSL features in DeviceInfo

This makes the GLSL compiler independent of any OpenGL-specific code.

3 years agoWrap Limits into a DeviceInfo struct
Mikko Rasa [Thu, 30 Sep 2021 18:24:32 +0000 (21:24 +0300)]
Wrap Limits into a DeviceInfo struct

This allows adding more types of information.

3 years agoAlways use instanced rendering in InstanceArray
Mikko Rasa [Thu, 30 Sep 2021 14:15:22 +0000 (17:15 +0300)]
Always use instanced rendering in InstanceArray

All the required extensions are present in OpenGL 3.3, so there's little
reason to keep the fallback code.

3 years agoClean up includes and forward declarations for the core classes
Mikko Rasa [Thu, 30 Sep 2021 13:23:43 +0000 (16:23 +0300)]
Clean up includes and forward declarations for the core classes

3 years agoCompletely hide OpenGL from the public headers
Mikko Rasa [Thu, 30 Sep 2021 13:19:48 +0000 (16:19 +0300)]
Completely hide OpenGL from the public headers

3 years agoRefactor uploading texture data from a buffer
Mikko Rasa [Thu, 30 Sep 2021 11:50:19 +0000 (14:50 +0300)]
Refactor uploading texture data from a buffer

This allows getting rid of Buffer::get_id() and using a friend
declaration instead.

3 years agoAdd an srgb flag to pixelformat_from_image
Mikko Rasa [Thu, 30 Sep 2021 11:28:14 +0000 (14:28 +0300)]
Add an srgb flag to pixelformat_from_image

This simplifies the pixel format handling in the texture classes.

3 years agoEliminate the polymorphic Uniform class hierarchy
Mikko Rasa [Tue, 28 Sep 2021 22:49:20 +0000 (01:49 +0300)]
Eliminate the polymorphic Uniform class hierarchy

Dynamically allocating a separate object for every uniform is not very
cache friendly.  ProgramData now stores uniform values in a single memory
block instead.

3 years agoAdd a TypeTraits struct to convert C++ types into DataType enum values
Mikko Rasa [Tue, 28 Sep 2021 22:42:30 +0000 (01:42 +0300)]
Add a TypeTraits struct to convert C++ types into DataType enum values

3 years agoRemove the deprecated texunit-based texture assignments from RenderPass
Mikko Rasa [Tue, 28 Sep 2021 13:47:58 +0000 (16:47 +0300)]
Remove the deprecated texunit-based texture assignments from RenderPass

3 years agoStore default-block uniform data in a memory block
Mikko Rasa [Tue, 28 Sep 2021 09:29:47 +0000 (12:29 +0300)]
Store default-block uniform data in a memory block

This is more cache-friendly than using individually allocated polymorphic
objects.  It also makes it easier to use push constants in Vulkan.

3 years agoSet array and matrix strides for default-block uniforms
Mikko Rasa [Tue, 28 Sep 2021 09:22:51 +0000 (12:22 +0300)]
Set array and matrix strides for default-block uniforms

These are based on the client memory layout required by glUniform* calls.

3 years agoRestructure Program to remove linking from the public interface
Mikko Rasa [Sun, 26 Sep 2021 13:41:03 +0000 (16:41 +0300)]
Restructure Program to remove linking from the public interface

It doesn't map to Vulkan at all.  Doing it from add_stages also
simplifies handling some temporary data.

3 years agoSplit reflection data from Program to a separate struct
Mikko Rasa [Sun, 26 Sep 2021 11:32:25 +0000 (14:32 +0300)]
Split reflection data from Program to a separate struct

This is necessary for splitting the API-specific code.

3 years agoRemove the misc.h header
Mikko Rasa [Sun, 26 Sep 2021 11:22:26 +0000 (14:22 +0300)]
Remove the misc.h header

It was mostly unused already.

3 years agoRemove the now unused BufferBits enum
Mikko Rasa [Sat, 25 Sep 2021 15:39:47 +0000 (18:39 +0300)]
Remove the now unused BufferBits enum

3 years agoAutomatically detect which multisample buffers to resolve
Mikko Rasa [Sat, 25 Sep 2021 15:37:32 +0000 (18:37 +0300)]
Automatically detect which multisample buffers to resolve

3 years agoClear the pipeline state through Commands
Mikko Rasa [Sat, 25 Sep 2021 11:34:20 +0000 (14:34 +0300)]
Clear the pipeline state through Commands

3 years agoRestore sampler refresh call
Mikko Rasa [Sat, 25 Sep 2021 11:20:54 +0000 (14:20 +0300)]
Restore sampler refresh call

This got accidentally removed in 2e09b4f.

3 years agoRe-export desertpillars data with clear values
Mikko Rasa [Sat, 25 Sep 2021 11:07:34 +0000 (14:07 +0300)]
Re-export desertpillars data with clear values

3 years agoMake it possible to specify explicit clear values
Mikko Rasa [Sat, 25 Sep 2021 11:06:53 +0000 (14:06 +0300)]
Make it possible to specify explicit clear values

3 years agoMake clearing the render target a responsibility of Sequence
Mikko Rasa [Sat, 25 Sep 2021 11:03:58 +0000 (14:03 +0300)]
Make clearing the render target a responsibility of Sequence

3 years agoAllow creating sequences without size
Mikko Rasa [Fri, 24 Sep 2021 22:38:59 +0000 (01:38 +0300)]
Allow creating sequences without size

Also require a frame format when a size is specified.  Sequences used as
content renderables of effects commonly have no postprocessors, in which
case internal render targets are not needed either and the size is not
meaningful.

3 years agoRemove the View and Framebuffer constructors from Sequence
Mikko Rasa [Fri, 24 Sep 2021 21:41:51 +0000 (00:41 +0300)]
Remove the View and Framebuffer constructors from Sequence

They had no other purpose than to take the size from the other object,
and that fits better in SequenceBuilder.

3 years agoQuery the attachments of the default framebuffer
Mikko Rasa [Sun, 19 Sep 2021 11:04:02 +0000 (14:04 +0300)]
Query the attachments of the default framebuffer

The exact pixel formats are unimportant for now and would be somewhat
convoluted to query.

3 years agoCheck supported attachment formats in Framebuffer::set_format
Mikko Rasa [Sun, 19 Sep 2021 10:37:13 +0000 (13:37 +0300)]
Check supported attachment formats in Framebuffer::set_format

3 years agoRemove the FramebufferStatus enum
Mikko Rasa [Sun, 19 Sep 2021 10:36:23 +0000 (13:36 +0300)]
Remove the FramebufferStatus enum

It's not easily supportable on Vulkan.

3 years agoInitialize Texture's format to an invalid value
Mikko Rasa [Sun, 19 Sep 2021 10:33:18 +0000 (13:33 +0300)]
Initialize Texture's format to an invalid value

This makes it possible to determine if a texture has storage defined or
not.

3 years agoUse friend declarations to access OpenGL IDs of objects
Mikko Rasa [Sat, 18 Sep 2021 12:57:24 +0000 (15:57 +0300)]
Use friend declarations to access OpenGL IDs of objects

This seems neater than exposing get_id() methods to the public.

Texture2D::AsyncLoader still uses get_id() on the PBO for now, since
it's not reasonably possible to name that class as a friend.

3 years agoAdd missing Require to Commands::resolve_multisample
Mikko Rasa [Sat, 18 Sep 2021 12:54:11 +0000 (15:54 +0300)]
Add missing Require to Commands::resolve_multisample

3 years agoMake the sampler-related enums independent of OpenGL constants
Mikko Rasa [Sat, 18 Sep 2021 12:40:30 +0000 (15:40 +0300)]
Make the sampler-related enums independent of OpenGL constants

3 years agoMake the TextureCubeFace enum independent of OpenGL constants
Mikko Rasa [Sat, 18 Sep 2021 12:21:09 +0000 (15:21 +0300)]
Make the TextureCubeFace enum independent of OpenGL constants

3 years agoMark constant data as const
Mikko Rasa [Sat, 18 Sep 2021 12:15:32 +0000 (15:15 +0300)]
Mark constant data as const

3 years agoOnly enable seamless cube map once
Mikko Rasa [Sat, 18 Sep 2021 11:54:48 +0000 (14:54 +0300)]
Only enable seamless cube map once

3 years agoRemove the separate allocation step from textures and buffers
Mikko Rasa [Sat, 18 Sep 2021 09:56:18 +0000 (12:56 +0300)]
Remove the separate allocation step from textures and buffers

It was conceived as a way to avoid unnecessary OpenGL calls if the object
is initialized by uploading full contents.  However the storage extensions
are almost universally supported now and data uploads are not something
that usually happens every frame, so this optimization is no longer
relevant.

3 years agoRemove remaining deprecated things from the core classes
Mikko Rasa [Sat, 18 Sep 2021 09:07:54 +0000 (12:07 +0300)]
Remove remaining deprecated things from the core classes

3 years agoRemove unnecessary std:: qualifiers
Mikko Rasa [Sat, 18 Sep 2021 00:30:23 +0000 (03:30 +0300)]
Remove unnecessary std:: qualifiers

3 years agoSpecify underlying type for format descriptor enums
Mikko Rasa [Fri, 17 Sep 2021 23:56:23 +0000 (02:56 +0300)]
Specify underlying type for format descriptor enums

This makes it possible to use them directory in the associated format
structs without increasing their size.

3 years agoUse standard fixed-size integer types
Mikko Rasa [Fri, 17 Sep 2021 23:31:16 +0000 (02:31 +0300)]
Use standard fixed-size integer types