]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoTrack source names in SL::Module
Mikko Rasa [Sat, 20 Feb 2021 12:42:19 +0000 (14:42 +0200)]
Track source names in SL::Module

Error translation has also been moved to a separate class.  This will
allow moving the creation of shaders to Program.

3 years agoRemove support for the legacy stage change syntax
Mikko Rasa [Sat, 20 Feb 2021 11:54:24 +0000 (13:54 +0200)]
Remove support for the legacy stage change syntax

3 years agoLoad various built-in things through Resources
Mikko Rasa [Fri, 19 Feb 2021 16:40:30 +0000 (18:40 +0200)]
Load various built-in things through Resources

There's so many of them that managing them manually is becoming too
tedious.  Especially with some planned shader changes.

3 years agoRefactor the interface of SL::Compiler
Mikko Rasa [Thu, 18 Feb 2021 11:31:48 +0000 (13:31 +0200)]
Refactor the interface of SL::Compiler

3 years agoReport incorrect shader stages by name
Mikko Rasa [Tue, 16 Feb 2021 08:47:14 +0000 (10:47 +0200)]
Report incorrect shader stages by name

3 years agoRemove unused constructors
Mikko Rasa [Mon, 15 Feb 2021 16:05:46 +0000 (18:05 +0200)]
Remove unused constructors

3 years agoAdjust member access of the various visitors in the GLSL compiler
Mikko Rasa [Mon, 15 Feb 2021 16:04:53 +0000 (18:04 +0200)]
Adjust member access of the various visitors in the GLSL compiler

Most of them don't work properly if given some random node to start with.

3 years agoRefactor creation of the shader builtin module
Mikko Rasa [Mon, 15 Feb 2021 15:50:03 +0000 (17:50 +0200)]
Refactor creation of the shader builtin module

It can now use VariableResolver::apply like everything else.

3 years agoRefactor the way of applying visitors to stages
Mikko Rasa [Mon, 15 Feb 2021 14:01:55 +0000 (16:01 +0200)]
Refactor the way of applying visitors to stages

3 years agoRefactor handling of texture sampling functions in LegacyConverter
Mikko Rasa [Mon, 15 Feb 2021 11:25:37 +0000 (13:25 +0200)]
Refactor handling of texture sampling functions in LegacyConverter

This structure allows to check support for sampler types which don't
have legacy variants for the texture function.

3 years agoMove the StageType enum inside the Stage struct
Mikko Rasa [Mon, 15 Feb 2021 10:12:44 +0000 (12:12 +0200)]
Move the StageType enum inside the Stage struct

3 years agoSplit SL::Compiler into several files
Mikko Rasa [Mon, 15 Feb 2021 09:13:07 +0000 (11:13 +0200)]
Split SL::Compiler into several files

It was getting rather unwieldy at over 2000 lines, but now that this
subsystem has its own directory and namespace I can organize it better
without interfering with the other parts.

3 years agoFollow the GLSL syntax rules more closely
Mikko Rasa [Sun, 14 Feb 2021 17:56:15 +0000 (19:56 +0200)]
Follow the GLSL syntax rules more closely

Fix a bug which allowed preprocessor directives anywhere on a line,
reject characters which are not allowed in GLSL, and parse numeric
literals more robustly.

3 years agoSplit tokenizer and preprocessor out of the GLSL parser
Mikko Rasa [Sun, 14 Feb 2021 15:42:04 +0000 (17:42 +0200)]
Split tokenizer and preprocessor out of the GLSL parser

3 years agoRefactor error reporting in SL::Parser
Mikko Rasa [Sun, 14 Feb 2021 14:57:32 +0000 (16:57 +0200)]
Refactor error reporting in SL::Parser

There's now dedicated exception classes which take care of the
formatting.

3 years agoMove the GLSL compiler entirely in its own namespace
Mikko Rasa [Sun, 14 Feb 2021 12:13:56 +0000 (14:13 +0200)]
Move the GLSL compiler entirely in its own namespace

3 years agoRearrange soucre files into subdirectories
Mikko Rasa [Sun, 14 Feb 2021 00:52:21 +0000 (02:52 +0200)]
Rearrange soucre files into subdirectories

