]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoStore constant id limit as range, not max value
Mikko Rasa [Sat, 3 Apr 2021 15:39:26 +0000 (18:39 +0300)]
Store constant id limit as range, not max value

3 years agoBetter checking of where the binding qualifier is allowed
Mikko Rasa [Sat, 3 Apr 2021 14:12:50 +0000 (17:12 +0300)]
Better checking of where the binding qualifier is allowed

3 years agoDisallow the descriptor set qualifier for now
Mikko Rasa [Sat, 3 Apr 2021 14:11:34 +0000 (17:11 +0300)]
Disallow the descriptor set qualifier for now

It's only meaningful for Vulkan, which isn't implemented yet

3 years agoAllocate locations to interface variables
Mikko Rasa [Sat, 3 Apr 2021 10:56:16 +0000 (13:56 +0300)]
Allocate locations to interface variables

3 years agoImprove compatibility checks of location qualifiers in various contexts
Mikko Rasa [Sat, 3 Apr 2021 10:20:34 +0000 (13:20 +0300)]
Improve compatibility checks of location qualifiers in various contexts

3 years agoEven more validation for uniform mismatches
Mikko Rasa [Sat, 3 Apr 2021 08:32:46 +0000 (11:32 +0300)]
Even more validation for uniform mismatches

3 years agoValidate location overlap and type matching for GLSL interfaces
Mikko Rasa [Fri, 2 Apr 2021 20:05:06 +0000 (23:05 +0300)]
Validate location overlap and type matching for GLSL interfaces

3 years agoAlso allocate a buffer when mapping it
Mikko Rasa [Fri, 2 Apr 2021 19:36:38 +0000 (22:36 +0300)]
Also allocate a buffer when mapping it

3 years agoFix a misformatted branch in GLSL compiler debug output
Mikko Rasa [Fri, 2 Apr 2021 15:21:28 +0000 (18:21 +0300)]
Fix a misformatted branch in GLSL compiler debug output

3 years agoStore program resource information in vectors instead of maps
Mikko Rasa [Fri, 2 Apr 2021 11:45:38 +0000 (14:45 +0300)]
Store program resource information in vectors instead of maps

3 years agoStore name in attributes collected from SPIR-V module
Mikko Rasa [Fri, 2 Apr 2021 09:54:29 +0000 (12:54 +0300)]
Store name in attributes collected from SPIR-V module

3 years agoFix an error in calculating SPIR-V uniform offsets
Mikko Rasa [Fri, 2 Apr 2021 09:48:46 +0000 (12:48 +0300)]
Fix an error in calculating SPIR-V uniform offsets

3 years agoRename some things in Program
Mikko Rasa [Fri, 2 Apr 2021 09:09:01 +0000 (12:09 +0300)]
Rename some things in Program

3 years agoClear all maps before linking the Program
Mikko Rasa [Fri, 2 Apr 2021 07:31:12 +0000 (10:31 +0300)]
Clear all maps before linking the Program

3 years agoAdd default constructors for the info structs in Program
Mikko Rasa [Fri, 2 Apr 2021 07:29:50 +0000 (10:29 +0300)]
Add default constructors for the info structs in Program

3 years agoMake constant id range configurable and avoid duplicates
Mikko Rasa [Thu, 1 Apr 2021 21:26:37 +0000 (00:26 +0300)]
Make constant id range configurable and avoid duplicates

GlslangValidator apparently only allows IDs up to 2047.  I've yet to find
out if there's a limit in SPIR-V itself.

3 years agoSplit up ComponentSpecializer
Mikko Rasa [Thu, 1 Apr 2021 21:13:58 +0000 (00:13 +0300)]
Split up ComponentSpecializer

It was weird having the same class do two things, and also those things
should be done at slightly different points of the compilation process.

3 years agoFix extension declarations in GLSL output
Mikko Rasa [Thu, 1 Apr 2021 19:31:35 +0000 (22:31 +0300)]
Fix extension declarations in GLSL output

3 years agoSplit glsl/generate.cpp in two
Mikko Rasa [Thu, 1 Apr 2021 19:26:09 +0000 (22:26 +0300)]
Split glsl/generate.cpp in two

3 years agoMark generated array types as internal
Mikko Rasa [Thu, 1 Apr 2021 10:59:26 +0000 (13:59 +0300)]
Mark generated array types as internal

