]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
6 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

6 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

6 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

6 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

6 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.

6 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

6 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

7 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

7 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.

7 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.

7 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

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

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

7 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

7 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.

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

7 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

7 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

7 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

7 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

7 years agoAdd a new Placeable base class
Mikko Rasa [Wed, 8 Nov 2017 06:42:24 +0000 (08:42 +0200)]
Add a new Placeable base class

7 years agoRemove useless namespace prefixes
Mikko Rasa [Sun, 10 Sep 2017 12:37:54 +0000 (15:37 +0300)]
Remove useless namespace prefixes

7 years agoImmediately process window size to set correct viewport size
Mikko Rasa [Sun, 10 Sep 2017 12:33:41 +0000 (15:33 +0300)]
Immediately process window size to set correct viewport size

The system framebuffer acquires its size from the window when the GL
context is created, but in some use cases the window may change size
before a View is created on it.

7 years agoSimplify version comparisons
Mikko Rasa [Sun, 10 Sep 2017 12:32:26 +0000 (15:32 +0300)]
Simplify version comparisons

The less-than operator was implemented a while ago but these two cases
were missed.

7 years agoThrow an exception if a referenced external image is not found
Mikko Rasa [Sun, 10 Sep 2017 12:31:30 +0000 (15:31 +0300)]
Throw an exception if a referenced external image is not found

7 years agoUse the same mesh for multiple instances of an object in scene exporter
Mikko Rasa [Sun, 10 Sep 2017 12:23:22 +0000 (15:23 +0300)]
Use the same mesh for multiple instances of an object in scene exporter

7 years agoEliminate a useless temporary variable
Mikko Rasa [Sun, 10 Sep 2017 12:22:03 +0000 (15:22 +0300)]
Eliminate a useless temporary variable

7 years agoSmall optimization for mesh exporter performance
Mikko Rasa [Sun, 10 Sep 2017 12:19:40 +0000 (15:19 +0300)]
Small optimization for mesh exporter performance

7 years agoFix an incorrect variable in the mesh exporter
Mikko Rasa [Sun, 10 Sep 2017 12:17:52 +0000 (15:17 +0300)]
Fix an incorrect variable in the mesh exporter

7 years agoUse correct function name in exception
Mikko Rasa [Sun, 10 Sep 2017 12:08:20 +0000 (15:08 +0300)]
Use correct function name in exception

7 years agoSome comment updates
Mikko Rasa [Sun, 10 Sep 2017 12:07:24 +0000 (15:07 +0300)]
Some comment updates

7 years agoDon't crash if an explicitly specified backport extension is not found
Mikko Rasa [Sun, 10 Sep 2017 11:28:38 +0000 (14:28 +0300)]
Don't crash if an explicitly specified backport extension is not found

Also fix formatting of the error message.

7 years agoOpenGL ES compatibility fixes
Mikko Rasa [Sun, 10 Sep 2017 11:25:29 +0000 (14:25 +0300)]
OpenGL ES compatibility fixes

7 years agoHeader fixes
Mikko Rasa [Sun, 10 Sep 2017 11:22:30 +0000 (14:22 +0300)]
Header fixes

7 years agoDisable core version of primitive restart on Radeon as well
Mikko Rasa [Sun, 8 Jan 2017 13:59:57 +0000 (15:59 +0200)]
Disable core version of primitive restart on Radeon as well

Maybe there's something wrong with my code but I can't figure what.  This
is the easy solution.

7 years agoReturn false from is_supported for disabled extensions
Mikko Rasa [Sun, 8 Jan 2017 13:59:37 +0000 (15:59 +0200)]
Return false from is_supported for disabled extensions

7 years agoPerform ambient occlusion PRNG multiplication with 64-bit integers
Mikko Rasa [Fri, 6 Jan 2017 16:16:48 +0000 (18:16 +0200)]
Perform ambient occlusion PRNG multiplication with 64-bit integers

7 years agoUse linear filtering for ambient occlusion render target
Mikko Rasa [Fri, 6 Jan 2017 16:15:43 +0000 (18:15 +0200)]
Use linear filtering for ambient occlusion render target

The blurring step samples it exactly between texels so nearest filtering
may cause artifacts due to floating point math instability.

7 years agoFix some errors in the ambient occlusion shader
Mikko Rasa [Fri, 6 Jan 2017 14:26:53 +0000 (16:26 +0200)]
Fix some errors in the ambient occlusion shader