3 years agoRemove the deprecated ProgramBuilder class
Mikko Rasa [Sun, 14 Feb 2021 00:28:43 +0000 (02:28 +0200)]
Remove the deprecated ProgramBuilder class

3 years agoFix filename handling in the Blender exporter on Windows
Mikko Rasa [Sat, 13 Feb 2021 20:08:01 +0000 (22:08 +0200)]
Fix filename handling in the Blender exporter on Windows

os.path.basename seems to consider the // prefix to indicate a UNC
path and will return an empty string if the path contains exactly
two components.

3 years agoSupport exporting "empty" materials with only a technique or shader
Mikko Rasa [Sat, 13 Feb 2021 18:53:41 +0000 (20:53 +0200)]
Support exporting "empty" materials with only a technique or shader

3 years agoRefactor material property handling in the Blender exporter
Mikko Rasa [Sat, 13 Feb 2021 18:41:33 +0000 (20:41 +0200)]
Refactor material property handling in the Blender exporter

3 years agoDon't export plain values for texture-only material properties
Mikko Rasa [Sat, 13 Feb 2021 16:45:25 +0000 (18:45 +0200)]
Don't export plain values for texture-only material properties

3 years agoMinor fixes
Mikko Rasa [Sat, 13 Feb 2021 16:22:39 +0000 (18:22 +0200)]
Minor fixes

3 years agoAdd description fields to the export operators
Mikko Rasa [Sat, 13 Feb 2021 16:05:34 +0000 (18:05 +0200)]
Add description fields to the export operators

3 years agoAdd an exporter setting to export all selected objects or meshes at once
Mikko Rasa [Sat, 13 Feb 2021 15:39:45 +0000 (17:39 +0200)]
Add an exporter setting to export all selected objects or meshes at once

3 years agoFix typos in custom property UI layout
Mikko Rasa [Sat, 13 Feb 2021 15:35:17 +0000 (17:35 +0200)]
Fix typos in custom property UI layout

3 years agoUse the right property when collecting materials for a material map
Mikko Rasa [Sat, 13 Feb 2021 15:34:47 +0000 (17:34 +0200)]
Use the right property when collecting materials for a material map

3 years agoExport texture sampling settings as sampler objects
Mikko Rasa [Sat, 13 Feb 2021 15:34:12 +0000 (17:34 +0200)]
Export texture sampling settings as sampler objects

3 years agoAdjust texture datafile statements in Blender exporter
Mikko Rasa [Sat, 13 Feb 2021 13:53:55 +0000 (15:53 +0200)]
Adjust texture datafile statements in Blender exporter

Sized pixel formats are now used for storage and it's only specified if
data is exported inline.

3 years agoUse min_retain_frames to decide when to clear the resource load queue
Mikko Rasa [Sat, 13 Feb 2021 11:57:23 +0000 (13:57 +0200)]
Use min_retain_frames to decide when to clear the resource load queue

3 years agoAdd some files which got forgotten in earlier commits
Mikko Rasa [Sat, 13 Feb 2021 09:42:20 +0000 (11:42 +0200)]
Add some files which got forgotten in earlier commits

3 years agoUse samplers in effects and postprocessors
Mikko Rasa [Thu, 11 Feb 2021 23:03:16 +0000 (01:03 +0200)]
Use samplers in effects and postprocessors

3 years agoSupport setting a sampler directly in Renderer
Mikko Rasa [Thu, 11 Feb 2021 22:19:53 +0000 (00:19 +0200)]
Support setting a sampler directly in Renderer

3 years agoBetter lifecycle management of the fullscreen quad in PostProcessor
Mikko Rasa [Mon, 8 Feb 2021 11:51:44 +0000 (13:51 +0200)]
Better lifecycle management of the fullscreen quad in PostProcessor

It's now stored in a WeakPtr and the postprocessor instances hold
a RefPtr to it, so it will be deleted together with the last
postprocessor.

