]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoSeparate abstract pixel compositions from concrete pixel formats
Mikko Rasa [Mon, 1 Feb 2021 19:08:29 +0000 (21:08 +0200)]
Separate abstract pixel compositions from concrete pixel formats

Texture and renderbuffer storage must now be specified using a sized
pixel format.  The PixelFormat API has also been refactored.

3 years agoRemove the deprecated form of Texture3D::load_image
Mikko Rasa [Mon, 1 Feb 2021 16:19:36 +0000 (18:19 +0200)]
Remove the deprecated form of Texture3D::load_image

3 years agoAlways use swizzle to implement luminance formats
Mikko Rasa [Mon, 1 Feb 2021 12:52:05 +0000 (14:52 +0200)]
Always use swizzle to implement luminance formats

ARB_texture_swizzle was promoted to core in OpenGL 3.3 and hardware not
supporting that is obsolete.

3 years agoSimplify applying texture swizzling
Mikko Rasa [Sun, 31 Jan 2021 11:11:52 +0000 (13:11 +0200)]
Simplify applying texture swizzling

It's now set once when creating storage for the texture, so tracking its
dirty state is not necessary.

3 years agoMove texture sampler state to a separate object
Mikko Rasa [Sun, 31 Jan 2021 00:55:49 +0000 (02:55 +0200)]
Move texture sampler state to a separate object

First step in supporting sampler objects

3 years agoAllow texture mipmap levels to be specified in datafiles
Mikko Rasa [Sun, 31 Jan 2021 00:24:14 +0000 (02:24 +0200)]
Allow texture mipmap levels to be specified in datafiles

This appears to have been missed in 03d3984 which removed the filtering
heuristic from storage/allocate.

3 years agoMove filter heuristic for mipmap levels to Texture::Loader
Mikko Rasa [Sun, 31 Jan 2021 00:09:16 +0000 (02:09 +0200)]
Move filter heuristic for mipmap levels to Texture::Loader

3 years agoImprove allocation handling in cube map textures
Mikko Rasa [Sat, 30 Jan 2021 18:03:47 +0000 (20:03 +0200)]
Improve allocation handling in cube map textures

While there isn't enough bits to track all face allocations, tracking
the base level per face is possible.  This allows mipmap generation to
work more sensibly.

3 years agoDeprecate the mipmap_levels parameter in Texture
Mikko Rasa [Sat, 30 Jan 2021 17:57:58 +0000 (19:57 +0200)]
Deprecate the mipmap_levels parameter in Texture

Instead specify the desired amount of mipmap levels when loading an
image.  This can be more robustly checked against the defined storage.

3 years agoRemove the usage member from Buffer entirely
Mikko Rasa [Tue, 26 Jan 2021 23:49:00 +0000 (01:49 +0200)]
Remove the usage member from Buffer entirely

3 years agoClear Texture2D's allocation flags when unloading
Mikko Rasa [Mon, 25 Jan 2021 23:47:05 +0000 (01:47 +0200)]
Clear Texture2D's allocation flags when unloading

3 years agoDisallow drawing batches without an index buffer
Mikko Rasa [Mon, 25 Jan 2021 23:41:16 +0000 (01:41 +0200)]
Disallow drawing batches without an index buffer

3 years agoGive a name to the ResourceManager loading thread
Mikko Rasa [Mon, 25 Jan 2021 23:38:57 +0000 (01:38 +0200)]
Give a name to the ResourceManager loading thread

3 years agoDon't try to set parameters for textures which aren't loaded yet
Mikko Rasa [Mon, 25 Jan 2021 23:20:48 +0000 (01:20 +0200)]
Don't try to set parameters for textures which aren't loaded yet

3 years agoUse glCreateTextures also for async loading
Mikko Rasa [Mon, 25 Jan 2021 23:19:33 +0000 (01:19 +0200)]
Use glCreateTextures also for async loading

Otherwise the texture won't be fully created when glTextureStorage2D
is called.

3 years agoBetter way of refreshing VertexSetup
Mikko Rasa [Mon, 25 Jan 2021 23:17:52 +0000 (01:17 +0200)]
Better way of refreshing VertexSetup