7 years agoProperly handle the legacy replacement of fragment shader output
Mikko Rasa [Fri, 6 Jan 2017 13:18:42 +0000 (15:18 +0200)]
Properly handle the legacy replacement of fragment shader output

Assignment targets to the output variable need to be cleared, lest the
unused variable locator tries to access deleted nodes.

7 years agoDon't replace in/out with attribute/varying until formatting
Mikko Rasa [Fri, 6 Jan 2017 13:17:08 +0000 (15:17 +0200)]
Don't replace in/out with attribute/varying until formatting

Some parts of the code depend on having the correct interfaces present in
the AST.

7 years agoSimplify reflections in the singlepass shader
Mikko Rasa [Fri, 6 Jan 2017 11:49:20 +0000 (13:49 +0200)]
Simplify reflections in the singlepass shader

Specular reflection of the sky was dropped.  It's better implemented
through an environment map.  In the future I'll add a skybox utility
class which provides a simple environment map.

7 years agoGuard against missing extensions on OS X
Mikko Rasa [Fri, 6 Jan 2017 11:48:17 +0000 (13:48 +0200)]
Guard against missing extensions on OS X

Symbols are linked directly so the definitions must be present in the
system OpenGL library at compile time.

7 years agoUse the correct define to detect Windows
Mikko Rasa [Fri, 6 Jan 2017 11:14:31 +0000 (13:14 +0200)]
Use the correct define to detect Windows

7 years agoDefine some GL enums in case they don't exist
Mikko Rasa [Fri, 6 Jan 2017 10:33:39 +0000 (12:33 +0200)]
Define some GL enums in case they don't exist

7 years agoImplement an assignment operator for RenderPass
Mikko Rasa [Fri, 6 Jan 2017 10:27:54 +0000 (12:27 +0200)]
Implement an assignment operator for RenderPass

Clang compains about this too when trying to assign the pass map in
Technique.

7 years agoFix some clang compile warnings
Mikko Rasa [Fri, 6 Jan 2017 10:27:40 +0000 (12:27 +0200)]
Fix some clang compile warnings

7 years agoDefault to mipmapped filtering if EXT_framebuffer_object is available
Mikko Rasa [Thu, 29 Dec 2016 09:41:03 +0000 (11:41 +0200)]
Default to mipmapped filtering if EXT_framebuffer_object is available

Even if SGIS_generate_mipmap isn't.  The latter functionality has been
removed from modern OpenGL.

7 years agoAdd a method to set the texture filter of RenderTarget textures
Mikko Rasa [Thu, 29 Dec 2016 09:39:23 +0000 (11:39 +0200)]
Add a method to set the texture filter of RenderTarget textures

7 years agoRemove useless declarations of main() from shaders
Mikko Rasa [Fri, 16 Dec 2016 21:52:39 +0000 (23:52 +0200)]
Remove useless declarations of main() from shaders

7 years agoImprove the ambient occlusion postprocessor
Mikko Rasa [Sat, 10 Dec 2016 23:01:51 +0000 (01:01 +0200)]
Improve the ambient occlusion postprocessor

Now that postprocessors have access to the Renderer and its state, the
camera projection matrix can be used for more sophisticated depth
calculations.

7 years agoAlso re-apply standard shader data when the shader program changes
Mikko Rasa [Sat, 10 Dec 2016 23:01:31 +0000 (01:01 +0200)]
Also re-apply standard shader data when the shader program changes

7 years agoAlways treat GLSL function parameters as referenced
Mikko Rasa [Sat, 10 Dec 2016 20:48:07 +0000 (22:48 +0200)]
Always treat GLSL function parameters as referenced

They can't be removed so adding them to the set of unused nodes would
lead to an infinite loop.

7 years agoSome fixes to assignment management in UnusedVariableLocator
Mikko Rasa [Sat, 10 Dec 2016 20:43:51 +0000 (22:43 +0200)]
Some fixes to assignment management in UnusedVariableLocator

Sometimes assignments were being removed when they shouldn't (reference
from a conditional sub-block).  Other times they weren't being removed
when they should (followup assignment in the same block).

7 years agoSupport attaching 3D and 2DArray textures to Framebuffer
Mikko Rasa [Sat, 10 Dec 2016 17:32:27 +0000 (19:32 +0200)]
Support attaching 3D and 2DArray textures to Framebuffer

7 years agoReorder declarations right after injecting the shared scope
Mikko Rasa [Sat, 10 Dec 2016 17:28:42 +0000 (19:28 +0200)]
Reorder declarations right after injecting the shared scope

