]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
5 years agoAllow the maximum mipmap level of a texture to be specified
Mikko Rasa [Mon, 2 Jul 2018 12:49:48 +0000 (15:49 +0300)]
Allow the maximum mipmap level of a texture to be specified

This doubles as a way to specify the number of mipmap levels to allocate
when the tetxure image is loaded from a Graphics::Image.

5 years agoExplicitly define the number of mipmap levels in textures
Mikko Rasa [Mon, 2 Jul 2018 12:46:13 +0000 (15:46 +0300)]
Explicitly define the number of mipmap levels in textures

Storage() no longer uses the minification filter to decide whether to
allocate mipmaps or not.  That functionality has been moved to image(),
specifically the version taking a Graphics::Image.

5 years agoThrow an exception if Texture*::allocate is called before storage
Mikko Rasa [Mon, 2 Jul 2018 12:39:45 +0000 (15:39 +0300)]
Throw an exception if Texture*::allocate is called before storage

5 years agoDon't link keyframes with zero interval
Mikko Rasa [Mon, 2 Jul 2018 11:44:23 +0000 (14:44 +0300)]
Don't link keyframes with zero interval

Fixes an issue where a lone instant keyframe at the end of the animation
would produce bad values as the iterator tries to divide by zero.

5 years agoDon't allow iterators on empty animations
Mikko Rasa [Mon, 2 Jul 2018 11:43:49 +0000 (14:43 +0300)]
Don't allow iterators on empty animations

5 years agoRequire the first keyframe of an animation to be at zero offset
Mikko Rasa [Mon, 2 Jul 2018 11:43:02 +0000 (14:43 +0300)]
Require the first keyframe of an animation to be at zero offset

Having empty space at the start of an animation produces unexpected
results.

5 years agoAdd getter for animation duration
Mikko Rasa [Sun, 1 Jul 2018 22:10:58 +0000 (01:10 +0300)]
Add getter for animation duration

5 years agoAdd a speed parameter for animation playback
Mikko Rasa [Sun, 1 Jul 2018 22:10:41 +0000 (01:10 +0300)]
Add a speed parameter for animation playback

5 years agoSupport slopes in keyframe interpolation
Mikko Rasa [Sun, 1 Jul 2018 22:01:27 +0000 (01:01 +0300)]
Support slopes in keyframe interpolation

5 years agoSupport animations on Placeables
Mikko Rasa [Sun, 1 Jul 2018 20:58:02 +0000 (23:58 +0300)]
Support animations on Placeables

Only matrix animations work for obvious reasons.

5 years agoAdd functions to control environment map updates
Mikko Rasa [Sun, 1 Jul 2018 10:05:39 +0000 (13:05 +0300)]
Add functions to control environment map updates

If the environment changes only very slowly or not at all, it may be
desirable to not update the map every frame.

5 years agoAdd a function to set depth clip of EnvironmentMap
Mikko Rasa [Sun, 1 Jul 2018 10:05:11 +0000 (13:05 +0300)]
Add a function to set depth clip of EnvironmentMap

5 years agoDo not attempt to legacy-bind texture targets which do not support it
Mikko Rasa [Sun, 1 Jul 2018 09:53:08 +0000 (12:53 +0300)]
Do not attempt to legacy-bind texture targets which do not support it

5 years agoBind textures in the modern way when shaders are used
Mikko Rasa [Sun, 1 Jul 2018 09:52:07 +0000 (12:52 +0300)]
Bind textures in the modern way when shaders are used

5 years agoUse DSA for binding textures if available
Mikko Rasa [Sun, 1 Jul 2018 09:15:17 +0000 (12:15 +0300)]
Use DSA for binding textures if available

5 years agoRecognize in and out qualifiers for function parameters
Mikko Rasa [Sun, 1 Jul 2018 07:55:31 +0000 (10:55 +0300)]
Recognize in and out qualifiers for function parameters

5 years agoFix a stupid error with PixelStore parameter mask
Mikko Rasa [Tue, 26 Jun 2018 23:14:09 +0000 (02:14 +0300)]
Fix a stupid error with PixelStore parameter mask

5 years agoFix shadowing warnings from older gcc versions
Mikko Rasa [Mon, 25 Jun 2018 21:20:02 +0000 (00:20 +0300)]
Fix shadowing warnings from older gcc versions