3 years agoAsync load texture data directly into the pixel buffer
Mikko Rasa [Sun, 7 Feb 2021 16:20:52 +0000 (18:20 +0200)]
Async load texture data directly into the pixel buffer

3 years agoFix sampler binding bug
Mikko Rasa [Sun, 7 Feb 2021 16:20:13 +0000 (18:20 +0200)]
Fix sampler binding bug

3 years agoInitialize Texture::use_srgb_format
Mikko Rasa [Sun, 7 Feb 2021 16:20:01 +0000 (18:20 +0200)]
Initialize Texture::use_srgb_format

3 years agoEnsure that mapped memory is unmapped in Texture2D::AsyncLoader
Mikko Rasa [Sun, 7 Feb 2021 13:33:20 +0000 (15:33 +0200)]
Ensure that mapped memory is unmapped in Texture2D::AsyncLoader

3 years agoGraphics::Image::get_data was renamed to get_pixels
Mikko Rasa [Sun, 7 Feb 2021 13:24:59 +0000 (15:24 +0200)]
Graphics::Image::get_data was renamed to get_pixels

3 years agoOnly mark changed fields dirty when unloading a sampler
Mikko Rasa [Sat, 6 Feb 2021 22:14:14 +0000 (00:14 +0200)]
Only mark changed fields dirty when unloading a sampler

3 years agoFix material registry initialization bug
Mikko Rasa [Sat, 6 Feb 2021 22:09:19 +0000 (00:09 +0200)]
Fix material registry initialization bug

3 years agoAdd sampler support to materials
Mikko Rasa [Sat, 6 Feb 2021 21:37:41 +0000 (23:37 +0200)]
Add sampler support to materials

3 years agoRename Material::LoaderBase to PropertyLoader
Mikko Rasa [Sat, 6 Feb 2021 21:36:55 +0000 (23:36 +0200)]
Rename Material::LoaderBase to PropertyLoader

3 years agoAvoid invalid memory access when destroying Mesh
Mikko Rasa [Sat, 6 Feb 2021 17:46:31 +0000 (19:46 +0200)]
Avoid invalid memory access when destroying Mesh

3 years agoAllow samplers to be loaded from datafiles
Mikko Rasa [Sat, 6 Feb 2021 13:28:46 +0000 (15:28 +0200)]
Allow samplers to be loaded from datafiles

3 years agoSupport samplers as independent objects
Mikko Rasa [Sat, 6 Feb 2021 13:27:53 +0000 (15:27 +0200)]
Support samplers as independent objects

3 years agoDepracate the srgb parameter of Texture::image functions
Mikko Rasa [Fri, 5 Feb 2021 22:14:12 +0000 (00:14 +0200)]
Depracate the srgb parameter of Texture::image functions

Now that texture datafiles can be used to specify import settings on a
per-texture basis and the Blender exporter uses them, there's no need
for this anymore.

3 years agoLoad .tex2d format textures with resource manager
Mikko Rasa [Fri, 5 Feb 2021 21:30:45 +0000 (23:30 +0200)]
Load .tex2d format textures with resource manager

This allows universal use of .tex2d to specify texture settings, even
when the actual image data is loaded from an external file.

3 years agoRefactor texture external image loading into a helper function
Mikko Rasa [Wed, 3 Feb 2021 22:58:19 +0000 (00:58 +0200)]
Refactor texture external image loading into a helper function

3 years agoReorder some pixel format values
Mikko Rasa [Mon, 1 Feb 2021 20:22:04 +0000 (22:22 +0200)]
Reorder some pixel format values

They're now rougly in order from most to least used by category

3 years agoRequire texture data to be uploaded in a format matching the storage
Mikko Rasa [Mon, 1 Feb 2021 20:17:35 +0000 (22:17 +0200)]
Require texture data to be uploaded in a format matching the storage

This is almost always the case anyway.  It makes things simpler as I don't
have to figure out what to do if someone tries to upload RGB data into a
LUMINANCE_ALPHA texture, which is really an RG texture in disguise.

There are some potential exceptions, like uploading FLOAT data to a
texture with HALF_FLOAT storage.  I'll write conversion routines if those
become relevant.

