]>
git.tdb.fi Git - libs/gl.git/log
Mikko Rasa [Thu, 22 Apr 2021 12:10:21 +0000 (15:10 +0300)]
Redesign ExpressionInliner
Similarly to the rewrite of UnusedVariableRemover from
d230392 , it now
analyzes the entire stage before inlining anything. This approach is
more robust and easier to debug.
The inliner can now inline into the right side of an assignment even if
the left side references the same variable.
Mikko Rasa [Thu, 22 Apr 2021 10:58:57 +0000 (13:58 +0300)]
Fix an incorrect loop in UnusedVariableRemover
Mikko Rasa [Thu, 22 Apr 2021 10:57:22 +0000 (13:57 +0300)]
Even better formatting of folded literals
A negative value does not consist entirely of digits yet may lack a
decimal point. But a point must not be added after an exponent.
Mikko Rasa [Thu, 22 Apr 2021 10:50:11 +0000 (13:50 +0300)]
Fix the return value of ConstantFolder::apply
This was causing the folded literals to be left without a type in some
specific situations, since a resolve pass did not get run.
Mikko Rasa [Thu, 22 Apr 2021 10:38:08 +0000 (13:38 +0300)]
Recognize backwards dependencies in GLSL loops
Assignments at the end of a loop may get used by references earlier in
the same loop and should not be removed.
The added testcase also triggers some other bugs which will be fixed
over the next few commits.
Mikko Rasa [Wed, 21 Apr 2021 14:06:18 +0000 (17:06 +0300)]
Use a generation number to track if ProgramData has changed
This avoids the need for an application to call flush_shader_data after
a change to uniform values in some cases.
Mikko Rasa [Wed, 21 Apr 2021 13:43:33 +0000 (16:43 +0300)]
Support nested scenes in datafiles
This was supposed to be added before
7ae4af7 .
Mikko Rasa [Wed, 21 Apr 2021 13:39:40 +0000 (16:39 +0300)]
Use template functions for setting vector and matrix uniforms
These work automatically for all sizes. Type-safe overloads for arrays
were also added for convenience.
Mikko Rasa [Wed, 21 Apr 2021 10:09:03 +0000 (13:09 +0300)]
Refactor texture attachment management in Framebuffer
Duplicated code from the attach functions has been collapsed into a
helper function.
Attaching a texture does not need binding it, so there's little point
in deferring the allocation to update_attachment. By calling the type-
specific allocate function in attach, update_attachment can be simpler.
Mikko Rasa [Tue, 20 Apr 2021 16:26:16 +0000 (19:26 +0300)]
Add support for uint types in GLSL
Mikko Rasa [Tue, 20 Apr 2021 16:21:06 +0000 (19:21 +0300)]
Recognize the 'f' suffix for float literals in GLSL
Mikko Rasa [Tue, 20 Apr 2021 15:32:22 +0000 (18:32 +0300)]
Recognize composite constants when generating SPIR-V
Mikko Rasa [Tue, 20 Apr 2021 15:28:23 +0000 (18:28 +0300)]
Put specialization constant instructions in the right section in SPIR-V
Mikko Rasa [Tue, 20 Apr 2021 15:21:35 +0000 (18:21 +0300)]
Fold type conversions of constants
Mikko Rasa [Tue, 20 Apr 2021 15:18:25 +0000 (18:18 +0300)]
Refactor handling of %, << and >> in ConstantFolder
This is in line with the other operators and makes adding unsigned
types easier.
Mikko Rasa [Tue, 20 Apr 2021 15:15:08 +0000 (18:15 +0300)]
Make sure folded float constants appear as correct type
If the value has no fractional part, the default conversion will not
add a decimal point.
Mikko Rasa [Tue, 20 Apr 2021 15:14:20 +0000 (18:14 +0300)]
Make ConstantFolder check the type of the value directly
Mikko Rasa [Tue, 20 Apr 2021 12:16:30 +0000 (15:16 +0300)]
Resolve function calls where argument types need to be converted
This is a rather basic implementation and will reject a call if there's
multiple candidates, without considering conversion ranks.
Mikko Rasa [Tue, 20 Apr 2021 11:09:27 +0000 (14:09 +0300)]
Move some type information functions to glsl/reflect.cpp
Mikko Rasa [Mon, 19 Apr 2021 08:29:03 +0000 (11:29 +0300)]
Export shadow settings from Blender
Mikko Rasa [Mon, 19 Apr 2021 08:26:55 +0000 (11:26 +0300)]
Add missing implementation of RenderPass::set_back_faces
Mikko Rasa [Mon, 19 Apr 2021 08:25:20 +0000 (11:25 +0300)]
Move the receive_shadows flag to RenderPass
It doesn't seem so much a property of the surface itself as the
environment it's rendered in.
Mikko Rasa [Mon, 19 Apr 2021 08:14:51 +0000 (11:14 +0300)]
Rearrange material-related state management in RenderPass
The change in texture handling allows some simplifications here since
material textures no longer need to set any uniforms. Creation of
material shader while loading is deferred to finish() so it isn't done
needlessly.
Mikko Rasa [Mon, 19 Apr 2021 07:54:17 +0000 (10:54 +0300)]
Disallow loading uniforms without a custom shader
Mikko Rasa [Sun, 18 Apr 2021 22:43:58 +0000 (01:43 +0300)]
Convert Technique and RenderPass loaders to use shared actions
Mikko Rasa [Sun, 18 Apr 2021 18:59:46 +0000 (21:59 +0300)]
Allow repeated storage calls with the same parameters
Mikko Rasa [Sun, 18 Apr 2021 17:21:54 +0000 (20:21 +0300)]
Use a separate shadow caster renderable for ShadowMap
This makes the configuration more flexible. For example it's possible
to use a Sequence to define which tag to use for the shadow pass.
Mikko Rasa [Sun, 18 Apr 2021 07:23:04 +0000 (10:23 +0300)]
Use persistent cameras in effects
This allows implementing per-camera caching of culling and sorting in
scenes, and is also required for some Vulkan-related things.
Mikko Rasa [Sat, 17 Apr 2021 22:07:31 +0000 (01:07 +0300)]
Add a HDR option in Blender
Mikko Rasa [Sat, 17 Apr 2021 22:05:20 +0000 (01:05 +0300)]
Unmanage texture if loading data directly
Otherwise the resource manager won't have a load location for the texture
and will throw an exception.
Also generate ID if it hasn't been done yet.
Mikko Rasa [Sat, 17 Apr 2021 22:04:53 +0000 (01:04 +0300)]
Refactor texture ID generation into a function
Mikko Rasa [Sat, 17 Apr 2021 19:38:43 +0000 (22:38 +0300)]
Improve error reporting in the Blender exporter
Exceptions now include information identifying the thing which could not
be processed.
Mikko Rasa [Sat, 17 Apr 2021 19:17:16 +0000 (22:17 +0300)]
Move operators to their own file in the Blender exporter
Mikko Rasa [Sat, 17 Apr 2021 19:06:07 +0000 (22:06 +0300)]
Add a Blender operator to export the entire project at once
This also creates sequence templates including lights defined in the
scene(s).
Mikko Rasa [Sat, 17 Apr 2021 19:01:19 +0000 (22:01 +0300)]
Make it possible to have datafiles for individual lights
Mikko Rasa [Sat, 17 Apr 2021 18:43:48 +0000 (21:43 +0300)]
Don't use an index when attaching lights
It's a relic of legacy OpenGL's way of doing lighting and unnecessary
in a modern engine.
Mikko Rasa [Sat, 17 Apr 2021 18:31:04 +0000 (21:31 +0300)]
Convert Lighting to use shared actions
Mikko Rasa [Sat, 17 Apr 2021 17:41:10 +0000 (20:41 +0300)]
Refactor ExportMspGLBase into a simpler ExportHelper subclass
Copying properties from the operator to the exporter with setattr felt
kind hacky.
Mikko Rasa [Sat, 17 Apr 2021 17:39:46 +0000 (20:39 +0300)]
Remove the show_progress flag
It has outlived its usefulness since the operators can now export
multiple objects or entire scenes at once.
Mikko Rasa [Sat, 17 Apr 2021 10:25:39 +0000 (13:25 +0300)]
Ignore already existing resources in DataExporter
Mikko Rasa [Sat, 17 Apr 2021 10:14:50 +0000 (13:14 +0300)]
Some minor refactoring of the exporter
Move scene resources export to a separate function and remove some
unused bits.
Mikko Rasa [Sat, 17 Apr 2021 09:58:35 +0000 (12:58 +0300)]
Drop the progress parameter from export_scene
It wasn't being used for anything meaningful.
Mikko Rasa [Fri, 16 Apr 2021 20:52:23 +0000 (23:52 +0300)]
Don't rename scene objects while exporting
It's somewhat risky to come up with entirely new names. Sorting the
objects by name already ensures that if one of the names is a prefix
for others, it gets used as the prototype name.
Mikko Rasa [Fri, 16 Apr 2021 19:27:54 +0000 (22:27 +0300)]
Refactor scene data preparation to its own class
The visibility flags of all collections are now considered, rather than
just those of the direct children of the scene collection.
Mikko Rasa [Thu, 15 Apr 2021 18:04:34 +0000 (21:04 +0300)]
Only show the mesh properties panel for meshes
Mikko Rasa [Thu, 15 Apr 2021 18:03:30 +0000 (21:03 +0300)]
Adjust scene export code
Resources are no longer exported as a collection by default. If
collection export is enabled, the scene itself is put in the collection
too.
Mikko Rasa [Thu, 15 Apr 2021 17:57:51 +0000 (20:57 +0300)]
Make Scenes loadable from collection files too
Mikko Rasa [Thu, 15 Apr 2021 17:44:27 +0000 (20:44 +0300)]
Rename visible_collections to visible_only
It was kinda confusing when there's also collection files.
Mikko Rasa [Thu, 15 Apr 2021 17:23:08 +0000 (20:23 +0300)]
Fix multiplication operators in camera exporter
Mikko Rasa [Thu, 15 Apr 2021 17:04:26 +0000 (20:04 +0300)]
Redesign object exporting
To combat operator bloat, all object-based data is now exported with a
common front-end class. SceneExporter also uses this to export its
resources.
Meshes can't be exported on their own anymore, only as part of objects.
But loose meshes aren't that useful anymore with the improvements in
defining materials and techniques in Blender.
Mikko Rasa [Thu, 15 Apr 2021 16:20:37 +0000 (19:20 +0300)]
Revise export function parameter orders
Mikko Rasa [Thu, 15 Apr 2021 13:23:47 +0000 (16:23 +0300)]
Remove some rarely-used export settings
Mikko Rasa [Wed, 14 Apr 2021 16:12:31 +0000 (19:12 +0300)]
Add generator ID for the SPIR-V compiler
Mikko Rasa [Wed, 14 Apr 2021 15:35:38 +0000 (18:35 +0300)]
Support loading sequences in the viewer
Mikko Rasa [Wed, 14 Apr 2021 15:28:04 +0000 (18:28 +0300)]
Use ObjectInstance instead of AnimatedObject in Scene loader
Since ObjectInstance has a matrix now, there's no need to use
AnimatedObject here. I may add another statement to include objects
with actual animations later.
Mikko Rasa [Wed, 14 Apr 2021 15:26:39 +0000 (18:26 +0300)]
Allow renderables to be specified in SequenceTemplate passes
Mikko Rasa [Wed, 14 Apr 2021 15:25:03 +0000 (18:25 +0300)]
Rename SequenceTemplate::Pass::renderable_name to slot_name
Mikko Rasa [Wed, 14 Apr 2021 15:09:36 +0000 (18:09 +0300)]
Avoid NaN issues in rare cases in the Cook-Torrance shader
The dot product may sometimes be very slightly over 1.0, making the
first argument to pow negative and giving undefined results.
Mikko Rasa [Wed, 14 Apr 2021 15:07:50 +0000 (18:07 +0300)]
Fix loading sRGB external images for textures
This fixes bugs introduced in
9087cc0 (sRGB state ignored when setting
internal format) and
635e5dc (external_image_srgb handled incorrectly).
Mikko Rasa [Wed, 14 Apr 2021 12:04:24 +0000 (15:04 +0300)]
Remove some vestigial code from Sequence
Apparently a few internal parts were left behind when I removed the
related interfaces.
Mikko Rasa [Wed, 14 Apr 2021 11:46:05 +0000 (14:46 +0300)]
Use a vector instead of a list for Sequence's steps
They're not large or numerous enough to warrant a list.
Mikko Rasa [Wed, 14 Apr 2021 11:45:15 +0000 (14:45 +0300)]
Add compatibility typedefs for the pipeline classes
Must be in a separate commit for git to pick up on the renames in the
previous one.
Mikko Rasa [Wed, 14 Apr 2021 11:42:11 +0000 (14:42 +0300)]
Rename Pipeline to Sequence
Pipeline::Pass is now Sequence::Step. These better match what the
classes do.
Mikko Rasa [Tue, 13 Apr 2021 21:26:24 +0000 (00:26 +0300)]
New way of loading scenes in the viewer
Mikko Rasa [Tue, 13 Apr 2021 21:04:13 +0000 (00:04 +0300)]
Add a scene type property to the Blender exporter
Mikko Rasa [Tue, 13 Apr 2021 21:03:43 +0000 (00:03 +0300)]
Support loading scenes from Resources
Mikko Rasa [Tue, 13 Apr 2021 20:53:43 +0000 (23:53 +0300)]
Add a registry-based generic loader to Scene
This is rather similar to the one in Material, but there's just enough
differences and template complications that it isn't trivial to abstract.
Mikko Rasa [Tue, 13 Apr 2021 19:17:01 +0000 (22:17 +0300)]
Use latest OpenGL version in viewer
Mikko Rasa [Tue, 13 Apr 2021 18:39:00 +0000 (21:39 +0300)]
Use an Options struct to process command line options in viewer
Mikko Rasa [Tue, 13 Apr 2021 11:07:58 +0000 (14:07 +0300)]
Improve logic for exporting material sampler references
Mikko Rasa [Tue, 13 Apr 2021 11:06:36 +0000 (14:06 +0300)]
Add an option to automatically detect if tangents need to be exported
It's enabled by default, which should reduce hassle when authoring
models.
Mikko Rasa [Tue, 13 Apr 2021 10:22:54 +0000 (13:22 +0300)]
Add the group and weight attributes to msp_interface.glsl
This got forgotten in
e1d0738 .
Mikko Rasa [Tue, 13 Apr 2021 10:22:02 +0000 (13:22 +0300)]
Include only tangent in mesh data and calculate binormal on the fly
This saves one vertex attribute.
Mikko Rasa [Tue, 13 Apr 2021 10:10:56 +0000 (13:10 +0300)]
Fix incorrect definition of the builtin cross function in GLSL
Mikko Rasa [Tue, 13 Apr 2021 09:43:56 +0000 (12:43 +0300)]
Use unit 0 UVs for exporting TBNs if no UV layer is specified
Mikko Rasa [Tue, 13 Apr 2021 09:02:24 +0000 (12:02 +0300)]
Ensure that objects have unique names while exporting a scene
Mikko Rasa [Tue, 13 Apr 2021 08:49:38 +0000 (11:49 +0300)]
Compare materials when looking for object clones while exporting a scene
Mikko Rasa [Tue, 13 Apr 2021 08:33:13 +0000 (11:33 +0300)]
Recognize a certain configuration of nodes as inverting Y for normals
Models made for DirectX treat the normal map values as having positive
Y pointing toward the bottom of the image, which is opposite to what my
engine and Blender expect. This allows fixing that without modifying
the original texture.
Mikko Rasa [Mon, 12 Apr 2021 22:27:00 +0000 (01:27 +0300)]
Force the usage of normalmap as RGB data
Mikko Rasa [Mon, 12 Apr 2021 22:25:22 +0000 (01:25 +0300)]
Use more efficient methods to manipulate and store texture data
Mikko Rasa [Mon, 12 Apr 2021 21:40:10 +0000 (00:40 +0300)]
Remove deprecated things from the maketex script
Mikko Rasa [Mon, 12 Apr 2021 21:18:07 +0000 (00:18 +0300)]
Fix a bug in makefont.py if no ranges are given
Mikko Rasa [Mon, 12 Apr 2021 21:17:23 +0000 (00:17 +0300)]
Convert the texture and font creation scripts to python3
Mikko Rasa [Mon, 12 Apr 2021 15:00:34 +0000 (18:00 +0300)]
Don't ignore structs entirely in UnusedVariableRemover
Structs may have arrays in them, and array sizes may have references to
specialization constants which must be kept.
Mikko Rasa [Mon, 12 Apr 2021 14:40:04 +0000 (17:40 +0300)]
Adjust specular calculation in the Phong shader
Since the look vector points towards the surface, it makes more sense
to calculate the reflected vector towards the light. The calculation
is symmetric so the result is the same.
Mikko Rasa [Mon, 12 Apr 2021 14:32:06 +0000 (17:32 +0300)]
Refactor vertex transformations in the common shader
It makes more sense to have virtual accessors for the transformation
matrices so the returned matrix can be used multiple times.
Mikko Rasa [Mon, 12 Apr 2021 12:38:54 +0000 (15:38 +0300)]
Rearrange type specification in material datafiles
The type is now specified as a separate statement with no substatements.
This is what I wanted to do originally but couldn't figure out a clean
way to do it.
No legacy support because the new material system as a whole is still
fairly new and hasn't been used in many places.
Mikko Rasa [Mon, 12 Apr 2021 12:01:48 +0000 (15:01 +0300)]
Migrate from LoadableTypeRegistry to TypeRegistry
Mikko Rasa [Mon, 12 Apr 2021 01:18:39 +0000 (04:18 +0300)]
Fix normal map property name in material exporter
Mikko Rasa [Mon, 12 Apr 2021 00:34:10 +0000 (03:34 +0300)]
Fix incorrect plurals in exporter scripts
Replacing "map" with "atlas" was not correct in the plural case
Mikko Rasa [Mon, 12 Apr 2021 00:33:37 +0000 (03:33 +0300)]
Fix refactoring errors in scene exporter
Mikko Rasa [Sun, 11 Apr 2021 20:39:16 +0000 (23:39 +0300)]
Recognize textures through an RGB to BW node in Blender
Mikko Rasa [Sun, 11 Apr 2021 20:38:31 +0000 (23:38 +0300)]
Deprecated InstanceScene and Renderable::get_instance_key
InstanceArray is a superior way of rendering multiple instances of an
object.
Mikko Rasa [Sun, 11 Apr 2021 20:35:26 +0000 (23:35 +0300)]
Redesign Text as an ObjectInstance
It's rare to need several copies of the same text, but positioning texts
is useful.
Text no longer copies the Technique but instead sets the texture in
setup_render.
Mikko Rasa [Sun, 11 Apr 2021 20:25:18 +0000 (23:25 +0300)]
Overhaul texture management in rendering classes
Textures are now set based on the uniform name (tag) rather than texture
unit. The Texturing class has been deprecated because it was making
things difficult when textures come from multiple sources, such as with
effects or decals. RenderPass and Renderer now handle multiple textures
directly.
There's some compatibility code but things are likely to break.
Mikko Rasa [Sat, 10 Apr 2021 20:07:19 +0000 (23:07 +0300)]
Use a vector for storage in DefaultUniformBlock
Uniform locations are normally spaced no more than 4 apart, so even with
a few empty spots a vector is going to be more efficient than a map.
Mikko Rasa [Sat, 10 Apr 2021 20:00:39 +0000 (23:00 +0300)]
Split UniformBlock into two classes
There's basically no overlap between default and buffer-backed blocks,
so no point in having them in the same class.
Mikko Rasa [Sat, 10 Apr 2021 18:42:58 +0000 (21:42 +0300)]
Refactor ProgramData to store blocks in vectors
Mikko Rasa [Sat, 10 Apr 2021 18:20:44 +0000 (21:20 +0300)]
Sort uniform blocks from SPIR-V modules
Mikko Rasa [Sat, 10 Apr 2021 18:17:00 +0000 (21:17 +0300)]
Use the new _member utility functions to search and sort things