It can now disable attribute arrays which are no longer used.

3 years agoRefresh vertex setup when loading vertices for a mesh
Mikko Rasa [Mon, 25 Jan 2021 23:15:18 +0000 (01:15 +0200)]
Refresh vertex setup when loading vertices for a mesh

Also add a better guard against performing OpenGL calls from the loading
thread.

3 years agoTrigger Mesh::check_buffers from MeshBuilder destructor
Mikko Rasa [Mon, 25 Jan 2021 23:01:53 +0000 (01:01 +0200)]
Trigger Mesh::check_buffers from MeshBuilder destructor

Doing it for every vertex wastes performance

3 years agoMinor comment adjustments
Mikko Rasa [Mon, 25 Jan 2021 02:18:50 +0000 (04:18 +0200)]
Minor comment adjustments

3 years agoClear offset of Bufferable when removing from buffer
Mikko Rasa [Mon, 25 Jan 2021 02:15:33 +0000 (04:15 +0200)]
Clear offset of Bufferable when removing from buffer

It shouldn't really matter but just in case.

3 years agoRemove commented out debugging statements
Mikko Rasa [Mon, 25 Jan 2021 02:15:02 +0000 (04:15 +0200)]
Remove commented out debugging statements

3 years agoAdd some hints for older compilers
Mikko Rasa [Mon, 25 Jan 2021 02:14:35 +0000 (04:14 +0200)]
Add some hints for older compilers

3 years agoAdd datafile statement which was apparently forgotten
Mikko Rasa [Mon, 25 Jan 2021 02:13:10 +0000 (04:13 +0200)]
Add datafile statement which was apparently forgotten

3 years agoRefactor setting uniform values in ProgramData
Mikko Rasa [Mon, 25 Jan 2021 02:07:49 +0000 (04:07 +0200)]
Refactor setting uniform values in ProgramData

This eliminates copies when changing values of existing uniforms.

3 years agoThrow an exception if there's too many uniforms in a ProgramData
Mikko Rasa [Mon, 25 Jan 2021 02:04:11 +0000 (04:04 +0200)]
Throw an exception if there's too many uniforms in a ProgramData

I'd rather find out I need to make the mask wider than have a program
unexplainably slow down.

3 years agoAdd another constructor to RenderTarget to resolve an ambiguity
Mikko Rasa [Mon, 25 Jan 2021 01:21:00 +0000 (03:21 +0200)]
Add another constructor to RenderTarget to resolve an ambiguity

RenderOutput looks like an unsigned more than a RenderTargetFormat so
the compiler would resolve it to the multisample overload.

3 years agoRename batch's data_type to index_type
Mikko Rasa [Mon, 25 Jan 2021 01:13:29 +0000 (03:13 +0200)]
Rename batch's data_type to index_type

3 years agoRead shader and program info logs directly into an std::string
Mikko Rasa [Mon, 25 Jan 2021 01:07:18 +0000 (03:07 +0200)]
Read shader and program info logs directly into an std::string

3 years agoMake buffer storage immutable and use ARB_buffer_storage
Mikko Rasa [Mon, 25 Jan 2021 00:56:06 +0000 (02:56 +0200)]
Make buffer storage immutable and use ARB_buffer_storage

3 years agoDeprecate some Buffer features which don't translate to Vulkan
Mikko Rasa [Mon, 25 Jan 2021 00:48:21 +0000 (02:48 +0200)]
Deprecate some Buffer features which don't translate to Vulkan

3 years agoMove buffer resizing out of Bufferable
Mikko Rasa [Mon, 25 Jan 2021 00:12:26 +0000 (02:12 +0200)]
Move buffer resizing out of Bufferable

Required for immutable buffer storage.  This commit has a couple warts
I didn't bother to fix because those parts will be rewritten.

3 years agoSome tweaks to Mesh::add_batch
Mikko Rasa [Sun, 24 Jan 2021 23:46:34 +0000 (01:46 +0200)]
Some tweaks to Mesh::add_batch

Index buffer can be assumed to exist.  Add a fast path for first batch,
which will also be useful in the next stage of buffer refactoring.

