]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoMake Tags convertible back to the original string in debug builds
Mikko Rasa [Sat, 10 Apr 2021 09:45:50 +0000 (12:45 +0300)]
Make Tags convertible back to the original string in debug builds

This helps in producing more readable error messages

3 years agoClear the empty name flag after emitting a member access
Mikko Rasa [Sat, 10 Apr 2021 00:46:29 +0000 (03:46 +0300)]
Clear the empty name flag after emitting a member access

3 years agoPass Tag by value, not by reference
Mikko Rasa [Fri, 9 Apr 2021 21:40:39 +0000 (00:40 +0300)]
Pass Tag by value, not by reference

Since the tag object is small, it can be passed in a register.

Keeping a deprecated version would make it hard to tell which version
is being called.

3 years agoAdd an option to compile SPIR-V in the command-line GLSL compiler
Mikko Rasa [Fri, 9 Apr 2021 15:22:00 +0000 (18:22 +0300)]
Add an option to compile SPIR-V in the command-line GLSL compiler

3 years agoAdd a couple more test cases
Mikko Rasa [Fri, 9 Apr 2021 14:44:53 +0000 (17:44 +0300)]
Add a couple more test cases

3 years agoTest the SPIR-V backend using libspirv
Mikko Rasa [Fri, 9 Apr 2021 14:36:22 +0000 (17:36 +0300)]
Test the SPIR-V backend using libspirv

3 years agoAdd a SPIR-V backend to the GLSL compiler
Mikko Rasa [Fri, 9 Apr 2021 14:31:47 +0000 (17:31 +0300)]
Add a SPIR-V backend to the GLSL compiler

3 years agoFix a signedness warning
Mikko Rasa [Fri, 9 Apr 2021 14:08:16 +0000 (17:08 +0300)]
Fix a signedness warning

3 years agoDisallow specializing when compiling a module
Mikko Rasa [Fri, 9 Apr 2021 14:05:47 +0000 (17:05 +0300)]
Disallow specializing when compiling a module

The specialization constants would be ignored anyway, so better be
explicit about it.

3 years agoAdd an output file option to the command-line GLSL compiler
Mikko Rasa [Fri, 9 Apr 2021 13:45:34 +0000 (16:45 +0300)]
Add an output file option to the command-line GLSL compiler

3 years agoVisit the entire call graph in DependencyCollector
Mikko Rasa [Thu, 8 Apr 2021 21:52:06 +0000 (00:52 +0300)]
Visit the entire call graph in DependencyCollector

3 years agoConvert operands of shift operators to the same vector size
Mikko Rasa [Thu, 8 Apr 2021 21:46:53 +0000 (00:46 +0300)]
Convert operands of shift operators to the same vector size

3 years agoAdd a separate constant to enable clipping in standard shaders
Mikko Rasa [Wed, 7 Apr 2021 23:00:51 +0000 (02:00 +0300)]
Add a separate constant to enable clipping in standard shaders

Declaring an array with zero size is not allowed, so using zero for
max_clip_planes doesn't work.

3 years agoValidate GLSL flow control
Mikko Rasa [Wed, 7 Apr 2021 20:49:31 +0000 (23:49 +0300)]
Validate GLSL flow control

In particular, it's an error to reach the end of a non-void function
without a return statement.

3 years agoMake the GLSL compiler test runner able to verify non-error diagnostics
Mikko Rasa [Wed, 7 Apr 2021 20:48:04 +0000 (23:48 +0300)]
Make the GLSL compiler test runner able to verify non-error diagnostics

3 years agoRemove unreachable code after a jump statement
Mikko Rasa [Wed, 7 Apr 2021 20:35:12 +0000 (23:35 +0300)]
Remove unreachable code after a jump statement

3 years agoCheck that non-constant data is not accessed from constant expressions
Mikko Rasa [Wed, 7 Apr 2021 12:28:24 +0000 (15:28 +0300)]
Check that non-constant data is not accessed from constant expressions

3 years agoCompare array sizes in TypeComparer
Mikko Rasa [Tue, 6 Apr 2021 23:02:40 +0000 (02:02 +0300)]
Compare array sizes in TypeComparer

