]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
2 years agoRemove RenderBuffer and always use textures as framebuffer attachments
Mikko Rasa [Sun, 12 Sep 2021 22:01:51 +0000 (01:01 +0300)]
Remove RenderBuffer and always use textures as framebuffer attachments

Originally textures could not have multiple samples, but now they can.
Vulkan only has images which are used for both purposes.

2 years agoFix incorrect render target buffer names
Mikko Rasa [Sat, 11 Sep 2021 14:24:16 +0000 (17:24 +0300)]
Fix incorrect render target buffer names

2 years agoRework PixelComponents and PixelFormat to use custom values
Mikko Rasa [Sat, 11 Sep 2021 14:23:56 +0000 (17:23 +0300)]
Rework PixelComponents and PixelFormat to use custom values

2 years agoDisconnect the PrimitiveType enum from OpenGL constants
Mikko Rasa [Sat, 11 Sep 2021 10:54:43 +0000 (13:54 +0300)]
Disconnect the PrimitiveType enum from OpenGL constants

2 years agoCreate a class for issuing drawing commands
Mikko Rasa [Sat, 11 Sep 2021 10:40:18 +0000 (13:40 +0300)]
Create a class for issuing drawing commands

This is a precursor to command buffers in Vulkan.

2 years agoRemove outdated includes
Mikko Rasa [Sun, 5 Sep 2021 11:35:05 +0000 (14:35 +0300)]
Remove outdated includes

2 years agoStore index type in VertexSetup
Mikko Rasa [Sun, 5 Sep 2021 11:34:04 +0000 (14:34 +0300)]
Store index type in VertexSetup

2 years agoUse the same index type for all of a Mesh's batches
Mikko Rasa [Sun, 5 Sep 2021 11:10:32 +0000 (14:10 +0300)]
Use the same index type for all of a Mesh's batches

In Vulkan the index type goes in the pipeline state object.

2 years agoMiscellaneous cleanup
Mikko Rasa [Sat, 28 Aug 2021 08:52:28 +0000 (11:52 +0300)]
Miscellaneous cleanup

2 years agoRemove the Bindable class
Mikko Rasa [Sat, 28 Aug 2021 08:41:08 +0000 (11:41 +0300)]
Remove the Bindable class

It's no longer used anywere

2 years agoRemove the PixelStore class
Mikko Rasa [Sat, 28 Aug 2021 08:26:02 +0000 (11:26 +0300)]
Remove the PixelStore class

Instead just permanently set unpack alignment to 1.  This seems to
match Vulkan.

2 years agoRemove public binding APIs from Renderbuffer and Clipping
Mikko Rasa [Fri, 27 Aug 2021 14:17:10 +0000 (17:17 +0300)]
Remove public binding APIs from Renderbuffer and Clipping

2 years agoConvert framebuffers and related functionality to new state management
Mikko Rasa [Fri, 27 Aug 2021 13:26:26 +0000 (16:26 +0300)]
Convert framebuffers and related functionality to new state management

2 years agoRedesign depth and stencil test and blend state management
Mikko Rasa [Wed, 18 Aug 2021 14:33:59 +0000 (17:33 +0300)]
Redesign depth and stencil test and blend state management

2 years agoDecouple the Predicate enum from OpenGL constants
Mikko Rasa [Wed, 18 Aug 2021 14:13:25 +0000 (17:13 +0300)]
Decouple the Predicate enum from OpenGL constants

2 years agoSome fixes to applying pipeline state
Mikko Rasa [Wed, 18 Aug 2021 14:00:01 +0000 (17:00 +0300)]
Some fixes to applying pipeline state

2 years agoAdd a helper function to set variables and flags in PipelineState
Mikko Rasa [Wed, 18 Aug 2021 13:59:26 +0000 (16:59 +0300)]
Add a helper function to set variables and flags in PipelineState

2 years agoRefactor winding-based culling
Mikko Rasa [Tue, 17 Aug 2021 21:39:41 +0000 (00:39 +0300)]
Refactor winding-based culling