This is necesary for InterfaceGenerator to recognize additional inputs in
shaders that import a main function with passthrough in it.  Otherwise no
passthroughs would be generated and those inputs would be unusable in
later stages.

7 years agoRefactor and improve unused variable detection in ProgramCompiler
Mikko Rasa [Sat, 10 Dec 2016 17:24:58 +0000 (19:24 +0200)]
Refactor and improve unused variable detection in ProgramCompiler

It now recognizes and marks for removal assignments to global variables
if the variable is not read in any function.

7 years agoRecognize backward references in GLSL loops
Mikko Rasa [Wed, 7 Dec 2016 00:31:45 +0000 (02:31 +0200)]
Recognize backward references in GLSL loops

A lone assignment at the end of a loop isn't unused if the next iteration
uses the value.

7 years agoCompute Framebuffer size correctly when texture mipmaps are attached
Mikko Rasa [Tue, 6 Dec 2016 21:53:48 +0000 (23:53 +0200)]
Compute Framebuffer size correctly when texture mipmaps are attached

7 years agoAdd a default tag to render functions that were missing it
Mikko Rasa [Tue, 6 Dec 2016 21:34:35 +0000 (23:34 +0200)]
Add a default tag to render functions that were missing it

7 years agoImmediate update camera aspect in View::set_camera
Mikko Rasa [Tue, 6 Dec 2016 21:34:16 +0000 (23:34 +0200)]
Immediate update camera aspect in View::set_camera

7 years agoInitialize View::camera to null
Mikko Rasa [Tue, 6 Dec 2016 21:33:58 +0000 (23:33 +0200)]
Initialize View::camera to null

So it doesn't crash when used without a camera.

7 years agoAdd some more premade blend modes
Mikko Rasa [Tue, 6 Dec 2016 21:33:17 +0000 (23:33 +0200)]
Add some more premade blend modes

7 years agoMark some functions as const that by all rights should be
Mikko Rasa [Tue, 6 Dec 2016 21:32:08 +0000 (23:32 +0200)]
Mark some functions as const that by all rights should be

7 years agoSet a sensible projection matrix when there's no camera
Mikko Rasa [Tue, 6 Dec 2016 21:31:40 +0000 (23:31 +0200)]
Set a sensible projection matrix when there's no camera

7 years agoRecognize various nonlinear flow control statement
Mikko Rasa [Tue, 6 Dec 2016 21:31:07 +0000 (23:31 +0200)]
Recognize various nonlinear flow control statement

7 years agoRemove some methods that have been deprecated for a long while
Mikko Rasa [Mon, 5 Dec 2016 18:34:03 +0000 (20:34 +0200)]
Remove some methods that have been deprecated for a long while

7 years agoAdd bounding sphere passthrough to Effect
Mikko Rasa [Mon, 5 Dec 2016 17:56:18 +0000 (19:56 +0200)]
Add bounding sphere passthrough to Effect

7 years agoRefresh lighting and culling uniforms if the camera changes in pop_state
Mikko Rasa [Mon, 5 Dec 2016 17:50:48 +0000 (19:50 +0200)]
Refresh lighting and culling uniforms if the camera changes in pop_state

7 years agoAdd setup/finish_frame methods to OccludedScene and ZSortedScene
Mikko Rasa [Mon, 5 Dec 2016 17:21:34 +0000 (19:21 +0200)]
Add setup/finish_frame methods to OccludedScene and ZSortedScene

7 years agoUse the external Renderer to render ShadowMap and EnvironmentMap
Mikko Rasa [Mon, 5 Dec 2016 17:20:17 +0000 (19:20 +0200)]
Use the external Renderer to render ShadowMap and EnvironmentMap

7 years agoChange the setup/finish_frame interface to be non-const
Mikko Rasa [Mon, 5 Dec 2016 17:04:30 +0000 (19:04 +0200)]
Change the setup/finish_frame interface to be non-const

There's no deprecated versions left behind because it would be impossible
to make it work with Renderables that forward the calls to a Scene.
Better to just get compile errors and fix them as I encounter them.

7 years agoStore Renderables as non-const pointers or references
Mikko Rasa [Mon, 5 Dec 2016 16:35:22 +0000 (18:35 +0200)]
Store Renderables as non-const pointers or references

It's irked me for a while how some renderables (mostly effects) need to
do internal updates in setup_frame, but it's const so I end up with a ton
of mutables.  Since almost all of my use cases actually pass in non-const
Renderables anyway, I'm just going to change this.