3 years agoSupport BGR and BGRA as texture formats through swizzling
Mikko Rasa [Mon, 1 Feb 2021 19:18:29 +0000 (21:18 +0200)]
Support BGR and BGRA as texture formats through swizzling

3 years agoSeparate abstract pixel compositions from concrete pixel formats
Mikko Rasa [Mon, 1 Feb 2021 19:08:29 +0000 (21:08 +0200)]
Separate abstract pixel compositions from concrete pixel formats

Texture and renderbuffer storage must now be specified using a sized
pixel format.  The PixelFormat API has also been refactored.

3 years agoRemove the deprecated form of Texture3D::load_image
Mikko Rasa [Mon, 1 Feb 2021 16:19:36 +0000 (18:19 +0200)]
Remove the deprecated form of Texture3D::load_image

3 years agoAlways use swizzle to implement luminance formats
Mikko Rasa [Mon, 1 Feb 2021 12:52:05 +0000 (14:52 +0200)]
Always use swizzle to implement luminance formats

ARB_texture_swizzle was promoted to core in OpenGL 3.3 and hardware not
supporting that is obsolete.

3 years agoSimplify applying texture swizzling
Mikko Rasa [Sun, 31 Jan 2021 11:11:52 +0000 (13:11 +0200)]
Simplify applying texture swizzling

It's now set once when creating storage for the texture, so tracking its
dirty state is not necessary.

3 years agoMove texture sampler state to a separate object
Mikko Rasa [Sun, 31 Jan 2021 00:55:49 +0000 (02:55 +0200)]
Move texture sampler state to a separate object

First step in supporting sampler objects

3 years agoAllow texture mipmap levels to be specified in datafiles
Mikko Rasa [Sun, 31 Jan 2021 00:24:14 +0000 (02:24 +0200)]
Allow texture mipmap levels to be specified in datafiles

This appears to have been missed in 03d3984 which removed the filtering
heuristic from storage/allocate.

3 years agoMove filter heuristic for mipmap levels to Texture::Loader
Mikko Rasa [Sun, 31 Jan 2021 00:09:16 +0000 (02:09 +0200)]
Move filter heuristic for mipmap levels to Texture::Loader

3 years agoImprove allocation handling in cube map textures
Mikko Rasa [Sat, 30 Jan 2021 18:03:47 +0000 (20:03 +0200)]
Improve allocation handling in cube map textures

While there isn't enough bits to track all face allocations, tracking
the base level per face is possible.  This allows mipmap generation to
work more sensibly.

3 years agoDeprecate the mipmap_levels parameter in Texture
Mikko Rasa [Sat, 30 Jan 2021 17:57:58 +0000 (19:57 +0200)]
Deprecate the mipmap_levels parameter in Texture

Instead specify the desired amount of mipmap levels when loading an
image.  This can be more robustly checked against the defined storage.

3 years agoRemove the usage member from Buffer entirely
Mikko Rasa [Tue, 26 Jan 2021 23:49:00 +0000 (01:49 +0200)]
Remove the usage member from Buffer entirely

3 years agoClear Texture2D's allocation flags when unloading
Mikko Rasa [Mon, 25 Jan 2021 23:47:05 +0000 (01:47 +0200)]
Clear Texture2D's allocation flags when unloading

3 years agoDisallow drawing batches without an index buffer
Mikko Rasa [Mon, 25 Jan 2021 23:41:16 +0000 (01:41 +0200)]
Disallow drawing batches without an index buffer

3 years agoGive a name to the ResourceManager loading thread
Mikko Rasa [Mon, 25 Jan 2021 23:38:57 +0000 (01:38 +0200)]
Give a name to the ResourceManager loading thread

3 years agoDon't try to set parameters for textures which aren't loaded yet
Mikko Rasa [Mon, 25 Jan 2021 23:20:48 +0000 (01:20 +0200)]
Don't try to set parameters for textures which aren't loaded yet

3 years agoUse glCreateTextures also for async loading
Mikko Rasa [Mon, 25 Jan 2021 23:19:33 +0000 (01:19 +0200)]
Use glCreateTextures also for async loading