3 years agoFix layout processing for old GLSL versions
Mikko Rasa [Wed, 31 Mar 2021 21:20:51 +0000 (00:20 +0300)]
Fix layout processing for old GLSL versions

layout(location) is not supported in 1.10 and 1.20, even with the
ARB_explicit_attrib_location extension.

3 years agoAdd missing NodeRemover invocation to LegacyConverter
Mikko Rasa [Wed, 31 Mar 2021 21:14:25 +0000 (00:14 +0300)]
Add missing NodeRemover invocation to LegacyConverter

3 years agoRefactor layout legacy conversion code to be more extensible
Mikko Rasa [Wed, 31 Mar 2021 20:43:58 +0000 (23:43 +0300)]
Refactor layout legacy conversion code to be more extensible

3 years agoUse type information in converting legacy texture sampling functions
Mikko Rasa [Wed, 31 Mar 2021 20:21:47 +0000 (23:21 +0300)]
Use type information in converting legacy texture sampling functions

3 years agoFill in the required version if empty
Mikko Rasa [Wed, 31 Mar 2021 19:39:18 +0000 (22:39 +0300)]
Fill in the required version if empty

Most of the version checks won't trigger for GLSL 1.20 and none will for
GLSL 1.10.

3 years agoCombine the precision handling visitors and rewrite the logic
Mikko Rasa [Wed, 31 Mar 2021 19:25:38 +0000 (22:25 +0300)]
Combine the precision handling visitors and rewrite the logic

It had fallen befind the times and still used the textual type
information.  The logic of what to do is now also contained in the
visitor.

3 years agoRename compatibility.* to finalize.*
Mikko Rasa [Wed, 31 Mar 2021 18:07:07 +0000 (21:07 +0300)]
Rename compatibility.* to finalize.*

This seems more appropriate for some SPIR-V stuff I'm going to add.

3 years agoAlways remove location qualifier if not supported
Mikko Rasa [Wed, 31 Mar 2021 18:02:21 +0000 (21:02 +0300)]
Always remove location qualifier if not supported

3 years agoMove LegacyConverter invocation to the finalize stage
Mikko Rasa [Wed, 31 Mar 2021 18:01:02 +0000 (21:01 +0300)]
Move LegacyConverter invocation to the finalize stage

3 years agoAdd support for loading SPIR-V shaders
Mikko Rasa [Wed, 31 Mar 2021 15:04:46 +0000 (18:04 +0300)]
Add support for loading SPIR-V shaders

3 years agoRename size to array_size in Program variable info structs
Mikko Rasa [Wed, 31 Mar 2021 14:54:13 +0000 (17:54 +0300)]
Rename size to array_size in Program variable info structs

3 years agoAdd a compile mode flag to the command-line GLSL compiler
Mikko Rasa [Wed, 31 Mar 2021 11:47:52 +0000 (14:47 +0300)]
Add a compile mode flag to the command-line GLSL compiler

3 years agoUse DataType instead of GLenum for Program variable types
Mikko Rasa [Tue, 30 Mar 2021 14:51:39 +0000 (17:51 +0300)]
Use DataType instead of GLenum for Program variable types

3 years agoAdd data types for vectors, matrices, images and samplers
Mikko Rasa [Tue, 30 Mar 2021 13:49:21 +0000 (16:49 +0300)]
Add data types for vectors, matrices, images and samplers

3 years agoUpdate gl.xml to latest version
Mikko Rasa [Tue, 30 Mar 2021 13:47:00 +0000 (16:47 +0300)]
Update gl.xml to latest version

3 years agoAdd some precondition checks to Program
Mikko Rasa [Tue, 30 Mar 2021 13:40:52 +0000 (16:40 +0300)]
Add some precondition checks to Program

Adding stages from multiple modules presents some difficulties in matching
the interfaces.

3 years agoSplit Module into a base class and format-specific class
Mikko Rasa [Tue, 30 Mar 2021 11:55:01 +0000 (14:55 +0300)]
Split Module into a base class and format-specific class

3 years agoRefactor adding and compiling shader stages in Program
Mikko Rasa [Tue, 30 Mar 2021 11:49:26 +0000 (14:49 +0300)]
Refactor adding and compiling shader stages in Program