2 years agoRewrite state management
Mikko Rasa [Mon, 16 Aug 2021 16:11:25 +0000 (19:11 +0300)]
Rewrite state management

Global bindings have been removed from the central classes (and will be
removed from others soon) since those would translate poorly to Vulkan.
Instead a new PipelineState class is used to tie all of the state
together and apply it at once.

2 years agoAllow materials to return per-texture samplers
Mikko Rasa [Fri, 13 Aug 2021 10:54:33 +0000 (13:54 +0300)]
Allow materials to return per-texture samplers

2 years agoRefactor get_level_size in various texture classes
Mikko Rasa [Fri, 13 Aug 2021 09:59:20 +0000 (12:59 +0300)]
Refactor get_level_size in various texture classes

Also add a few argument validity checks to functions

2 years agoUse DSA for TextureCube if available
Mikko Rasa [Thu, 12 Aug 2021 13:03:25 +0000 (16:03 +0300)]
Use DSA for TextureCube if available

2 years agoRemove some deprecated stuff that's getting in the way
Mikko Rasa [Thu, 12 Aug 2021 11:35:45 +0000 (14:35 +0300)]
Remove some deprecated stuff that's getting in the way

2 years agoRemove default sampler from Texture
Mikko Rasa [Thu, 12 Aug 2021 09:35:16 +0000 (12:35 +0300)]
Remove default sampler from Texture

It was a bad idea and would not translate well to Vulkan.

2 years agoRemove the notion of default binding point from Buffer
Mikko Rasa [Wed, 11 Aug 2021 21:09:01 +0000 (00:09 +0300)]
Remove the notion of default binding point from Buffer

It's more robust to always specify the binding point when using the
buffer.

ARRAY_BUFFER is used for buffer operations because it's always available
and is only used transiently by other code so there's no interference.

2 years agoAlways use ARB_map_buffer_range for mapping buffers
Mikko Rasa [Wed, 11 Aug 2021 15:02:28 +0000 (18:02 +0300)]
Always use ARB_map_buffer_range for mapping buffers

2 years agoHandle all shader data in Renderer through the generic mechanism
Mikko Rasa [Mon, 9 Aug 2021 12:10:11 +0000 (15:10 +0300)]
Handle all shader data in Renderer through the generic mechanism

2 years agoStore implementation limits in a central struct
Mikko Rasa [Mon, 9 Aug 2021 09:12:06 +0000 (12:12 +0300)]
Store implementation limits in a central struct

2 years agoDeprecate external access to Renderer::flush_shader_data
Mikko Rasa [Sun, 8 Aug 2021 22:52:31 +0000 (01:52 +0300)]
Deprecate external access to Renderer::flush_shader_data

It's no longer needed since changes in ProgramData are tracked with a
generation number.

2 years agoDeprecated setting Material or Lighting on Renderer
Mikko Rasa [Sat, 7 Aug 2021 12:07:44 +0000 (15:07 +0300)]
Deprecated setting Material or Lighting on Renderer

Those no longer have any special state of their own and can be set as
ProgramData instead.

2 years agoOnly allow VertexArray's format to be set once
Mikko Rasa [Wed, 4 Aug 2021 17:58:42 +0000 (20:58 +0300)]
Only allow VertexArray's format to be set once

Also affects related classes like VertexSetup and Mesh.  This will make
state management with Vulkan easier.

2 years agoAdd a window size option to viewer
Mikko Rasa [Thu, 13 May 2021 13:19:50 +0000 (16:19 +0300)]
Add a window size option to viewer

2 years agoSet debug names for dynamically created objects in desert pillars
Mikko Rasa [Thu, 13 May 2021 12:02:58 +0000 (15:02 +0300)]
Set debug names for dynamically created objects in desert pillars

2 years agoAdd ambient occlusion to the desert pillars demo
Mikko Rasa [Thu, 13 May 2021 12:02:36 +0000 (15:02 +0300)]
Add ambient occlusion to the desert pillars demo