3 years agoFurther refactor Bufferable's API for derived classes
Mikko Rasa [Sun, 24 Jan 2021 16:25:51 +0000 (18:25 +0200)]
Further refactor Bufferable's API for derived classes

3 years agoClear the dirty flag of Bufferable in upload_data
Mikko Rasa [Sun, 24 Jan 2021 14:13:20 +0000 (16:13 +0200)]
Clear the dirty flag of Bufferable in upload_data

3 years agoRemove support for UInt8 indices from Batch
Mikko Rasa [Sat, 23 Jan 2021 17:27:32 +0000 (19:27 +0200)]
Remove support for UInt8 indices from Batch

Vulkan does not support them

3 years agoCollapse the shared part of Mesh::draw and draw_instanced
Mikko Rasa [Sat, 23 Jan 2021 17:26:28 +0000 (19:26 +0200)]
Collapse the shared part of Mesh::draw and draw_instanced

3 years agoIncrease version to 3.0
Mikko Rasa [Sat, 23 Jan 2021 10:01:36 +0000 (12:01 +0200)]
Increase version to 3.0

The recent modernization work has introduced some incompatible changes,
and now I'm gearing towards Vulkan support which will change the API
even more.

3 years agoUse matching type to retrieve interpolated spline values
Mikko Rasa [Sun, 17 Jan 2021 17:02:26 +0000 (19:02 +0200)]
Use matching type to retrieve interpolated spline values

This way the double-to-float conversion is done at a more relevant stage.

3 years agoConvert the extension generator script to Python 3
Mikko Rasa [Sat, 9 Jan 2021 16:53:09 +0000 (18:53 +0200)]
Convert the extension generator script to Python 3

3 years agoFix applying of single-component scaling curves
Mikko Rasa [Thu, 7 Jan 2021 22:28:19 +0000 (00:28 +0200)]
Fix applying of single-component scaling curves

3 years agoSuppress some deprecation warnings from internal use
Mikko Rasa [Thu, 7 Jan 2021 10:16:33 +0000 (12:16 +0200)]
Suppress some deprecation warnings from internal use

3 years agoAdd multiplication operators between Matrix and float
Mikko Rasa [Wed, 30 Dec 2020 15:09:15 +0000 (17:09 +0200)]
Add multiplication operators between Matrix and float

Newer gcc versions are complaining about an ambiguity between the vector
multiplication operators in GL::Matrix and the scalar multiplication for
LinAl::Matrix.

3 years agoActually use the light color in cooktorrance shader
Mikko Rasa [Sun, 2 Aug 2020 12:04:41 +0000 (15:04 +0300)]
Actually use the light color in cooktorrance shader

3 years agoUse correct shader variable names for PBR materials
Mikko Rasa [Sun, 2 Aug 2020 11:44:56 +0000 (14:44 +0300)]
Use correct shader variable names for PBR materials

3 years agoConvert exporter operator properties to annotations
Mikko Rasa [Sat, 27 Jun 2020 09:30:44 +0000 (12:30 +0300)]
Convert exporter operator properties to annotations

3 years agoReplace single file mode in object exporter with collection
Mikko Rasa [Sat, 27 Jun 2020 08:57:58 +0000 (11:57 +0300)]
Replace single file mode in object exporter with collection

3 years agoRefactor export extension change into the exporter base class
Mikko Rasa [Fri, 26 Jun 2020 23:07:02 +0000 (02:07 +0300)]
Refactor export extension change into the exporter base class

3 years agoRefactor writing files in the Blender exporter
Mikko Rasa [Fri, 26 Jun 2020 22:53:21 +0000 (01:53 +0300)]
Refactor writing files in the Blender exporter

Instead of having the same loop over statements in a dozen of places,
put it in the Resource class.

3 years agoRemove support for inline textures in RenderPass
Mikko Rasa [Tue, 23 Jun 2020 16:38:56 +0000 (19:38 +0300)]
Remove support for inline textures in RenderPass

The datafile system has advanced sufficiently that this particular case
of inlining is no longer needed.