SPIR-V stages don't need to be compiled so it makes more sense to compile
when adding stages from GLSL.

3 years agoTrack allocation status of Buffer
Mikko Rasa [Mon, 29 Mar 2021 22:34:08 +0000 (01:34 +0300)]
Track allocation status of Buffer

If ABR_buffer_storage is not supported, calling storage() and then
sub_data() did not result in the buffer being allocated.

3 years agoMake Text more flexible about which texture slot it uses
Mikko Rasa [Sun, 28 Mar 2021 22:28:06 +0000 (01:28 +0300)]
Make Text more flexible about which texture slot it uses

Different material types have different names for their textures so
using a fixed name here does not cut it anymore.

3 years agoUse validate_name when copying ProgramData
Mikko Rasa [Sun, 28 Mar 2021 21:26:45 +0000 (00:26 +0300)]
Use validate_name when copying ProgramData

It makes sense to use the same debug build logic here.

3 years agoAvoid accessing a null object if there's only a sampler for some unit
Mikko Rasa [Sun, 28 Mar 2021 21:26:01 +0000 (00:26 +0300)]
Avoid accessing a null object if there's only a sampler for some unit

3 years agoFix loading .tex2d files with ResourceManager
Mikko Rasa [Sun, 28 Mar 2021 14:01:10 +0000 (17:01 +0300)]
Fix loading .tex2d files with ResourceManager

The texture's loader already informs the resource manager of the location
of the image, so it shouldn't be done here.  There's also no need to load
the image first anymore.

3 years agoMove checking of vertex attribute indices to VertexSetup
Mikko Rasa [Sun, 28 Mar 2021 13:48:48 +0000 (16:48 +0300)]
Move checking of vertex attribute indices to VertexSetup

This avoids issues when loading meshes with ResourceManager, since it's
not possible to read the value of GL_MAX_VERTEX_ATTRIBS from the loading
thread.

3 years agoRefactor lexical conversion of vertex attributes
Mikko Rasa [Sun, 28 Mar 2021 13:12:35 +0000 (16:12 +0300)]
Refactor lexical conversion of vertex attributes

There was an error in the size of the base string for the GENERIC
attribute, causing it to never match.  Using a utility function makes
it less dependent on magic numbers.

Color is still handled specially because of the type suffix.

3 years agoFix TextureCube mipmap level allocation tracking
Mikko Rasa [Sun, 28 Mar 2021 12:30:00 +0000 (15:30 +0300)]
Fix TextureCube mipmap level allocation tracking

3 years agoExport texture extension modes from Blender
Mikko Rasa [Sun, 28 Mar 2021 12:02:23 +0000 (15:02 +0300)]
Export texture extension modes from Blender

3 years agoAdd CLAMP_TO_BORDER and border color to Sampler
Mikko Rasa [Sun, 28 Mar 2021 11:26:52 +0000 (14:26 +0300)]
Add CLAMP_TO_BORDER and border color to Sampler

3 years agoSupport defining uniform values for materials in Blender
Mikko Rasa [Sun, 28 Mar 2021 11:12:05 +0000 (14:12 +0300)]
Support defining uniform values for materials in Blender

3 years agoRename material map to material atlas in the exporter
Mikko Rasa [Sun, 28 Mar 2021 10:50:20 +0000 (13:50 +0300)]
Rename material map to material atlas in the exporter

3 years agoFix handling of techniques in object exporter
Mikko Rasa [Sun, 28 Mar 2021 10:40:17 +0000 (13:40 +0300)]
Fix handling of techniques in object exporter

Materials with external rendering mode don't get technique resources
generated them, so it's better to use the technique name here.

3 years agoFix exporting of materials without any textures
Mikko Rasa [Sun, 28 Mar 2021 09:47:29 +0000 (12:47 +0300)]
Fix exporting of materials without any textures

If a generator expression produces no items, trying to access __next__()
produces a StopIteration exception.  It's better to create a list so we
can check if it's empty.

3 years agoFix and improve vertex group support
Mikko Rasa [Sun, 28 Mar 2021 09:46:33 +0000 (12:46 +0300)]
Fix and improve vertex group support

Some parts of the export code had gotten out of sync in 306be12.