2 years agoSupport exporting ambient occlusion postprocessor from Blender
Mikko Rasa [Thu, 13 May 2021 12:01:48 +0000 (15:01 +0300)]
Support exporting ambient occlusion postprocessor from Blender

2 years agoMove the HDR flag in Blender to render settings
Mikko Rasa [Thu, 13 May 2021 11:56:19 +0000 (14:56 +0300)]
Move the HDR flag in Blender to render settings

2 years agoClear VertexSetup state when a Mesh is unloaded
Mikko Rasa [Thu, 13 May 2021 11:16:33 +0000 (14:16 +0300)]
Clear VertexSetup state when a Mesh is unloaded

2 years agoAlways assume Technique has shaders
Mikko Rasa [Thu, 13 May 2021 11:04:41 +0000 (14:04 +0300)]
Always assume Technique has shaders

2 years agoRemove the Renderer-less render function from PostProcessor
Mikko Rasa [Sun, 9 May 2021 16:16:00 +0000 (19:16 +0300)]
Remove the Renderer-less render function from PostProcessor

2 years agoAdd debug name capability to more classes
Mikko Rasa [Sun, 9 May 2021 12:31:32 +0000 (15:31 +0300)]
Add debug name capability to more classes

2 years agoAdd inline data items to the collection
Mikko Rasa [Sun, 9 May 2021 10:53:13 +0000 (13:53 +0300)]
Add inline data items to the collection

This simplifies the internals of various objects and does away with
the special keep() semantic of RefPtr.

Blend and DepthTest will be handled separately as part of rendering
state rework.

2 years agoAdd OccludedScene to the registered scene types
Mikko Rasa [Sun, 9 May 2021 08:22:19 +0000 (11:22 +0300)]
Add OccludedScene to the registered scene types

2 years agoDeprecate the old skylight properties in Lighting
Mikko Rasa [Sat, 8 May 2021 19:43:43 +0000 (22:43 +0300)]
Deprecate the old skylight properties in Lighting

It's no longer supported by the standard shaders, and IBL is a superior
solution.

2 years agoFix the name of the PBR fresnel lookup texture
Mikko Rasa [Sat, 8 May 2021 18:44:15 +0000 (21:44 +0300)]
Fix the name of the PBR fresnel lookup texture

2 years agoIncrease ambient occlusion max samples to 128
Mikko Rasa [Sat, 8 May 2021 17:37:50 +0000 (20:37 +0300)]
Increase ambient occlusion max samples to 128

2 years agoTake ambient occlusion samples only from the forward hemisphere
Mikko Rasa [Sat, 8 May 2021 17:33:57 +0000 (20:33 +0300)]
Take ambient occlusion samples only from the forward hemisphere

This requires a few more samples from the depth buffer to determine the
normal, but that should not be an issue with today's GPUs.

Also generate the sample points for cosine-weighted importance sampling
to obtain physically correct occlusion values.

2 years agoUse non-random sequences to initialize ambient occlusion data
Mikko Rasa [Sat, 8 May 2021 17:31:42 +0000 (20:31 +0300)]
Use non-random sequences to initialize ambient occlusion data

This allows selecting the formulas to obtain a better distribution of
values.

2 years agoStore the ambient occlusion rotate lookup texture in resources
Mikko Rasa [Sat, 8 May 2021 15:41:28 +0000 (18:41 +0300)]
Store the ambient occlusion rotate lookup texture in resources

2 years agoUse correct sampler for the ambient occlusion rotate lookup
Mikko Rasa [Sat, 8 May 2021 15:36:40 +0000 (18:36 +0300)]
Use correct sampler for the ambient occlusion rotate lookup

2 years agoFix use of camera matrices in the ambient occlusion effect
Mikko Rasa [Sat, 8 May 2021 15:10:53 +0000 (18:10 +0300)]
Fix use of camera matrices in the ambient occlusion effect

2 years agoAdd inverse view and projection matrices to camera transform uniforms
Mikko Rasa [Sat, 8 May 2021 15:09:31 +0000 (18:09 +0300)]
Add inverse view and projection matrices to camera transform uniforms