5 years agoAdditional overloads for creating pipelines
Mikko Rasa [Sat, 23 Jun 2018 09:12:26 +0000 (12:12 +0300)]
Additional overloads for creating pipelines

5 years agoPlug a memory leak in PipelineTemplate
Mikko Rasa [Sat, 23 Jun 2018 00:57:40 +0000 (03:57 +0300)]
Plug a memory leak in PipelineTemplate

5 years agoMake grid texture coordinates relative to the grid origin
Mikko Rasa [Wed, 20 Jun 2018 10:40:17 +0000 (13:40 +0300)]
Make grid texture coordinates relative to the grid origin

Instead of the world origin, which doesn't make much sense.

5 years agoAdd default texture anisotropy to Resources
Mikko Rasa [Wed, 20 Jun 2018 10:39:00 +0000 (13:39 +0300)]
Add default texture anisotropy to Resources

5 years agoMinor fixes to texture anisotropy handling
Mikko Rasa [Wed, 20 Jun 2018 10:38:16 +0000 (13:38 +0300)]
Minor fixes to texture anisotropy handling

Initialize the anisotropy parameter and don't try to set it unless the
extension is supported.

5 years agoAdd loading support for AmbientOcclusion
Mikko Rasa [Wed, 20 Jun 2018 10:37:51 +0000 (13:37 +0300)]
Add loading support for AmbientOcclusion

5 years agoCorrectly handle luminance-only formats in maketex.py
Mikko Rasa [Wed, 20 Jun 2018 10:36:44 +0000 (13:36 +0300)]
Correctly handle luminance-only formats in maketex.py

5 years agoApply FunctionResolver again after DeclarationReorderer
Mikko Rasa [Sat, 16 Jun 2018 21:16:49 +0000 (00:16 +0300)]
Apply FunctionResolver again after DeclarationReorderer

Function calls that referred to declarations before need to be updated in
case the definition was moved to before the call site.

5 years agoReorder functions in dependency order
Mikko Rasa [Sat, 16 Jun 2018 16:38:11 +0000 (19:38 +0300)]
Reorder functions in dependency order

Otherwise the inliner might inline a function to a point before its
original definition.  This can break references to other functions
declared after the inlining point, causing the unused function eliminator
to eventually remove them.

5 years agoFix matrix interpolation parameter calculation
Mikko Rasa [Sat, 16 Jun 2018 12:23:01 +0000 (15:23 +0300)]
Fix matrix interpolation parameter calculation

With an x87 FPU and compiler optimizations enabled, the code could end up
taking arccos of a value very slightly larger than one.  This would result
in a NaN and destroy the matrix contents.

5 years agoFix an incorrect negation
Mikko Rasa [Thu, 17 May 2018 14:36:39 +0000 (17:36 +0300)]
Fix an incorrect negation

5 years agoFix a bug in ProgramData when all uniforms in a block are removed
Mikko Rasa [Wed, 9 May 2018 19:08:23 +0000 (22:08 +0300)]
Fix a bug in ProgramData when all uniforms in a block are removed

Program blocks continued using the previously generated uniform blocks,
but because the uniform values were removed the blocks were not updated
anymore.

5 years agoUpdate the font script to match latest ttf2png
Mikko Rasa [Sat, 5 May 2018 19:33:07 +0000 (22:33 +0300)]
Update the font script to match latest ttf2png

5 years agoAdd a missing initializer
Mikko Rasa [Wed, 2 May 2018 22:06:44 +0000 (01:06 +0300)]
Add a missing initializer

5 years agoCosmetic fixes
Mikko Rasa [Wed, 2 May 2018 22:06:11 +0000 (01:06 +0300)]
Cosmetic fixes

5 years agoImplement an event system for animations
Mikko Rasa [Wed, 2 May 2018 21:49:15 +0000 (00:49 +0300)]
Implement an event system for animations

It can be used to sync other actions to certain points of the animation.

5 years agoRefactor the Animation reference out of TimedKeyFrame
Mikko Rasa [Wed, 2 May 2018 19:54:47 +0000 (22:54 +0300)]
Refactor the Animation reference out of TimedKeyFrame

It's only used in prepare() so might as well pass the reference to that
function.

