]>
git.tdb.fi Git - libs/gl.git/log
Mikko Rasa [Sun, 21 Feb 2021 23:52:29 +0000 (01:52 +0200)]
Slightly refactor layout qualifiers in the GLSL parser
Their values are now stored as integers, since no qualifier takes a
value of any other type.
Mikko Rasa [Sun, 21 Feb 2021 23:50:19 +0000 (01:50 +0200)]
Check that requested shader stages are supported
Mikko Rasa [Sun, 21 Feb 2021 23:39:30 +0000 (01:39 +0200)]
Throw an exception if a feature required by a shader is missing
Workarounds are not always available.
Mikko Rasa [Sun, 21 Feb 2021 23:12:25 +0000 (01:12 +0200)]
Add a standalone GLSL compiler frontend
This makes debugging the compiler easier and will eventually allow
shaders to be compiled into SPIR-V during build.
Mikko Rasa [Sun, 21 Feb 2021 22:58:57 +0000 (00:58 +0200)]
Reduce coupling between the GLSL compiler and the graphics engine
Feature states are now recorded in a struct.
Mikko Rasa [Sun, 21 Feb 2021 23:02:14 +0000 (01:02 +0200)]
Header fixes in the GLSL compiler
Mikko Rasa [Sun, 21 Feb 2021 21:35:13 +0000 (23:35 +0200)]
Fix environment map uniform name
Mikko Rasa [Sun, 21 Feb 2021 21:33:32 +0000 (23:33 +0200)]
Update the desertpillars demo
Mikko Rasa [Sun, 21 Feb 2021 21:30:55 +0000 (23:30 +0200)]
Implement an unlit material type
Mikko Rasa [Sun, 21 Feb 2021 21:29:37 +0000 (23:29 +0200)]
Support addint datafile statements for uniform material properties
Mikko Rasa [Sun, 21 Feb 2021 21:28:02 +0000 (23:28 +0200)]
Add sampler parameter to RenderPass::set_texture
Mikko Rasa [Sun, 21 Feb 2021 21:26:05 +0000 (23:26 +0200)]
Add missing keyword to set sampler compare mode from datafile
Mikko Rasa [Sun, 21 Feb 2021 14:23:07 +0000 (16:23 +0200)]
Redesign the way shader programs are loaded
Vulkan uses SPIR-V modules which can be specialized so there has to be a
way to keep the module around. A module can also contain multiple shader
stages. The abstraction for individual stages with the Shader class is
outdated and has been replaced with Module.
GLSL code is stored in the Module in combined form and split into stages
when loaded to a Program.
Mikko Rasa [Sun, 21 Feb 2021 10:19:52 +0000 (12:19 +0200)]
Allow using SL::Formatter on single nodes
This is occasionally useful for debugging.
Mikko Rasa [Sun, 21 Feb 2021 03:12:28 +0000 (05:12 +0200)]
Further refactor block and scope management
TraversingVisitor now provides a current_block variable and block know
their parent block so checking if we're in the toplevel block is easy.
Mikko Rasa [Sun, 21 Feb 2021 02:39:57 +0000 (04:39 +0200)]
Tweaks to the AST debug output
Mikko Rasa [Sun, 21 Feb 2021 02:31:35 +0000 (04:31 +0200)]
Fix scoping of GLSL loop variables and function parameters
TraversingVisitor visits those before the body, so they were being
inserted into the enclosing scope's variables map.
Mikko Rasa [Sun, 21 Feb 2021 02:20:32 +0000 (04:20 +0200)]
Rewrite syntax tree modifications
BlockModifier left dangling pointers in various variable maps, which
started causing trouble when I wanted to print out the entire AST.
NodeRemover is now used for all removal operations and it properly
handles the maps.
Mikko Rasa [Sat, 20 Feb 2021 22:59:07 +0000 (00:59 +0200)]
Avoid copying raw pointers in the syntax tree
They will potentially point to incorrect nodes and must be resolved
again.
Mikko Rasa [Sat, 20 Feb 2021 22:47:44 +0000 (00:47 +0200)]
Add a visitor to dump the AST for debugging purposes
Mikko Rasa [Sat, 20 Feb 2021 18:20:47 +0000 (20:20 +0200)]
Rearrange secondary operations in GLSL compiler
These are now performed internally by the main operation visitor.
Mikko Rasa [Sat, 20 Feb 2021 18:10:30 +0000 (20:10 +0200)]
Tweaks to visitor classes in the GLSL compiler
Mikko Rasa [Sat, 20 Feb 2021 13:12:29 +0000 (15:12 +0200)]
Make RenderTargetFormat generation more robust
The functions here had accidentally gotten out of sync in
9087cc0 .
Mikko Rasa [Sat, 20 Feb 2021 12:59:44 +0000 (14:59 +0200)]
Recognize the #line directive in the GLSL parser
Also add a new pragma to specify source names.
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.
Mikko Rasa [Sat, 20 Feb 2021 11:54:24 +0000 (13:54 +0200)]
Remove support for the legacy stage change syntax
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.
Mikko Rasa [Thu, 18 Feb 2021 11:31:48 +0000 (13:31 +0200)]
Refactor the interface of SL::Compiler
Mikko Rasa [Tue, 16 Feb 2021 08:47:14 +0000 (10:47 +0200)]
Report incorrect shader stages by name
Mikko Rasa [Mon, 15 Feb 2021 16:05:46 +0000 (18:05 +0200)]
Remove unused constructors
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.
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.
Mikko Rasa [Mon, 15 Feb 2021 14:01:55 +0000 (16:01 +0200)]
Refactor the way of applying visitors to stages
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.
Mikko Rasa [Mon, 15 Feb 2021 10:12:44 +0000 (12:12 +0200)]
Move the StageType enum inside the Stage struct
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.
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.
Mikko Rasa [Sun, 14 Feb 2021 15:42:04 +0000 (17:42 +0200)]
Split tokenizer and preprocessor out of the GLSL 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.
Mikko Rasa [Sun, 14 Feb 2021 12:13:56 +0000 (14:13 +0200)]
Move the GLSL compiler entirely in its own namespace
Mikko Rasa [Sun, 14 Feb 2021 00:52:21 +0000 (02:52 +0200)]
Rearrange soucre files into subdirectories
Mikko Rasa [Sun, 14 Feb 2021 00:28:43 +0000 (02:28 +0200)]
Remove the deprecated ProgramBuilder class
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.
Mikko Rasa [Sat, 13 Feb 2021 18:53:41 +0000 (20:53 +0200)]
Support exporting "empty" materials with only a technique or shader
Mikko Rasa [Sat, 13 Feb 2021 18:41:33 +0000 (20:41 +0200)]
Refactor material property handling in the Blender exporter
Mikko Rasa [Sat, 13 Feb 2021 16:45:25 +0000 (18:45 +0200)]
Don't export plain values for texture-only material properties
Mikko Rasa [Sat, 13 Feb 2021 16:22:39 +0000 (18:22 +0200)]
Minor fixes
Mikko Rasa [Sat, 13 Feb 2021 16:05:34 +0000 (18:05 +0200)]
Add description fields to the export operators
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
Mikko Rasa [Sat, 13 Feb 2021 15:35:17 +0000 (17:35 +0200)]
Fix typos in custom property UI layout
Mikko Rasa [Sat, 13 Feb 2021 15:34:47 +0000 (17:34 +0200)]
Use the right property when collecting materials for a material map
Mikko Rasa [Sat, 13 Feb 2021 15:34:12 +0000 (17:34 +0200)]
Export texture sampling settings as sampler objects
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.
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
Mikko Rasa [Sat, 13 Feb 2021 09:42:20 +0000 (11:42 +0200)]
Add some files which got forgotten in earlier commits
Mikko Rasa [Thu, 11 Feb 2021 23:03:16 +0000 (01:03 +0200)]
Use samplers in effects and postprocessors
Mikko Rasa [Thu, 11 Feb 2021 22:19:53 +0000 (00:19 +0200)]
Support setting a sampler directly in Renderer
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.
Mikko Rasa [Sun, 7 Feb 2021 16:20:52 +0000 (18:20 +0200)]
Async load texture data directly into the pixel buffer
Mikko Rasa [Sun, 7 Feb 2021 16:20:13 +0000 (18:20 +0200)]
Fix sampler binding bug
Mikko Rasa [Sun, 7 Feb 2021 16:20:01 +0000 (18:20 +0200)]
Initialize Texture::use_srgb_format
Mikko Rasa [Sun, 7 Feb 2021 13:33:20 +0000 (15:33 +0200)]
Ensure that mapped memory is unmapped in Texture2D::AsyncLoader
Mikko Rasa [Sun, 7 Feb 2021 13:24:59 +0000 (15:24 +0200)]
Graphics::Image::get_data was renamed to get_pixels
Mikko Rasa [Sat, 6 Feb 2021 22:14:14 +0000 (00:14 +0200)]
Only mark changed fields dirty when unloading a sampler
Mikko Rasa [Sat, 6 Feb 2021 22:09:19 +0000 (00:09 +0200)]
Fix material registry initialization bug
Mikko Rasa [Sat, 6 Feb 2021 21:37:41 +0000 (23:37 +0200)]
Add sampler support to materials
Mikko Rasa [Sat, 6 Feb 2021 21:36:55 +0000 (23:36 +0200)]
Rename Material::LoaderBase to PropertyLoader
Mikko Rasa [Sat, 6 Feb 2021 17:46:31 +0000 (19:46 +0200)]
Avoid invalid memory access when destroying Mesh
Mikko Rasa [Sat, 6 Feb 2021 13:28:46 +0000 (15:28 +0200)]
Allow samplers to be loaded from datafiles
Mikko Rasa [Sat, 6 Feb 2021 13:27:53 +0000 (15:27 +0200)]
Support samplers as independent objects
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.
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.
Mikko Rasa [Wed, 3 Feb 2021 22:58:19 +0000 (00:58 +0200)]
Refactor texture external image loading into a helper function
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
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.
Mikko Rasa [Mon, 1 Feb 2021 19:18:29 +0000 (21:18 +0200)]
Support BGR and BGRA as texture formats through swizzling
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.
Mikko Rasa [Mon, 1 Feb 2021 16:19:36 +0000 (18:19 +0200)]
Remove the deprecated form of Texture3D::load_image
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.
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.
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
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.
Mikko Rasa [Sun, 31 Jan 2021 00:09:16 +0000 (02:09 +0200)]
Move filter heuristic for mipmap levels to Texture::Loader
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.
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.
Mikko Rasa [Tue, 26 Jan 2021 23:49:00 +0000 (01:49 +0200)]
Remove the usage member from Buffer entirely
Mikko Rasa [Mon, 25 Jan 2021 23:47:05 +0000 (01:47 +0200)]
Clear Texture2D's allocation flags when unloading
Mikko Rasa [Mon, 25 Jan 2021 23:41:16 +0000 (01:41 +0200)]
Disallow drawing batches without an index buffer
Mikko Rasa [Mon, 25 Jan 2021 23:38:57 +0000 (01:38 +0200)]
Give a name to the ResourceManager loading thread
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
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.
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.
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.
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
Mikko Rasa [Mon, 25 Jan 2021 02:18:50 +0000 (04:18 +0200)]
Minor comment adjustments
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.
Mikko Rasa [Mon, 25 Jan 2021 02:15:02 +0000 (04:15 +0200)]
Remove commented out debugging statements
Mikko Rasa [Mon, 25 Jan 2021 02:14:35 +0000 (04:14 +0200)]
Add some hints for older compilers
Mikko Rasa [Mon, 25 Jan 2021 02:13:10 +0000 (04:13 +0200)]
Add datafile statement which was apparently forgotten
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.