3 years agoRewrite type comparisons as a visitor
Mikko Rasa [Tue, 6 Apr 2021 22:42:49 +0000 (01:42 +0300)]
Rewrite type comparisons as a visitor

3 years agoRequire conditions to be booleans
Mikko Rasa [Tue, 6 Apr 2021 21:21:23 +0000 (00:21 +0300)]
Require conditions to be booleans

3 years agoDisallow certain types from appearing on variables
Mikko Rasa [Tue, 6 Apr 2021 21:17:02 +0000 (00:17 +0300)]
Disallow certain types from appearing on variables

3 years agoAdjust GLSL builtins
Mikko Rasa [Tue, 6 Apr 2021 09:54:06 +0000 (12:54 +0300)]
Adjust GLSL builtins

Remove some functions which are complicated to implement in SPIR-V due
to the use of ad-hoc struct types or pointers.  I may add them back
later if there turns out to be some use for them.

Add inline definitions for some overloads taking mixed vector and scalar
arguments.  SPIR-V operations require all operands to have the same
number of elements.  Builtin functions are always inlined even if used
more than once.

3 years agoLeave no-op constructors as they are
Mikko Rasa [Tue, 6 Apr 2021 09:48:44 +0000 (12:48 +0300)]
Leave no-op constructors as they are

In particular, don't break a matrix down into columns and construct
it again.  These could just be removed from the AST entirely, but the
expression resolver currently does not do node replacement and it's
easier to just skip this in the backend.

3 years agoFix GLSL member access index calculation
Mikko Rasa [Tue, 6 Apr 2021 09:46:48 +0000 (12:46 +0300)]
Fix GLSL member access index calculation

Also show it in debug output

3 years agoRefactor layout qualifier creation with constructors
Mikko Rasa [Mon, 5 Apr 2021 13:54:49 +0000 (16:54 +0300)]
Refactor layout qualifier creation with constructors

3 years agoShow label for all interface blocks in GLSL debug output
Mikko Rasa [Mon, 5 Apr 2021 13:47:07 +0000 (16:47 +0300)]
Show label for all interface blocks in GLSL debug output

3 years agoTrack composite assignments and references in UnusedVariableRemover
Mikko Rasa [Mon, 5 Apr 2021 13:46:11 +0000 (16:46 +0300)]
Track composite assignments and references in UnusedVariableRemover

3 years agoRefactor add_to_chain as a common utility function
Mikko Rasa [Mon, 5 Apr 2021 13:44:16 +0000 (16:44 +0300)]
Refactor add_to_chain as a common utility function

3 years agoMark all expression result types as used
Mikko Rasa [Mon, 5 Apr 2021 12:59:36 +0000 (15:59 +0300)]
Mark all expression result types as used

UnusedTypeRemover was missing several expression node types.  Now it
handles expressions through the general expression mechanism.

3 years agoMake DumpTree able to dump arbitrary nodes
Mikko Rasa [Mon, 5 Apr 2021 12:43:02 +0000 (15:43 +0300)]
Make DumpTree able to dump arbitrary nodes

Remove that ability from Formatter since it makes assumptions about the
state of the nodes, like certain references existing.

3 years agoDon't return references from apply functions
Mikko Rasa [Mon, 5 Apr 2021 12:22:40 +0000 (15:22 +0300)]
Don't return references from apply functions

It's somewhat error prone, even though it hasn't caused any problems
yet.

3 years agoAlways use member access for interface blocks, even anonymous ones
Mikko Rasa [Mon, 5 Apr 2021 11:49:41 +0000 (14:49 +0300)]
Always use member access for interface blocks, even anonymous ones

Having variable references magically refer to variables inside interface
blocks causes trouble when generating SPIR-V.

This currently breaks one test case because UnusedVariableRemover can't
track access chains.

3 years agoOutput the interface block as is in the AST dump
Mikko Rasa [Mon, 5 Apr 2021 11:13:36 +0000 (14:13 +0300)]
Output the interface block as is in the AST dump

This is more useful for debugging