2 years agoUse persistent uniform blocks for Camera, Lighting and Clipping
Mikko Rasa [Sat, 8 May 2021 14:58:11 +0000 (17:58 +0300)]
Use persistent uniform blocks for Camera, Lighting and Clipping

Now that the relevant calculations are done in world space, the values
of these uniforms don't need to be calculated on a per-frame basis.

2 years agoChange Clipping to use index-less attaching
Mikko Rasa [Sat, 8 May 2021 13:40:23 +0000 (16:40 +0300)]
Change Clipping to use index-less attaching

2 years agoUse PBR with IBL for the sphere in desert pillars
Mikko Rasa [Sat, 8 May 2021 11:45:28 +0000 (14:45 +0300)]
Use PBR with IBL for the sphere in desert pillars

2 years agoAdd a property in Blender for a custom shadow shader
Mikko Rasa [Thu, 6 May 2021 10:20:24 +0000 (13:20 +0300)]
Add a property in Blender for a custom shadow shader

Since a shadow map doesn't have color output, it's useful to specify a
cheaper shader which only does vertex transformations.

2 years agoPut the PI constant in builtins
Mikko Rasa [Thu, 6 May 2021 10:15:40 +0000 (13:15 +0300)]
Put the PI constant in builtins

It's needed in several places so this is easier than defining it
separately everywhere.

2 years agoImplement image-based lighting in PbrMaterial
Mikko Rasa [Thu, 6 May 2021 08:16:05 +0000 (11:16 +0300)]
Implement image-based lighting in PbrMaterial

EnvironmentMap now has a constructor with an extra parameter indicating
the number of mipmap levels to use for prefiltering with varying amounts
of roughness.

2 years agoSupport layered framebuffer attachments
Mikko Rasa [Thu, 6 May 2021 08:14:47 +0000 (11:14 +0300)]
Support layered framebuffer attachments

2 years agoModify sunlight color based on transmittance of the atmosphere
Mikko Rasa [Wed, 5 May 2021 15:35:34 +0000 (18:35 +0300)]
Modify sunlight color based on transmittance of the atmosphere

2 years agoRe-export desert pillars data with ambient light
Mikko Rasa [Wed, 5 May 2021 15:04:51 +0000 (18:04 +0300)]
Re-export desert pillars data with ambient light

2 years agoSet shadowmap darkness to 1.0 by default
Mikko Rasa [Wed, 5 May 2021 12:30:51 +0000 (15:30 +0300)]
Set shadowmap darkness to 1.0 by default

It's not physically correct for lights to affect shadowed areas.

2 years agoExport the scene's background color as ambient light color
Mikko Rasa [Wed, 5 May 2021 12:29:05 +0000 (15:29 +0300)]
Export the scene's background color as ambient light color

2 years agoMinor refactoring of the Blender exporter
Mikko Rasa [Wed, 5 May 2021 11:22:53 +0000 (14:22 +0300)]
Minor refactoring of the Blender exporter

2 years agoImplement ambient lighting in the Cook-Torrance shader
Mikko Rasa [Wed, 5 May 2021 09:10:13 +0000 (12:10 +0300)]
Implement ambient lighting in the Cook-Torrance shader

The fresnel lookup texture used here is the same that will be needed for
image-based lighting.

2 years agoFix an incorrect include in the desertpillars demo
Mikko Rasa [Wed, 5 May 2021 08:26:41 +0000 (11:26 +0300)]
Fix an incorrect include in the desertpillars demo

2 years agoMark shaders created by materials as kept
Mikko Rasa [Tue, 4 May 2021 21:41:22 +0000 (00:41 +0300)]
Mark shaders created by materials as kept

Since they're stored in resources, it's not appropriate to delete them
outside of it.

2 years agoAccess builtin resources through a global instance
Mikko Rasa [Tue, 4 May 2021 20:13:33 +0000 (23:13 +0300)]
Access builtin resources through a global instance

Explicitly passing the Resources reference causes problems when some
classes in a hierarchy need it and others don't.  It's also awkward in
RenderPass::set_material and PostProcessor templates.  It doesn't even
matter which instance is passed in since the data is builtin anyway.