Groups and weights now have dedicated attributes instead of using an
arbitrary generic attribute.  They're also separate attributes,
allowing up to four groups per vertex.

3 years agoAdd support for exporting vertex colors
Mikko Rasa [Sun, 21 Mar 2021 16:15:02 +0000 (18:15 +0200)]
Add support for exporting vertex colors

3 years agoRefactor the mesh exporter to use UVs directly from UV layers
Mikko Rasa [Sun, 21 Mar 2021 16:14:18 +0000 (18:14 +0200)]
Refactor the mesh exporter to use UVs directly from UV layers

3 years agoFix suspicious code in the mesh exporter
Mikko Rasa [Sun, 21 Mar 2021 16:11:14 +0000 (18:11 +0200)]
Fix suspicious code in the mesh exporter

The pivot_vertices function was expecting a list of vertices, but only
one vertex was passed in.  In fact the entire function seemed rather
useless now that the mesh is triangulated at an early stage.

3 years agoUpdate the desert pillars demo to work once again
Mikko Rasa [Sun, 21 Mar 2021 15:51:09 +0000 (17:51 +0200)]
Update the desert pillars demo to work once again

There's some warnings which require a more comprehensive overhaul to
get rid of.

3 years agoAdd a collection parameter to RenderPass::set_material
Mikko Rasa [Sun, 21 Mar 2021 15:50:19 +0000 (17:50 +0200)]
Add a collection parameter to RenderPass::set_material

If the pass did not already have a shader, it will try to create one from
the material and fail if it has no collection.

3 years agoRearrange vertex attributes
Mikko Rasa [Sun, 21 Mar 2021 15:28:59 +0000 (17:28 +0200)]
Rearrange vertex attributes

Since fixed function is no longer supported, I don't have to care what
attribute number Nvidia gives the fixed function attributes.  The old
layout had weird holes and made custom attributes hard to add; now the
free attributes are neatly at the end.

The duality between standard and generic attributes has been removed.
User-defined attributes now have their own range.  No deprecated
versions have been kept since they would be difficult to support
properly.

3 years agoRename VertexComponent to VertexAttribute
Mikko Rasa [Sun, 21 Mar 2021 09:40:30 +0000 (11:40 +0200)]
Rename VertexComponent to VertexAttribute

Also rename the related functions.  Get_component_type and
get_component_size in particular were problematic since pixelformat.h
uses the same names, and the ones in vertexformat.h don't take an enum
type.

3 years agoRefactor vertex builders
Mikko Rasa [Sun, 21 Mar 2021 09:21:35 +0000 (11:21 +0200)]
Refactor vertex builders

All attributes are now stored in a single vector.

3 years agoRearrange various uniforms to be declared in the file which uses them
Mikko Rasa [Sat, 20 Mar 2021 17:33:15 +0000 (19:33 +0200)]
Rearrange various uniforms to be declared in the file which uses them

3 years agoSupport exporting unlit materials
Mikko Rasa [Sat, 20 Mar 2021 15:33:40 +0000 (17:33 +0200)]
Support exporting unlit materials

These use the emission surface type in Blender.  While that may seem
strange at first, it's actually a good match to how unlit materials
behave in a realtime scene.

3 years agoRefactor material property handling in the Blender exporter
Mikko Rasa [Sat, 20 Mar 2021 15:32:54 +0000 (17:32 +0200)]
Refactor material property handling in the Blender exporter

3 years agoAdjust uniform organization for UnlitMaterial
Mikko Rasa [Sat, 20 Mar 2021 13:37:12 +0000 (15:37 +0200)]
Adjust uniform organization for UnlitMaterial

Its only property are now stored in a struct to match other material
types.  This allows using the name "color" without conflicting with the
vertex attribute.  The texture uniform was also renamed in order to
avoid clashing with the texture() function.

3 years agoDecouple DataType from the OpenGL constants
Mikko Rasa [Sat, 20 Mar 2021 11:44:09 +0000 (13:44 +0200)]
Decouple DataType from the OpenGL constants

This allows defining the values so that manipulation of related types is
easier.  And I can't keep relying on the GL values anyway, with the goal
of adding a Vulkan backend.

3 years agoFix function inlining regressions
Mikko Rasa [Thu, 18 Mar 2021 13:16:10 +0000 (15:16 +0200)]
Fix function inlining regressions