5 years agoRefactor AnimationPlayer ticking
Mikko Rasa [Wed, 2 May 2018 19:32:14 +0000 (22:32 +0300)]
Refactor AnimationPlayer ticking

It's not more consistent between single and stacked animations.  There
shouldn't be significant performance penalty since the animation states
would be freed upon removing the target anyway.

5 years agoFix a stale pointer issue with Animation
Mikko Rasa [Wed, 2 May 2018 19:22:23 +0000 (22:22 +0300)]
Fix a stale pointer issue with Animation

Now that keyframe information is stored in a vector it's no longer
guaranteed that pointers to them stay valid after push_back.  Re-link
all TimedKeyFrames if the vector gets reallocated.

5 years agoChange some class names
Mikko Rasa [Wed, 2 May 2018 15:43:55 +0000 (18:43 +0300)]
Change some class names

5 years agoUse vector when there's no reason to use some other container
Mikko Rasa [Sat, 28 Apr 2018 15:13:29 +0000 (18:13 +0300)]
Use vector when there's no reason to use some other container

5 years agoMake Animation::Iterator assignable
Mikko Rasa [Sat, 28 Apr 2018 14:40:37 +0000 (17:40 +0300)]
Make Animation::Iterator assignable

5 years agoShare shader data between copied RenderPasses
Mikko Rasa [Thu, 26 Apr 2018 23:43:51 +0000 (02:43 +0300)]
Share shader data between copied RenderPasses

Applications that use the Text class hevily were ending up with multiple
copies of the same ProgramData, each with their own uniform buffers.

An even better solution would be to have Text objects share the technique,
but I don't have any good ideas for implementing that.

5 years agoSupport overriding uniforms in inherited Techniques
Mikko Rasa [Thu, 26 Apr 2018 16:34:55 +0000 (19:34 +0300)]
Support overriding uniforms in inherited Techniques

5 years agoAllow setting uniform values using a Uniform object
Mikko Rasa [Thu, 26 Apr 2018 16:34:02 +0000 (19:34 +0300)]
Allow setting uniform values using a Uniform object

5 years agoAdd const overload for AnimatedObject::get_shader_data
Mikko Rasa [Thu, 26 Apr 2018 10:46:06 +0000 (13:46 +0300)]
Add const overload for AnimatedObject::get_shader_data

5 years agoSort the cap_height and x_height arrays in makefont.py
Mikko Rasa [Wed, 25 Apr 2018 11:58:39 +0000 (14:58 +0300)]
Sort the cap_height and x_height arrays in makefont.py

I'm pretty sure they were intended to be sorted given that the item at
the two-thirds position is selected.

5 years agoAdd missing includes
Mikko Rasa [Wed, 25 Apr 2018 11:55:11 +0000 (14:55 +0300)]
Add missing includes

5 years agoCheck for OES_mapbuffer in Buffer::unmap
Mikko Rasa [Wed, 25 Apr 2018 11:53:33 +0000 (14:53 +0300)]
Check for OES_mapbuffer in Buffer::unmap

It might have been mapped through ARB_map_buffer_range, in which case
OES_mapbuffer didn't get initialized in Buffer::map.

5 years agoCosmetic changes and TODOs
Mikko Rasa [Wed, 25 Apr 2018 11:36:52 +0000 (14:36 +0300)]
Cosmetic changes and TODOs

5 years agoRemove the mesh2c tool
Mikko Rasa [Wed, 25 Apr 2018 11:32:38 +0000 (14:32 +0300)]
Remove the mesh2c tool

It was created years ago for a purpose which has not been relevant for a
long while.

5 years agoUse an explicit material slot name in RenderPass
Mikko Rasa [Wed, 25 Apr 2018 11:13:26 +0000 (14:13 +0300)]
Use an explicit material slot name in RenderPass

The previous method of overriding materials with pass name seemed a
bit too hacky to my liking.  This is more in line with how overriding
textures works.

The Blender exporter now expects the base technique to have a material
slot "surface".

5 years agoThrow key_error if an inherited Technique uses nonexistent texture slot
Mikko Rasa [Wed, 25 Apr 2018 10:51:53 +0000 (13:51 +0300)]
Throw key_error if an inherited Technique uses nonexistent texture slot