The first created Resources instance is now registered as the one to use
for builtin data, unless suppressed by a constructor parameter.

2 years agoFix brokenness from EnvironmentMap changes
Mikko Rasa [Wed, 28 Apr 2021 21:52:46 +0000 (00:52 +0300)]
Fix brokenness from EnvironmentMap changes

Commit fea00ed accidentally included some stuff that wasn't finished yet.

2 years agoMove lighting calculations to world space
Mikko Rasa [Wed, 28 Apr 2021 21:18:54 +0000 (00:18 +0300)]
Move lighting calculations to world space

Eye space lighting was a holdover from legacy OpenGL.  TBN space lighting
was similarly a kludge from old dot3 bump mapping.  Using world space
makes everything a lot simpler and allows some additional optimizations.

2 years agoThe load cache still needs to be pruned after the loop too
Mikko Rasa [Wed, 28 Apr 2021 11:44:00 +0000 (14:44 +0300)]
The load cache still needs to be pruned after the loop too

Under SPIR-V's structured flow control rules it's not permissible to use
a result from inside the loop except with OpPhi.

2 years agoImplement other texture query functions for GLSL
Mikko Rasa [Wed, 28 Apr 2021 11:43:33 +0000 (14:43 +0300)]
Implement other texture query functions for GLSL

2 years agoImplement textureSize as a visitor function in the SPIR-V generator
Mikko Rasa [Wed, 28 Apr 2021 11:38:55 +0000 (14:38 +0300)]
Implement textureSize as a visitor function in the SPIR-V generator

It requires an image as an operand, not a sampled image.

2 years agoStore required capabilities for SPIR-V builtin functions
Mikko Rasa [Wed, 28 Apr 2021 11:04:49 +0000 (14:04 +0300)]
Store required capabilities for SPIR-V builtin functions

2 years agoCheck if any shader data has changed when applying Renderer state
Mikko Rasa [Tue, 27 Apr 2021 10:28:04 +0000 (13:28 +0300)]
Check if any shader data has changed when applying Renderer state

2 years agoActually update the shdata generation numbers in Renderer
Mikko Rasa [Tue, 27 Apr 2021 10:27:11 +0000 (13:27 +0300)]
Actually update the shdata generation numbers in Renderer

2 years agoSet OpenGL debug labels on various objects loaded from Resources
Mikko Rasa [Sun, 25 Apr 2021 11:28:17 +0000 (14:28 +0300)]
Set OpenGL debug labels on various objects loaded from Resources

2 years agoRefactor program stage management
Mikko Rasa [Sun, 25 Apr 2021 11:13:16 +0000 (14:13 +0300)]
Refactor program stage management

There can't bee a huge number of stages in a program so a fixed-size
array takes less space than a vector.  It also allows accessing ids of
specific stages if needed.

3 years agoUse seamless cube map filtering if available
Mikko Rasa [Sat, 24 Apr 2021 21:32:45 +0000 (00:32 +0300)]
Use seamless cube map filtering if available

3 years agoUse a HDR environment map in desertpillars
Mikko Rasa [Sat, 24 Apr 2021 20:28:38 +0000 (23:28 +0300)]
Use a HDR environment map in desertpillars

3 years agoMake EnvironmentMap's pixel format configurable
Mikko Rasa [Sat, 24 Apr 2021 20:18:51 +0000 (23:18 +0300)]
Make EnvironmentMap's pixel format configurable

3 years agoUse RenderTargets in the Sky effect
Mikko Rasa [Sat, 24 Apr 2021 20:11:26 +0000 (23:11 +0300)]
Use RenderTargets in the Sky effect

3 years agoCosmetic fixes
Mikko Rasa [Sat, 24 Apr 2021 19:44:34 +0000 (22:44 +0300)]
Cosmetic fixes

3 years agoMake ShadowMap's finish_frame run only once per frame
Mikko Rasa [Sat, 24 Apr 2021 19:41:39 +0000 (22:41 +0300)]
Make ShadowMap's finish_frame run only once per frame