3 years agoUpdate export progress more frequently
Mikko Rasa [Tue, 23 Jun 2020 16:38:03 +0000 (19:38 +0300)]
Update export progress more frequently

3 years agoRaise an exception if the TBN UV layer is not found during export
Mikko Rasa [Tue, 23 Jun 2020 16:37:40 +0000 (19:37 +0300)]
Raise an exception if the TBN UV layer is not found during export

3 years agoRework Blender material and texture export
Mikko Rasa [Tue, 23 Jun 2020 15:14:59 +0000 (18:14 +0300)]
Rework Blender material and texture export

3 years agoRequire all uniforms in a buffer-backed block to be present
Mikko Rasa [Tue, 23 Jun 2020 14:20:20 +0000 (17:20 +0300)]
Require all uniforms in a buffer-backed block to be present

3 years agoMake setting a nonexistent uniform only a warning in debug builds
Mikko Rasa [Tue, 23 Jun 2020 14:19:11 +0000 (17:19 +0300)]
Make setting a nonexistent uniform only a warning in debug builds

During development it's sometimes necessary to disable parts of a shader,
which causes variables to disappear.

3 years agoNormalize fragment normal
Mikko Rasa [Tue, 23 Jun 2020 14:11:54 +0000 (17:11 +0300)]
Normalize fragment normal

With some shading models even small deviations, such as result from
the quantization to 8-bit texel component values, may cause visible
artifacts.

3 years agoAdd a PBR material type and corresponding shader
Mikko Rasa [Tue, 23 Jun 2020 14:06:30 +0000 (17:06 +0300)]
Add a PBR material type and corresponding shader

3 years agoNaming tweaks in builtin shaders
Mikko Rasa [Tue, 23 Jun 2020 14:01:53 +0000 (17:01 +0300)]
Naming tweaks in builtin shaders

3 years agoUse HDR rendering and a colorcurve postprocessor in desertpillars
Mikko Rasa [Thu, 11 Jun 2020 19:24:20 +0000 (22:24 +0300)]
Use HDR rendering and a colorcurve postprocessor in desertpillars

3 years agoModernize the demo and tool programs
Mikko Rasa [Thu, 11 Jun 2020 15:07:38 +0000 (18:07 +0300)]
Modernize the demo and tool programs

3 years agoAdd a flag to BasicMaterial to enable shadow map
Mikko Rasa [Thu, 11 Jun 2020 19:05:19 +0000 (22:05 +0300)]
Add a flag to BasicMaterial to enable shadow map

3 years agoFix shadow map uniform name
Mikko Rasa [Thu, 11 Jun 2020 14:18:08 +0000 (17:18 +0300)]
Fix shadow map uniform name

3 years agoGive materials the capability to automatically create a suitable shader
Mikko Rasa [Thu, 11 Jun 2020 13:23:19 +0000 (16:23 +0300)]
Give materials the capability to automatically create a suitable shader

3 years agoCheck uniforms as a hint for texunit to use for material textures
Mikko Rasa [Thu, 11 Jun 2020 11:13:38 +0000 (14:13 +0300)]
Check uniforms as a hint for texunit to use for material textures

3 years agoRecreate RenderPass shdata if a new program is specified
Mikko Rasa [Thu, 11 Jun 2020 08:09:14 +0000 (11:09 +0300)]
Recreate RenderPass shdata if a new program is specified

3 years agoCopy the tied program of ProgramData
Mikko Rasa [Thu, 4 Jun 2020 23:16:16 +0000 (02:16 +0300)]
Copy the tied program of ProgramData

3 years agoAdd a new, better structured Phong shader
Mikko Rasa [Thu, 4 Jun 2020 21:04:53 +0000 (00:04 +0300)]
Add a new, better structured Phong shader

3 years agoRedesign the material system
Mikko Rasa [Wed, 3 Jun 2020 18:56:00 +0000 (21:56 +0300)]
Redesign the material system

Now that legacy OpenGL support is removed and all lighting calculations
are done in shaders, there's no reason to stick to the old material model
anymore.  The new model is closer to that used by many 3D modeling
programs, with textures applied to material properties.  It also allows
different types of materials with different shading models.