5 years agoMake a private copy of shader data in RenderPass
Mikko Rasa [Wed, 25 Apr 2018 10:47:14 +0000 (13:47 +0300)]
Make a private copy of shader data in RenderPass

Sharing it is not very common and can't be done in data files.  Owned
data is also needed to override uniforms in inherited Techniques.

5 years agoCheck uniform names when loading RenderPasses
Mikko Rasa [Wed, 25 Apr 2018 10:40:12 +0000 (13:40 +0300)]
Check uniform names when loading RenderPasses

5 years agoAllow tying ProgramData to a Program for name-checking purposes
Mikko Rasa [Wed, 25 Apr 2018 10:23:56 +0000 (13:23 +0300)]
Allow tying ProgramData to a Program for name-checking purposes

5 years agoStore mesh batches in vector instead of list
Mikko Rasa [Sun, 22 Apr 2018 08:54:16 +0000 (11:54 +0300)]
Store mesh batches in vector instead of list

5 years agoMake all forms of Batch::append return a reference to itself
Mikko Rasa [Sun, 22 Apr 2018 08:50:27 +0000 (11:50 +0300)]
Make all forms of Batch::append return a reference to itself

5 years agoPass the file name from Resources to ProgramCompiler
Mikko Rasa [Sun, 22 Apr 2018 08:48:12 +0000 (11:48 +0300)]
Pass the file name from Resources to ProgramCompiler

5 years agoAdd a function to remove uniforms from ProgramData
Mikko Rasa [Sun, 22 Apr 2018 08:43:08 +0000 (11:43 +0300)]
Add a function to remove uniforms from ProgramData

It may be beneficial to revert to a Technique's default value and its
associated buffers instead of explicitly setting the same value in an
ObjectInstance's private ProgramData.

5 years agoAvoid memory leak if an invalid uniform name is given
Mikko Rasa [Sun, 22 Apr 2018 08:37:54 +0000 (11:37 +0300)]
Avoid memory leak if an invalid uniform name is given

5 years agoAllow direct access to AnimatedObject's ProgramData
Mikko Rasa [Sun, 22 Apr 2018 08:35:46 +0000 (11:35 +0300)]
Allow direct access to AnimatedObject's ProgramData

The animation-related set_uniform interface was already public so there
isn't any good reason to not allow full access.  This also makes trivial
customization easier as subclassing is not needed.

6 years agoUse different heuristics for applying shader data
Mikko Rasa [Sat, 14 Apr 2018 22:13:56 +0000 (01:13 +0300)]
Use different heuristics for applying shader data

Since later shdata can override values from earlier ones, the stack must
be replayed even if items are only removed.  However we can detect if the
exact same items are added back as might happen when multiple objects
using the same technique are rendered in succession.

6 years agoVisit generated assignments in InterfaceGenerator
Mikko Rasa [Sat, 14 Apr 2018 07:50:09 +0000 (10:50 +0300)]
Visit generated assignments in InterfaceGenerator

6 years agoRename imported interface variables in InterfaceGenerator
Mikko Rasa [Sat, 14 Apr 2018 07:42:02 +0000 (10:42 +0300)]
Rename imported interface variables in InterfaceGenerator

Doing it as a separate pass caused trouble when a variable was accessed
both with passthrough and explicitly.  Two input variable declarations
were generated and only one of them was linked to the output variable of
the previous stage, leading to the output variable being removed.

6 years agoAdd location specifiers to postprocess.glsl
Mikko Rasa [Wed, 11 Apr 2018 21:11:20 +0000 (00:11 +0300)]
Add location specifiers to postprocess.glsl

6 years agoSplit the interfaces from singlepass.glsl to a separate module
Mikko Rasa [Wed, 11 Apr 2018 21:06:15 +0000 (00:06 +0300)]
Split the interfaces from singlepass.glsl to a separate module

Sometimes it's desirable to make a fully custom shader but still use the
common interface.  It's also likely that I'll add other types of standard
shader templates in the future.

6 years agoAllow imported GLSL modules to import other modules
Mikko Rasa [Wed, 11 Apr 2018 21:02:38 +0000 (00:02 +0300)]
Allow imported GLSL modules to import other modules