3 years agoFix test case errors revealed by the previous commit
Mikko Rasa [Thu, 18 Mar 2021 11:27:55 +0000 (13:27 +0200)]
Fix test case errors revealed by the previous commit

And one case of adjusted error message too.

3 years agoAdd a bunch of validation for declarations in GLSL
Mikko Rasa [Thu, 18 Mar 2021 11:23:18 +0000 (13:23 +0200)]
Add a bunch of validation for declarations in GLSL

This is why I renamed the old DeclarationValidator a few commits ago,
because that name is a better fit here.

3 years agoSome touch-up of the debug dump
Mikko Rasa [Thu, 18 Mar 2021 11:21:09 +0000 (13:21 +0200)]
Some touch-up of the debug dump

Since nodes are now easily distinguished, there's no need for special
labeling branches in many cases.

3 years agoRecord correct source information in interface layout statements
Mikko Rasa [Thu, 18 Mar 2021 11:20:00 +0000 (13:20 +0200)]
Record correct source information in interface layout statements

3 years agoShow node source locations in AST dump
Mikko Rasa [Thu, 18 Mar 2021 11:04:48 +0000 (13:04 +0200)]
Show node source locations in AST dump

3 years agoRename DeclarationValidator to IdentifierValidator
Mikko Rasa [Thu, 18 Mar 2021 09:49:59 +0000 (11:49 +0200)]
Rename DeclarationValidator to IdentifierValidator

This name more accurately describes what it does.

3 years agoSupport layout qualifiers on GLSL interface blocks
Mikko Rasa [Wed, 17 Mar 2021 23:06:08 +0000 (01:06 +0200)]
Support layout qualifiers on GLSL interface blocks

3 years agoRename InterfaceBlock::name to block_name for clarity
Mikko Rasa [Wed, 17 Mar 2021 10:26:42 +0000 (12:26 +0200)]
Rename InterfaceBlock::name to block_name for clarity

3 years agoAdd push_back_nocopy to NodeContainer for clarity
Mikko Rasa [Tue, 16 Mar 2021 21:51:21 +0000 (23:51 +0200)]
Add push_back_nocopy to NodeContainer for clarity

It's not immediately obvious that pushing null and then assigning avoids
cloning the node.

3 years agoAdd idempotence test cases for GLSL compiler
Mikko Rasa [Tue, 16 Mar 2021 18:05:24 +0000 (20:05 +0200)]
Add idempotence test cases for GLSL compiler

Already compiled GLSL code should not change when passed through the
compiler again.

3 years agoRefactor the GLSL compiler test cases with a helper class
Mikko Rasa [Tue, 16 Mar 2021 18:04:30 +0000 (20:04 +0200)]
Refactor the GLSL compiler test cases with a helper class

I'm not super pleased with the virtual fail function in the helper, but
no better ideas came to mind so it can be like that for now.

3 years agoAlways show shader compiler diagnostics in debug builds
Mikko Rasa [Tue, 16 Mar 2021 18:00:51 +0000 (20:00 +0200)]
Always show shader compiler diagnostics in debug builds

3 years agoForbid certain operations in SL::Compiler if compilation isn't done
Mikko Rasa [Tue, 16 Mar 2021 17:53:04 +0000 (19:53 +0200)]
Forbid certain operations in SL::Compiler if compilation isn't done

In particular, Formatter can't deal with unresolved declarations.

3 years agoAdjust naming of generated variables
Mikko Rasa [Tue, 16 Mar 2021 17:06:37 +0000 (19:06 +0200)]
Adjust naming of generated variables

Using the inlined function name as a prefix easily produces inconsistent
results, so better to just use numbers after the name.

3 years agoTest case tweaks
Mikko Rasa [Tue, 16 Mar 2021 16:58:46 +0000 (18:58 +0200)]
Test case tweaks

3 years agoSupport inlining GLSL functions with parameters
Mikko Rasa [Tue, 16 Mar 2021 16:51:34 +0000 (18:51 +0200)]
Support inlining GLSL functions with parameters

3 years agoRefactor variable renaming in InlineContentInjector once again
Mikko Rasa [Tue, 16 Mar 2021 14:10:03 +0000 (16:10 +0200)]
Refactor variable renaming in InlineContentInjector once again