This change breaks source compatibility, but the new BasicMaterial class
is mostly compatible with the old Material class, with only minor changes
needed in code and datafiles.

3 years agoFix a bug with setting uniforms after texunits
Mikko Rasa [Mon, 1 Jun 2020 10:11:30 +0000 (13:11 +0300)]
Fix a bug with setting uniforms after texunits

3 years agoWrite the occluder shader in GLSL
Mikko Rasa [Sun, 31 May 2020 21:53:04 +0000 (00:53 +0300)]
Write the occluder shader in GLSL

3 years agoAdd a texunit statement which automatically determines the unit number
Mikko Rasa [Sun, 31 May 2020 09:43:03 +0000 (12:43 +0300)]
Add a texunit statement which automatically determines the unit number

3 years agoRemove obsolete demo programs
Mikko Rasa [Mon, 25 May 2020 19:11:58 +0000 (22:11 +0300)]
Remove obsolete demo programs

3 years agoMark ProgramBuilder as deprecated
Mikko Rasa [Mon, 25 May 2020 18:43:29 +0000 (21:43 +0300)]
Mark ProgramBuilder as deprecated

3 years agoChange Texturing to store index-texture pairs
Mikko Rasa [Mon, 25 May 2020 15:17:28 +0000 (18:17 +0300)]
Change Texturing to store index-texture pairs

Modern GPUs have a large number of texture binding points so storing
texture pointers for all of them is inefficient.

3 years agoAutomatically add uniforms for texunits
Mikko Rasa [Tue, 19 May 2020 12:16:35 +0000 (15:16 +0300)]
Automatically add uniforms for texunits

The uniform statement now uses existing ProgramData if it exists, to
avoid inadvertently erasing the texunit uniforms.

3 years agoRequire shader for rendering
Mikko Rasa [Mon, 18 May 2020 22:57:24 +0000 (01:57 +0300)]
Require shader for rendering

Being able to assume shaders are used will make implementing some
features easier.

4 years agoRemove attribute proxying from Mesh in the Blender exporter
Mikko Rasa [Sun, 3 May 2020 22:28:28 +0000 (01:28 +0300)]
Remove attribute proxying from Mesh in the Blender exporter

Instead just copy all the data.  This makes the script easier to read and
avoids holding references to stale data.

4 years agoUpdate the Blender exporter for version 2.80
Mikko Rasa [Sun, 3 May 2020 22:22:55 +0000 (01:22 +0300)]
Update the Blender exporter for version 2.80

Textures are disabled for now.  Blender's materials have changed
significantly enough to be difficult to map to the current mspgl material
system and I'm planning to do some changes to the library anyway.

4 years agoCheck that Object has a Mesh when rendering
Mikko Rasa [Thu, 5 Mar 2020 17:46:03 +0000 (19:46 +0200)]
Check that Object has a Mesh when rendering

4 years agoAdd a find_pass function to Technique
Mikko Rasa [Sat, 2 May 2020 14:55:37 +0000 (17:55 +0300)]
Add a find_pass function to Technique

4 years agoFix euler angle calculation in Transform
Mikko Rasa [Sun, 9 Feb 2020 22:07:37 +0000 (00:07 +0200)]
Fix euler angle calculation in Transform

4 years agoAccess static functions through class and not instance
Mikko Rasa [Sun, 9 Feb 2020 22:07:09 +0000 (00:07 +0200)]
Access static functions through class and not instance

4 years agoCosmetic fixes
Mikko Rasa [Sun, 9 Feb 2020 22:06:54 +0000 (00:06 +0200)]
Cosmetic fixes

4 years agoCheck for non-null buffer in Bufferable's refresh function
Mikko Rasa [Sun, 9 Feb 2020 22:04:14 +0000 (00:04 +0200)]
Check for non-null buffer in Bufferable's refresh function

4 years agoFlush the shader data of View's Renderer after rendering
Mikko Rasa [Sun, 9 Feb 2020 22:01:58 +0000 (00:01 +0200)]
Flush the shader data of View's Renderer after rendering