6 years agoUse a #pragma as shader stage delimiter
Mikko Rasa [Tue, 10 Apr 2018 15:53:00 +0000 (18:53 +0300)]
Use a #pragma as shader stage delimiter

The special comment was a bad idea with poorly defined semantics.

6 years agoAdd file and line information to ProgramParser errors
Mikko Rasa [Tue, 10 Apr 2018 13:42:38 +0000 (16:42 +0300)]
Add file and line information to ProgramParser errors

6 years agoUse individual component swizzle constants on OpenGL ES
Mikko Rasa [Mon, 9 Apr 2018 10:51:41 +0000 (13:51 +0300)]
Use individual component swizzle constants on OpenGL ES

6 years agoAdd a loader to Camera
Mikko Rasa [Thu, 21 Dec 2017 11:14:17 +0000 (13:14 +0200)]
Add a loader to Camera

6 years agoRename various get/set_aspect functions to aspect_ratio
Mikko Rasa [Wed, 20 Dec 2017 10:54:39 +0000 (12:54 +0200)]
Rename various get/set_aspect functions to aspect_ratio

That's the correct term.  The old versions have been left in and marked
as deprecated for now.

6 years agoGive Placeable a virtual destructor
Mikko Rasa [Tue, 19 Dec 2017 16:28:20 +0000 (18:28 +0200)]
Give Placeable a virtual destructor

6 years agoAdd a system for creating Pipelines from loadable templates
Mikko Rasa [Tue, 19 Dec 2017 16:24:48 +0000 (18:24 +0200)]
Add a system for creating Pipelines from loadable templates

6 years agoAdd loaders for Lighting and Light
Mikko Rasa [Tue, 19 Dec 2017 16:18:29 +0000 (18:18 +0200)]
Add loaders for Lighting and Light

6 years agoRename Lighting::sky_direction to zenith_direction
Mikko Rasa [Tue, 19 Dec 2017 16:15:20 +0000 (18:15 +0200)]
Rename Lighting::sky_direction to zenith_direction

That name more accurately describes its purpose.

6 years agoAdd a constructor to Pipeline which takes the size from a View
Mikko Rasa [Tue, 19 Dec 2017 16:09:07 +0000 (18:09 +0200)]
Add a constructor to Pipeline which takes the size from a View

6 years agoSplit the Window-specific parts out of View
Mikko Rasa [Tue, 19 Dec 2017 09:21:55 +0000 (11:21 +0200)]
Split the Window-specific parts out of View

This should allow other types of views, such as VR::StereoView, to derive
from GL::View and present a uniform API.

6 years agoAdd lexical conversions for BlendFactor and Predicate
Mikko Rasa [Tue, 19 Dec 2017 09:12:48 +0000 (11:12 +0200)]
Add lexical conversions for BlendFactor and Predicate

6 years agoCheck for maximum number of samples
Mikko Rasa [Tue, 5 Dec 2017 11:51:35 +0000 (13:51 +0200)]
Check for maximum number of samples

This makes it more apparent what the error is if a too large sample count
is requested.  Otherwise it would result in an "incomplete attachment"
error from the framebuffer object.

6 years agoCall the non-multisample version of storage if samples is zero
Mikko Rasa [Tue, 5 Dec 2017 11:49:34 +0000 (13:49 +0200)]
Call the non-multisample version of storage if samples is zero

OpenGL defines it like this.  Do the check in application code so it works
even if EXT_framebuffer_multisample is not supported.

6 years agoCheck for EXT_gpu_shader4 support when binding fragment data locations
Mikko Rasa [Tue, 5 Dec 2017 11:37:32 +0000 (13:37 +0200)]
Check for EXT_gpu_shader4 support when binding fragment data locations

6 years agoAdditional framebuffer incompleteness errors
Mikko Rasa [Tue, 5 Dec 2017 11:36:50 +0000 (13:36 +0200)]
Additional framebuffer incompleteness errors

6 years agoFix a stupid bug in the extension generator
Mikko Rasa [Tue, 5 Dec 2017 07:54:06 +0000 (09:54 +0200)]
Fix a stupid bug in the extension generator

6 years agoAdd a get_default_sized_pixelformat function
Mikko Rasa [Mon, 4 Dec 2017 11:13:27 +0000 (13:13 +0200)]
Add a get_default_sized_pixelformat function