It should now be even better at recognizing conflicts, and avoid renaming
when not necessary.

3 years agoUse a temporary staging block in InlineContentInjector
Mikko Rasa [Tue, 16 Mar 2021 11:08:27 +0000 (13:08 +0200)]
Use a temporary staging block in InlineContentInjector

This allows the return variable name generation to avoid other names from
the source function, such as a return variable from previous inlining.

3 years agoRemove an obsolete variable
Mikko Rasa [Tue, 16 Mar 2021 10:08:16 +0000 (12:08 +0200)]
Remove an obsolete variable

This hasn't been used since 0388083.

3 years agoDon't modify the target block's variable map from InlineContentInjector
Mikko Rasa [Tue, 16 Mar 2021 09:38:55 +0000 (11:38 +0200)]
Don't modify the target block's variable map from InlineContentInjector

This felt hacky, and also seemed wrong since the variable map contains
the original names of the variables, not new ones.  Instead avoid
inlining more than one function per pass into any given function.

3 years agoCheck that the types of ternary branches exist before accessing them
Mikko Rasa [Mon, 15 Mar 2021 09:13:36 +0000 (11:13 +0200)]
Check that the types of ternary branches exist before accessing them

This fixes a bug introduced in 3a1fe83 and triggered by 5e4204e.

3 years agoEliminate constant ternary expressions
Mikko Rasa [Mon, 15 Mar 2021 09:05:26 +0000 (11:05 +0200)]
Eliminate constant ternary expressions

3 years agoImplement constant folding in the GLSL compiler
Mikko Rasa [Mon, 15 Mar 2021 09:05:12 +0000 (11:05 +0200)]
Implement constant folding in the GLSL compiler

This replaces the old expression evaluator with a more comprehensive
solution.  Folding constant expressions may open up further possibilities
for inlining.

3 years agoFix the declaration of the builtin textureLod function
Mikko Rasa [Sun, 14 Mar 2021 17:35:01 +0000 (19:35 +0200)]
Fix the declaration of the builtin textureLod function

3 years agoFix some bugs with name conflicts in function inlining
Mikko Rasa [Sun, 14 Mar 2021 17:13:02 +0000 (19:13 +0200)]
Fix some bugs with name conflicts in function inlining

One of these is a regression from b89239e, but the other has been around
for longer.

3 years agoResolve and validate the parameters of constructors in GLSL
Mikko Rasa [Sun, 14 Mar 2021 14:38:29 +0000 (16:38 +0200)]
Resolve and validate the parameters of constructors in GLSL

3 years agoMake variable renaming while inlining more robust
Mikko Rasa [Sun, 14 Mar 2021 14:11:07 +0000 (16:11 +0200)]
Make variable renaming while inlining more robust

It now prevents accidentally hiding global variables too.

3 years agoMove unique name generation to syntax.cpp
Mikko Rasa [Sun, 14 Mar 2021 13:51:32 +0000 (15:51 +0200)]
Move unique name generation to syntax.cpp

It's going to be needed elsewhere too.

3 years agoResolve constructors in FunctionResolver
Mikko Rasa [Sat, 13 Mar 2021 19:36:56 +0000 (21:36 +0200)]
Resolve constructors in FunctionResolver

3 years agoRemove the ParenthesizedExpression node type
Mikko Rasa [Sat, 13 Mar 2021 19:30:48 +0000 (21:30 +0200)]
Remove the ParenthesizedExpression node type

Since this is a proper compiler now, it's no longer necessary to
reproduce the parentheses from the input.

3 years agoCleanup ExpressionInliner
Mikko Rasa [Sat, 13 Mar 2021 19:29:40 +0000 (21:29 +0200)]
Cleanup ExpressionInliner

3 years agoMove parenthesizing expressions to Formatter
Mikko Rasa [Sat, 13 Mar 2021 19:15:07 +0000 (21:15 +0200)]
Move parenthesizing expressions to Formatter

3 years agoRearrange operator metadata
Mikko Rasa [Sat, 13 Mar 2021 19:08:28 +0000 (21:08 +0200)]
Rearrange operator metadata

A secondary token can now be stored for the operators that need one.

The member access operator is categorized as postfix because it only has
one actual operand (the right-hand side is just an identifier).