3 years agoRemove a now-unnecessary flush_shader_data call
Mikko Rasa [Sat, 24 Apr 2021 19:36:38 +0000 (22:36 +0300)]
Remove a now-unnecessary flush_shader_data call

This got missed in bb386d8.

3 years agoCompile SPIR-V modules from GLSL if needed
Mikko Rasa [Sat, 24 Apr 2021 19:35:30 +0000 (22:35 +0300)]
Compile SPIR-V modules from GLSL if needed

3 years agoFix opcode for matrix inverse
Mikko Rasa [Sat, 24 Apr 2021 19:31:41 +0000 (22:31 +0300)]
Fix opcode for matrix inverse

3 years agoAdd a cached load when initializing a variable
Mikko Rasa [Sat, 24 Apr 2021 19:31:31 +0000 (22:31 +0300)]
Add a cached load when initializing a variable

3 years agoClear variable load cache before a loop in the SPIR-V generator
Mikko Rasa [Sat, 24 Apr 2021 18:04:10 +0000 (21:04 +0300)]
Clear variable load cache before a loop in the SPIR-V generator

Variables may get assigned in the loop and the next iteration needs to
read those values, not the cached pre-loop values.

This could be done better by only clearing loads for the variables which
are actually assigned in the loop, but I'm not sure how exactly I want
to do that.

3 years agoHandle SPIR-V arrays with specialization constant for size
Mikko Rasa [Sat, 24 Apr 2021 16:19:35 +0000 (19:19 +0300)]
Handle SPIR-V arrays with specialization constant for size

3 years agoUnify handling of constants in SpirVModule
Mikko Rasa [Sat, 24 Apr 2021 16:18:42 +0000 (19:18 +0300)]
Unify handling of constants in SpirVModule

3 years agoGive Program::Bindings a more generic name
Mikko Rasa [Sat, 24 Apr 2021 15:58:53 +0000 (18:58 +0300)]
Give Program::Bindings a more generic name

3 years agoRecord texture bindings from SPIR-V modules
Mikko Rasa [Sat, 24 Apr 2021 14:57:19 +0000 (17:57 +0300)]
Record texture bindings from SPIR-V modules

3 years agoEnable creation of SPIR-V modules from GLSL source code
Mikko Rasa [Sat, 24 Apr 2021 14:57:04 +0000 (17:57 +0300)]
Enable creation of SPIR-V modules from GLSL source code

3 years agoVisit function definitions while collection dependencies
Mikko Rasa [Sat, 24 Apr 2021 14:55:49 +0000 (17:55 +0300)]
Visit function definitions while collection dependencies

Visiting just the declaration won't do much good.

3 years agoHandle function forward declarations in the SPIR-V generator
Mikko Rasa [Sat, 24 Apr 2021 14:55:14 +0000 (17:55 +0300)]
Handle function forward declarations in the SPIR-V generator

3 years agoRemake the desertpillars demo using modern techniques
Mikko Rasa [Sat, 24 Apr 2021 13:33:52 +0000 (16:33 +0300)]
Remake the desertpillars demo using modern techniques

3 years agoExport exposure value from Blender's render settings
Mikko Rasa [Sat, 24 Apr 2021 12:44:43 +0000 (15:44 +0300)]
Export exposure value from Blender's render settings

3 years agoAdd an effect for rendering a procedurally generated sky
Mikko Rasa [Sat, 24 Apr 2021 12:30:52 +0000 (15:30 +0300)]
Add an effect for rendering a procedurally generated sky

3 years agoDon't apply shadows outside the shadowmap's range
Mikko Rasa [Sat, 24 Apr 2021 12:12:50 +0000 (15:12 +0300)]
Don't apply shadows outside the shadowmap's range

3 years agoRedesign Light to only have a single color
Mikko Rasa [Sat, 24 Apr 2021 11:59:22 +0000 (14:59 +0300)]
Redesign Light to only have a single color

It makes little sense physically to have different diffuse and specular
colors.  The light exporter for Blender was already committed with this
new parameter name.