Floating point depth buffers are now preferred also on OpenGL ES when
available.

6 years agoSimplification in get_sized_pixelformat
Mikko Rasa [Mon, 4 Dec 2017 11:09:37 +0000 (13:09 +0200)]
Simplification in get_sized_pixelformat

This switch block got overlooked when I introduced
get_unsized_pixelformat.

6 years agoRemove the fake MSP_stereo_rendering extension
Mikko Rasa [Mon, 4 Dec 2017 11:06:17 +0000 (13:06 +0200)]
Remove the fake MSP_stereo_rendering extension

I originally created it because I thought it might be useful with VR
headsets.  Now it's apparent that VR rendering is done with different
APIs and the left/right constants are useless.  The other values of the
RWbuffer enum weren't being used for anything either.

6 years agoMake extensions compatible with OpenGL ES
Mikko Rasa [Mon, 4 Dec 2017 11:04:48 +0000 (13:04 +0200)]
Make extensions compatible with OpenGL ES

6 years agoAdd a debug switch to the extension generator
Mikko Rasa [Tue, 21 Nov 2017 20:18:18 +0000 (22:18 +0200)]
Add a debug switch to the extension generator

6 years agoBe much more strict about extension support
Mikko Rasa [Tue, 21 Nov 2017 20:13:23 +0000 (22:13 +0200)]
Be much more strict about extension support

OpenGL ES has added bits and pieces of full OpenGL functionality, an the
extension generator was thinking an extension was supported when really
only a few tokens from it were.  Now all tokens must be either supported
or explicitly marked as optional for the extension to be made available.

Some features may be temporarily unavailable on OpenGL ES builds as I go
over the extensions and decide how to fix them.

6 years agoRefactor the structure of extgen.py
Mikko Rasa [Fri, 17 Nov 2017 21:54:43 +0000 (23:54 +0200)]
Refactor the structure of extgen.py

Functionality should be more or less preserved at this stage, modulo new
or fixed bugs.  Some extensions are detected differently on OpenGL ES but
those were largely incorrect anyway and will be fixed soon.

6 years agoApply the matrix in ObjectInstance::setup_render
Mikko Rasa [Tue, 14 Nov 2017 11:14:24 +0000 (13:14 +0200)]
Apply the matrix in ObjectInstance::setup_render

6 years agoDerive ProgramCompiler::DeclarationCombiner from BlockModifier
Mikko Rasa [Tue, 14 Nov 2017 11:00:18 +0000 (13:00 +0200)]
Derive ProgramCompiler::DeclarationCombiner from BlockModifier

6 years agoSupport precision qualifiers in shaders
Mikko Rasa [Tue, 14 Nov 2017 10:57:34 +0000 (12:57 +0200)]
Support precision qualifiers in shaders

6 years agoFix shader version declaration when minor version is zero
Mikko Rasa [Tue, 14 Nov 2017 10:56:34 +0000 (12:56 +0200)]
Fix shader version declaration when minor version is zero

6 years agoBasic OpenGL ES support in ProgramCompiler
Mikko Rasa [Tue, 14 Nov 2017 08:53:47 +0000 (10:53 +0200)]
Basic OpenGL ES support in ProgramCompiler

Check language features against the correct version depending on the API
and emit a default precision qualifier for float types.

6 years agoCosmetic fixes
Mikko Rasa [Tue, 14 Nov 2017 08:48:37 +0000 (10:48 +0200)]
Cosmetic fixes

6 years agoUse matrix column accessors rather than multiplication
Mikko Rasa [Tue, 14 Nov 2017 08:47:32 +0000 (10:47 +0200)]
Use matrix column accessors rather than multiplication

6 years agoMake use of the Light's matrix in ShadowMap
Mikko Rasa [Fri, 10 Nov 2017 07:38:43 +0000 (09:38 +0200)]
Make use of the Light's matrix in ShadowMap

6 years agoDerive Camera and Light from Placeable
Mikko Rasa [Fri, 10 Nov 2017 07:26:38 +0000 (09:26 +0200)]
Derive Camera and Light from Placeable

6 years agoImprove parameters and documentation of Light
Mikko Rasa [Thu, 9 Nov 2017 14:41:01 +0000 (16:41 +0200)]
Improve parameters and documentation of Light