Otherwise the texture won't be fully created when glTextureStorage2D
is called.

3 years agoBetter way of refreshing VertexSetup
Mikko Rasa [Mon, 25 Jan 2021 23:17:52 +0000 (01:17 +0200)]
Better way of refreshing VertexSetup

It can now disable attribute arrays which are no longer used.

3 years agoRefresh vertex setup when loading vertices for a mesh
Mikko Rasa [Mon, 25 Jan 2021 23:15:18 +0000 (01:15 +0200)]
Refresh vertex setup when loading vertices for a mesh

Also add a better guard against performing OpenGL calls from the loading
thread.

3 years agoTrigger Mesh::check_buffers from MeshBuilder destructor
Mikko Rasa [Mon, 25 Jan 2021 23:01:53 +0000 (01:01 +0200)]
Trigger Mesh::check_buffers from MeshBuilder destructor

Doing it for every vertex wastes performance

3 years agoMinor comment adjustments
Mikko Rasa [Mon, 25 Jan 2021 02:18:50 +0000 (04:18 +0200)]
Minor comment adjustments

3 years agoClear offset of Bufferable when removing from buffer
Mikko Rasa [Mon, 25 Jan 2021 02:15:33 +0000 (04:15 +0200)]
Clear offset of Bufferable when removing from buffer

It shouldn't really matter but just in case.

3 years agoRemove commented out debugging statements
Mikko Rasa [Mon, 25 Jan 2021 02:15:02 +0000 (04:15 +0200)]
Remove commented out debugging statements

3 years agoAdd some hints for older compilers
Mikko Rasa [Mon, 25 Jan 2021 02:14:35 +0000 (04:14 +0200)]
Add some hints for older compilers

3 years agoAdd datafile statement which was apparently forgotten
Mikko Rasa [Mon, 25 Jan 2021 02:13:10 +0000 (04:13 +0200)]
Add datafile statement which was apparently forgotten

3 years agoRefactor setting uniform values in ProgramData
Mikko Rasa [Mon, 25 Jan 2021 02:07:49 +0000 (04:07 +0200)]
Refactor setting uniform values in ProgramData

This eliminates copies when changing values of existing uniforms.

3 years agoThrow an exception if there's too many uniforms in a ProgramData
Mikko Rasa [Mon, 25 Jan 2021 02:04:11 +0000 (04:04 +0200)]
Throw an exception if there's too many uniforms in a ProgramData

I'd rather find out I need to make the mask wider than have a program
unexplainably slow down.

3 years agoAdd another constructor to RenderTarget to resolve an ambiguity
Mikko Rasa [Mon, 25 Jan 2021 01:21:00 +0000 (03:21 +0200)]
Add another constructor to RenderTarget to resolve an ambiguity

RenderOutput looks like an unsigned more than a RenderTargetFormat so
the compiler would resolve it to the multisample overload.

3 years agoRename batch's data_type to index_type
Mikko Rasa [Mon, 25 Jan 2021 01:13:29 +0000 (03:13 +0200)]
Rename batch's data_type to index_type

3 years agoRead shader and program info logs directly into an std::string
Mikko Rasa [Mon, 25 Jan 2021 01:07:18 +0000 (03:07 +0200)]
Read shader and program info logs directly into an std::string

3 years agoMake buffer storage immutable and use ARB_buffer_storage
Mikko Rasa [Mon, 25 Jan 2021 00:56:06 +0000 (02:56 +0200)]
Make buffer storage immutable and use ARB_buffer_storage

3 years agoDeprecate some Buffer features which don't translate to Vulkan
Mikko Rasa [Mon, 25 Jan 2021 00:48:21 +0000 (02:48 +0200)]
Deprecate some Buffer features which don't translate to Vulkan

3 years agoMove buffer resizing out of Bufferable
Mikko Rasa [Mon, 25 Jan 2021 00:12:26 +0000 (02:12 +0200)]
Move buffer resizing out of Bufferable

Required for immutable buffer storage.  This commit has a couple warts
I didn't bother to fix because those parts will be rewritten.