In a very simple application with only a single renderable omitting the
flush would prevent shader data from being updated.

4 years agoMake all overloads of render available in WindowView
Mikko Rasa [Sun, 9 Feb 2020 22:01:35 +0000 (00:01 +0200)]
Make all overloads of render available in WindowView

4 years agoAdd a function to clear all FBO component buffers
Mikko Rasa [Sun, 9 Feb 2020 22:00:26 +0000 (00:00 +0200)]
Add a function to clear all FBO component buffers

4 years agoRemove the kludge for FBO error codes on GLES
Mikko Rasa [Sun, 9 Feb 2020 21:57:57 +0000 (23:57 +0200)]
Remove the kludge for FBO error codes on GLES

This turned out to be a bad idea as the constants are not defined in the
headers.  Not having them here makes the extension generator emit the
definitions with a proper #ifndef guard.

4 years agoDon't call glVertexAttribDivisor if the extension is not available
Mikko Rasa [Sun, 9 Feb 2020 21:53:24 +0000 (23:53 +0200)]
Don't call glVertexAttribDivisor if the extension is not available

4 years agoUse GLES3 headers instead of GLES2
Mikko Rasa [Sun, 9 Feb 2020 21:51:16 +0000 (23:51 +0200)]
Use GLES3 headers instead of GLES2

A few constants are not available in GLES2 and would be bothersome to
introduce through a fake extension.  I'll bring back compatibility if
some relevant hardware turns out to only support GLES2.

4 years agoRemove sized L and LA pixel formats
Mikko Rasa [Sun, 9 Feb 2020 21:48:45 +0000 (23:48 +0200)]
Remove sized L and LA pixel formats

These constants are not part of modern OpenGL and not supported on
OpenGL ES.  The unsized formats can still be used for uploading data
and will be translated to RED and RG for use as internal format.

4 years agoAdd the specializations for non-square matrix uniforms
Mikko Rasa [Sun, 9 Feb 2020 20:51:04 +0000 (22:51 +0200)]
Add the specializations for non-square matrix uniforms

These were forgotten from d971f8d.

4 years agoRecognize an assignment to an out parameter as used
Mikko Rasa [Wed, 5 Feb 2020 21:48:46 +0000 (23:48 +0200)]
Recognize an assignment to an out parameter as used

4 years agoAdd support for non-square matrix uniforms
Mikko Rasa [Wed, 5 Feb 2020 21:35:42 +0000 (23:35 +0200)]
Add support for non-square matrix uniforms

4 years agoRewrite ProgramData update in a more efficient way
Mikko Rasa [Wed, 5 Feb 2020 18:07:28 +0000 (20:07 +0200)]
Rewrite ProgramData update in a more efficient way

This method does not do any map lookups on the fast path.

4 years agoRemove the EXT_draw_range_elements extension
Mikko Rasa [Mon, 4 Nov 2019 01:58:45 +0000 (03:58 +0200)]
Remove the EXT_draw_range_elements extension

Its main use is to allow the OpenGL implementation to optimize reads from
client memory, which is moot when storing vertices in VRAM.

4 years agoCheck for null camera in View::render
Mikko Rasa [Mon, 4 Nov 2019 01:56:05 +0000 (03:56 +0200)]
Check for null camera in View::render

4 years agoAllow system framebuffer to not have attachments
Mikko Rasa [Mon, 4 Nov 2019 01:55:41 +0000 (03:55 +0200)]
Allow system framebuffer to not have attachments

4 years agoUse a persistent Renderer in View
Mikko Rasa [Sun, 3 Nov 2019 17:41:37 +0000 (19:41 +0200)]
Use a persistent Renderer in View

4 years agoDeprecated the Renderer constructor taking a Camera pointer
Mikko Rasa [Sun, 3 Nov 2019 11:58:16 +0000 (13:58 +0200)]
Deprecated the Renderer constructor taking a Camera pointer

4 years agoRemove one more render function without a Renderer I missed before
Mikko Rasa [Fri, 1 Nov 2019 08:25:22 +0000 (10:25 +0200)]
Remove one more render function without a Renderer I missed before