3 years agoChange the naming scheme for the interface block map
Mikko Rasa [Mon, 5 Apr 2021 11:08:21 +0000 (14:08 +0300)]
Change the naming scheme for the interface block map

Adding a space in the keys for block name makes it impossible for them to
conflict with identifiers and allows instance names to be used directly.

3 years agoRecognize matrix data order qualifiers and add one if missing
Mikko Rasa [Mon, 5 Apr 2021 09:28:11 +0000 (12:28 +0300)]
Recognize matrix data order qualifiers and add one if missing

3 years agoRequire initializers on constant variables
Mikko Rasa [Mon, 5 Apr 2021 09:25:49 +0000 (12:25 +0300)]
Require initializers on constant variables

3 years agoOffset layout qualifiers are only allowed on uniform block members
Mikko Rasa [Mon, 5 Apr 2021 09:25:12 +0000 (12:25 +0300)]
Offset layout qualifiers are only allowed on uniform block members

Same goes for the alignment qualifier.

3 years agoAdd visitors to calculate offsets of struct members
Mikko Rasa [Sun, 4 Apr 2021 09:35:00 +0000 (12:35 +0300)]
Add visitors to calculate offsets of struct members

It's not used yet, but will be required for creating SPIR-V modules.

3 years agoMake function dependency collection its own visitor class
Mikko Rasa [Sun, 4 Apr 2021 08:38:42 +0000 (11:38 +0300)]
Make function dependency collection its own visitor class

I need it for creating SPIR-V entry points too.

3 years agoStore the index of the member in MemberAccess
Mikko Rasa [Sun, 4 Apr 2021 08:32:31 +0000 (11:32 +0300)]
Store the index of the member in MemberAccess

3 years agoFix mismatched new[]/delete
Mikko Rasa [Sat, 3 Apr 2021 20:01:12 +0000 (23:01 +0300)]
Fix mismatched new[]/delete

3 years agoRearrange some utility struct constructors
Mikko Rasa [Sat, 3 Apr 2021 20:00:55 +0000 (23:00 +0300)]
Rearrange some utility struct constructors

3 years agoGuard against hitting the end of the array in get_gl_type
Mikko Rasa [Sat, 3 Apr 2021 19:58:51 +0000 (22:58 +0300)]
Guard against hitting the end of the array in get_gl_type

3 years agoComments and cosmetic cleanups
Mikko Rasa [Sat, 3 Apr 2021 19:56:09 +0000 (22:56 +0300)]
Comments and cosmetic cleanups

3 years agoDo an early return from Mesh::draw if there's no data
Mikko Rasa [Sat, 3 Apr 2021 18:55:58 +0000 (21:55 +0300)]
Do an early return from Mesh::draw if there's no data

Otherwise if would try to set zero-sized storage for the buffers, which
is not allowed.

Also guard against empty batches in resize_buffers just in case.

3 years agoUse uniform block and texture bindings from GLSL
Mikko Rasa [Sat, 3 Apr 2021 18:17:27 +0000 (21:17 +0300)]
Use uniform block and texture bindings from GLSL

3 years agoAdd a target version option to the command-line GLSL compiler
Mikko Rasa [Sat, 3 Apr 2021 16:54:26 +0000 (19:54 +0300)]
Add a target version option to the command-line GLSL compiler

3 years agoBetter way to request features for different GLSL versions
Mikko Rasa [Sat, 3 Apr 2021 16:53:55 +0000 (19:53 +0300)]
Better way to request features for different GLSL versions

3 years agoAssign bindings to all uniform blocks and sampler uniforms
Mikko Rasa [Sat, 3 Apr 2021 16:40:34 +0000 (19:40 +0300)]
Assign bindings to all uniform blocks and sampler uniforms

3 years agoAdd legacy conversion for binding layout qualifiers
Mikko Rasa [Sat, 3 Apr 2021 16:33:29 +0000 (19:33 +0300)]
Add legacy conversion for binding layout qualifiers

These are not yet used by Program because there's no good way to detect
which uniforms had bindings in case the implementation does support the
qualifiers.  Anything missing a binding gets assigned binding 0, which
is also a valid manually specified binding.  Upcoming commits will move
bindings entirely to GLSL side.

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