3 years agoSome tweaks to Mesh::add_batch
Mikko Rasa [Sun, 24 Jan 2021 23:46:34 +0000 (01:46 +0200)]
Some tweaks to Mesh::add_batch

Index buffer can be assumed to exist.  Add a fast path for first batch,
which will also be useful in the next stage of buffer refactoring.

3 years agoFurther refactor Bufferable's API for derived classes
Mikko Rasa [Sun, 24 Jan 2021 16:25:51 +0000 (18:25 +0200)]
Further refactor Bufferable's API for derived classes

3 years agoClear the dirty flag of Bufferable in upload_data
Mikko Rasa [Sun, 24 Jan 2021 14:13:20 +0000 (16:13 +0200)]
Clear the dirty flag of Bufferable in upload_data

3 years agoRemove support for UInt8 indices from Batch
Mikko Rasa [Sat, 23 Jan 2021 17:27:32 +0000 (19:27 +0200)]
Remove support for UInt8 indices from Batch

Vulkan does not support them

3 years agoCollapse the shared part of Mesh::draw and draw_instanced
Mikko Rasa [Sat, 23 Jan 2021 17:26:28 +0000 (19:26 +0200)]
Collapse the shared part of Mesh::draw and draw_instanced

3 years agoIncrease version to 3.0
Mikko Rasa [Sat, 23 Jan 2021 10:01:36 +0000 (12:01 +0200)]
Increase version to 3.0

The recent modernization work has introduced some incompatible changes,
and now I'm gearing towards Vulkan support which will change the API
even more.

3 years agoUse matching type to retrieve interpolated spline values
Mikko Rasa [Sun, 17 Jan 2021 17:02:26 +0000 (19:02 +0200)]
Use matching type to retrieve interpolated spline values

This way the double-to-float conversion is done at a more relevant stage.

3 years agoConvert the extension generator script to Python 3
Mikko Rasa [Sat, 9 Jan 2021 16:53:09 +0000 (18:53 +0200)]
Convert the extension generator script to Python 3

3 years agoFix applying of single-component scaling curves
Mikko Rasa [Thu, 7 Jan 2021 22:28:19 +0000 (00:28 +0200)]
Fix applying of single-component scaling curves

3 years agoSuppress some deprecation warnings from internal use
Mikko Rasa [Thu, 7 Jan 2021 10:16:33 +0000 (12:16 +0200)]
Suppress some deprecation warnings from internal use

3 years agoAdd multiplication operators between Matrix and float
Mikko Rasa [Wed, 30 Dec 2020 15:09:15 +0000 (17:09 +0200)]
Add multiplication operators between Matrix and float

Newer gcc versions are complaining about an ambiguity between the vector
multiplication operators in GL::Matrix and the scalar multiplication for
LinAl::Matrix.

4 years agoActually use the light color in cooktorrance shader
Mikko Rasa [Sun, 2 Aug 2020 12:04:41 +0000 (15:04 +0300)]
Actually use the light color in cooktorrance shader

4 years agoUse correct shader variable names for PBR materials
Mikko Rasa [Sun, 2 Aug 2020 11:44:56 +0000 (14:44 +0300)]
Use correct shader variable names for PBR materials

4 years agoConvert exporter operator properties to annotations
Mikko Rasa [Sat, 27 Jun 2020 09:30:44 +0000 (12:30 +0300)]
Convert exporter operator properties to annotations

4 years agoReplace single file mode in object exporter with collection
Mikko Rasa [Sat, 27 Jun 2020 08:57:58 +0000 (11:57 +0300)]
Replace single file mode in object exporter with collection

4 years agoRefactor export extension change into the exporter base class
Mikko Rasa [Fri, 26 Jun 2020 23:07:02 +0000 (02:07 +0300)]
Refactor export extension change into the exporter base class

4 years agoRefactor writing files in the Blender exporter
Mikko Rasa [Fri, 26 Jun 2020 22:53:21 +0000 (01:53 +0300)]
Refactor writing files in the Blender exporter

Instead of having the same loop over statements in a dozen of places,
put it in the Resource class.