]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
7 months agoWIP vulkan-resizing
Mikko Rasa [Sat, 1 Feb 2025 22:36:06 +0000 (00:36 +0200)]
WIP

7 months agoTreat an empty bounding sphere as absent for frustum culling
Mikko Rasa [Fri, 31 Jan 2025 20:49:32 +0000 (22:49 +0200)]
Treat an empty bounding sphere as absent for frustum culling

Dynamically created objects don't have their bounding sphere filled
in, so they got culled when the center of the object was outside the
frustum.

7 months agoAdd a builder for turning geometric shapes into meshes
Mikko Rasa [Sun, 26 Jan 2025 15:02:45 +0000 (17:02 +0200)]
Add a builder for turning geometric shapes into meshes

7 months agoMake sure ico sphere's subdivisions is at least 1
Mikko Rasa [Sun, 26 Jan 2025 15:02:23 +0000 (17:02 +0200)]
Make sure ico sphere's subdivisions is at least 1

8 months agoMake it possible to query API handles of textures
Mikko Rasa [Fri, 27 Dec 2024 09:38:11 +0000 (11:38 +0200)]
Make it possible to query API handles of textures

This is necessary for some integrations.

8 months agoAdd set_sampler function to Material
Mikko Rasa [Fri, 27 Dec 2024 08:30:35 +0000 (10:30 +0200)]
Add set_sampler function to Material

8 months agoAdjust behaviour of render functions in View
Mikko Rasa [Thu, 26 Dec 2024 17:18:41 +0000 (19:18 +0200)]
Adjust behaviour of render functions in View

They now call begin/end and present the rendered image regardless of
whether an internal or external renderer was used.

8 months agoCheck if Collection::open_raw succeeded
Mikko Rasa [Mon, 23 Dec 2024 15:33:51 +0000 (17:33 +0200)]
Check if Collection::open_raw succeeded

13 months agoCall Renderer::begin before acquiring an image from the swapchain
Mikko Rasa [Tue, 13 Aug 2024 12:29:55 +0000 (15:29 +0300)]
Call Renderer::begin before acquiring an image from the swapchain

This fixes a validation error about a semaphore having pending operations
when vkAcquireNextImage is called.

13 months agoAdjust the logic for discarding fraembuffer contents in Vulkan
Mikko Rasa [Tue, 13 Aug 2024 12:14:49 +0000 (15:14 +0300)]
Adjust the logic for discarding fraembuffer contents in Vulkan

It was unnecessarily transitioning from a known layout when the
framebuffer is being cleraed.  This triggered a validation error on the
first frame when rendering directly to the swapchain.

13 months agoHide Scene::named_content in a getter function
Mikko Rasa [Sat, 3 Aug 2024 11:26:42 +0000 (14:26 +0300)]
Hide Scene::named_content in a getter function

MSVC doesn't allow a thread_local variable with DLL interface

13 months agoMark storage buffers in compute shaders as outputs
Mikko Rasa [Thu, 1 Aug 2024 14:57:02 +0000 (17:57 +0300)]
Mark storage buffers in compute shaders as outputs

13 months agoAvoid a crash in DepthRangeConverter if there are no stages
Mikko Rasa [Thu, 1 Aug 2024 14:55:44 +0000 (17:55 +0300)]
Avoid a crash in DepthRangeConverter if there are no stages

13 months agoDon't allocate storage when loading metadata for a managed texture
Mikko Rasa [Thu, 1 Aug 2024 14:52:45 +0000 (17:52 +0300)]
Don't allocate storage when loading metadata for a managed texture

13 months agoDon't generate mipmaps after loading metadata for managed textures
Mikko Rasa [Thu, 1 Aug 2024 14:48:32 +0000 (17:48 +0300)]
Don't generate mipmaps after loading metadata for managed textures

It will be done when the resource manager loads the pixel data.

13 months agoFix for material export with certain unusual emission configurations
Mikko Rasa [Wed, 31 Jul 2024 21:50:02 +0000 (00:50 +0300)]
Fix for material export with certain unusual emission configurations

If the color and strength inputs are both unconnected, it's fine for them
to have arbitrary values.

13 months agoFix incorrect function call syntax in the Blender exporter
Mikko Rasa [Wed, 31 Jul 2024 21:49:18 +0000 (00:49 +0300)]
Fix incorrect function call syntax in the Blender exporter

13 months agoAlign shadow camera to shadow map texels
Mikko Rasa [Tue, 30 Jul 2024 21:36:11 +0000 (00:36 +0300)]
Align shadow camera to shadow map texels

This avoids swimming shadows when the target area moves smoothly.

13 months agoFix incorrect variable name
Mikko Rasa [Tue, 30 Jul 2024 15:32:19 +0000 (18:32 +0300)]
Fix incorrect variable name

13 months agoDeep copy vertex groups when copying vertices in the exporter
Mikko Rasa [Tue, 30 Jul 2024 15:30:19 +0000 (18:30 +0300)]
Deep copy vertex groups when copying vertices in the exporter

If multiple vertices reference the same group data after splitting
by normals, group mapping gets applied multiple times, resulting in
incorrect group indices.

13 months agoExport all cameras for scenes
Mikko Rasa [Tue, 30 Jul 2024 15:27:12 +0000 (18:27 +0300)]
Export all cameras for scenes

13 months agoSwitch to the scene an object is on when exporting it
Mikko Rasa [Tue, 30 Jul 2024 15:25:02 +0000 (18:25 +0300)]
Switch to the scene an object is on when exporting it

I couldn't find any other way to get a suitable depsgraph for evaluating
the object for mesh export.

13 months agoSkip empty material slots on a Mesh
Mikko Rasa [Sat, 27 Jul 2024 13:18:15 +0000 (16:18 +0300)]
Skip empty material slots on a Mesh

They may occur if materials are intended to be supplied by the object
instead of the mesh.

13 months agoFix an incorrect variable name
Mikko Rasa [Sat, 27 Jul 2024 13:16:48 +0000 (16:16 +0300)]
Fix an incorrect variable name

14 months agoMake scene contents retrievable when loaded with GenericLoader
Mikko Rasa [Tue, 9 Jul 2024 13:32:48 +0000 (16:32 +0300)]
Make scene contents retrievable when loaded with GenericLoader

Content from inline sub-scenes will also be added.

14 months agoFix a typo in the Blender exporter
Mikko Rasa [Sun, 7 Jul 2024 20:47:47 +0000 (23:47 +0300)]
Fix a typo in the Blender exporter

14 months agoAdd capability to export submeshes for different materials
Mikko Rasa [Sun, 7 Jul 2024 20:47:21 +0000 (23:47 +0300)]
Add capability to export submeshes for different materials

14 months agoRedesign Object to support submeshes
Mikko Rasa [Sun, 7 Jul 2024 15:01:30 +0000 (18:01 +0300)]
Redesign Object to support submeshes

This allows objects with multiple materials to be exported easily.  Some
functions were removed without leaving compatibility wrappers because
they would have been too cumbersome to implement.

14 months agoRefactor Object::render to have less duplication
Mikko Rasa [Sun, 7 Jul 2024 14:44:12 +0000 (17:44 +0300)]
Refactor Object::render to have less duplication

14 months agoUpdate Blender exporter for changes in Blender 4.0
Mikko Rasa [Sun, 7 Jul 2024 14:20:01 +0000 (17:20 +0300)]
Update Blender exporter for changes in Blender 4.0

The default values of principled BSDF have changed so that emission
color defaults to white but strength defaults to zero.  We must account
for the strength or materials end up having very strong emission.

16 months agoAccess VulkanContext's private members through VulkanDevice
Mikko Rasa [Sat, 4 May 2024 16:52:21 +0000 (19:52 +0300)]
Access VulkanContext's private members through VulkanDevice

Windows.h has some #defines which conflict with datatype.h here, so I
need to limit the exposure.

16 months agoFix class/struct declaration mismatch
Mikko Rasa [Sat, 4 May 2024 16:51:59 +0000 (19:51 +0300)]
Fix class/struct declaration mismatch

16 months agoSilence MSVC warning about bool used in a bitwise operator
Mikko Rasa [Sat, 4 May 2024 16:51:22 +0000 (19:51 +0300)]
Silence MSVC warning about bool used in a bitwise operator

16 months agoAdd an explicitly defaulted move constructor to VulkanCommands
Mikko Rasa [Sat, 4 May 2024 16:50:50 +0000 (19:50 +0300)]
Add an explicitly defaulted move constructor to VulkanCommands

16 months agoUse alternatives for some functions MSVC doesn't like
Mikko Rasa [Sat, 4 May 2024 16:30:30 +0000 (19:30 +0300)]
Use alternatives for some functions MSVC doesn't like

16 months agoUpdate Vulkan context includes
Mikko Rasa [Sat, 4 May 2024 13:15:17 +0000 (16:15 +0300)]
Update Vulkan context includes

16 months agoAdd version checks for a few GLSL functions
Mikko Rasa [Sat, 4 May 2024 12:31:30 +0000 (15:31 +0300)]
Add version checks for a few GLSL functions

16 months agoFix out-of-bounds accesses of vectors
Mikko Rasa [Sat, 4 May 2024 12:30:33 +0000 (15:30 +0300)]
Fix out-of-bounds accesses of vectors

18 months agoFix creation of animation curves
Mikko Rasa [Tue, 27 Feb 2024 18:53:56 +0000 (20:53 +0200)]
Fix creation of animation curves

18 months agoFix reloading meshes with ResourceManager
Mikko Rasa [Fri, 16 Feb 2024 21:16:15 +0000 (23:16 +0200)]
Fix reloading meshes with ResourceManager

Unloading was clearing the format of VertexSetup and it wouldn't accept
the vertex array.  Setting storage format should also be skipped while
loading from a file if the same format was set previously.

19 months agoAdd a getter for the texture tag of Text
Mikko Rasa [Wed, 17 Jan 2024 20:47:00 +0000 (22:47 +0200)]
Add a getter for the texture tag of Text

19 months agoFix a bug with exporting vertex groups
Mikko Rasa [Wed, 17 Jan 2024 20:46:35 +0000 (22:46 +0200)]
Fix a bug with exporting vertex groups

20 months agoRequire interpolation and sampling qualifiers to match
Mikko Rasa [Thu, 4 Jan 2024 18:01:30 +0000 (20:01 +0200)]
Require interpolation and sampling qualifiers to match

20 months agoUse the flat qualifier on both sides of a geneated interface
Mikko Rasa [Thu, 4 Jan 2024 18:00:55 +0000 (20:00 +0200)]
Use the flat qualifier on both sides of a geneated interface

20 months agoGenerate storage offsets for default block uniforms internally
Mikko Rasa [Fri, 29 Dec 2023 08:21:21 +0000 (10:21 +0200)]
Generate storage offsets for default block uniforms internally

Intel drivers treat locations as abstract identifiers, so a 4×4 matrix
only consumes a single location.

20 months agoAdd default packing qualifiers to uniform and buffer blocks
Mikko Rasa [Fri, 29 Dec 2023 07:55:18 +0000 (09:55 +0200)]
Add default packing qualifiers to uniform and buffer blocks

The GLSL spec says they use shared packing by default, and it turns out
that on AMD graphics processors this results in large alignment event
for primitive types.  This threw off applications using storage buffers
since their contents are not reflected.

20 months agoRemove outdated tweaks for AMD graphics processors
Mikko Rasa [Fri, 29 Dec 2023 07:47:02 +0000 (09:47 +0200)]
Remove outdated tweaks for AMD graphics processors

Legacy versions of OpenGL are no longer supported so it's not necessary
to avoid these features anymore.

20 months agoFix a test case due to earlier changes
Mikko Rasa [Fri, 29 Dec 2023 07:31:30 +0000 (09:31 +0200)]
Fix a test case due to earlier changes

Commit 9f53f66 altered the order of generated declarations

20 months agoFix validation of std140 and std430 layout qualifiers
Mikko Rasa [Thu, 28 Dec 2023 21:12:22 +0000 (23:12 +0200)]
Fix validation of std140 and std430 layout qualifiers

They're allowed on buffer blocks as well, and std430 isn't allowed on
uniform blocks.  Also recognize the packed qualifier.

20 months agoDon't add both location and binding to the same uniform
Mikko Rasa [Thu, 28 Dec 2023 19:08:39 +0000 (21:08 +0200)]
Don't add both location and binding to the same uniform

It's unclear from the GLSL spec if this is allowed or not, but Intel
driver refuses to compile such shaders and it causes weird behaviour
on AMD too.

20 months agoMake MSVC happy by explicitly declaring move constructors
Mikko Rasa [Wed, 27 Dec 2023 23:19:02 +0000 (01:19 +0200)]
Make MSVC happy by explicitly declaring move constructors

20 months agoDon't make the result variable of an inlined builtin function a builtin
Mikko Rasa [Sat, 23 Dec 2023 16:16:25 +0000 (18:16 +0200)]
Don't make the result variable of an inlined builtin function a builtin

A few builtin function overloads are actually defined in the builtins
module and can be inlined.  However the GLSL formatter skips any builtin
statements, which caused the variable to go missing.

20 months agoFix move semantics of OpenGLTexture2D::AsyncTransfer
Mikko Rasa [Sat, 23 Dec 2023 12:54:34 +0000 (14:54 +0200)]
Fix move semantics of OpenGLTexture2D::AsyncTransfer

I may eventually get rid of NonCopyable, but for now let's keep things
consistent.

20 months agoRefactor interface generation to carry more explicit information
Mikko Rasa [Thu, 21 Dec 2023 21:51:37 +0000 (23:51 +0200)]
Refactor interface generation to carry more explicit information

20 months agoRename a few things for better clarity
Mikko Rasa [Thu, 21 Dec 2023 19:06:42 +0000 (21:06 +0200)]
Rename a few things for better clarity

InterfaceGenerator::generate_interface in particular was using the word
"iface" way too much.

20 months agoRemove incorrect definition of mix(float, float, float) from builtins
Mikko Rasa [Sun, 17 Dec 2023 12:29:49 +0000 (14:29 +0200)]
Remove incorrect definition of mix(float, float, float) from builtins

20 months agoRearrange invocation of passes the GLSL compiler frontend
Mikko Rasa [Sun, 17 Dec 2023 12:16:14 +0000 (14:16 +0200)]
Rearrange invocation of passes the GLSL compiler frontend

It's getting hard to divide the operations into sensibly named groups
which can be called one after another, because some of them need to be
run on the entire module and in specific order with per-stage ops.

20 months agoFix some issues with inlining variables in GLSL
Mikko Rasa [Sun, 17 Dec 2023 10:44:51 +0000 (12:44 +0200)]
Fix some issues with inlining variables in GLSL

20 months agoMostly cosmetic tweaks
Mikko Rasa [Sun, 17 Dec 2023 09:27:46 +0000 (11:27 +0200)]
Mostly cosmetic tweaks

20 months agoFix a use-after-move issue from earlier refactoring
Mikko Rasa [Sun, 17 Dec 2023 09:12:50 +0000 (11:12 +0200)]
Fix a use-after-move issue from earlier refactoring

It was causing SplatMaterial to not create its texture arrays, because
the submaterial source filenames were empty after being moved from.

20 months agoRefactor the GLSL compiler to use unique pointers
Mikko Rasa [Sun, 17 Dec 2023 08:43:03 +0000 (10:43 +0200)]
Refactor the GLSL compiler to use unique pointers

Both clone and move assignments are now explicit, although NodePtr still
has an implicitly cloning copy constructor to facilitate automatically
generated copy constructors in the node classes.  Node containers wrap
the std container instead of inheriting and only allow adding elements
by move.

20 months agoMore emplace_back streamlining
Mikko Rasa [Sun, 17 Dec 2023 08:33:52 +0000 (10:33 +0200)]
More emplace_back streamlining

20 months agoDon't unresolve function declarations which were resolved previously
Mikko Rasa [Sun, 17 Dec 2023 08:31:14 +0000 (10:31 +0200)]
Don't unresolve function declarations which were resolved previously

Even if they get resolved again to the same definition, it causes the
any_resolved flag to be set, triggering superfluous additional resolve
passes.

21 months agoConvert matrix columns to the appropriate element type
Mikko Rasa [Sat, 16 Dec 2023 22:33:39 +0000 (00:33 +0200)]
Convert matrix columns to the appropriate element type

21 months agoFix an incorrect GLSL compiler test case
Mikko Rasa [Sat, 16 Dec 2023 21:24:12 +0000 (23:24 +0200)]
Fix an incorrect GLSL compiler test case

21 months agoPrevent inlining of an expression that got something inlined into it
Mikko Rasa [Sat, 16 Dec 2023 20:55:47 +0000 (22:55 +0200)]
Prevent inlining of an expression that got something inlined into it

It's causing some issues with converting the compiler to use unique_ptr.
This way variable names make more sense in some situations as well.

21 months agoRefactor matrix constructor resolving with some early checks
Mikko Rasa [Sat, 16 Dec 2023 08:29:16 +0000 (10:29 +0200)]
Refactor matrix constructor resolving with some early checks

21 months agoUse emplace_back return value from C++17 for shorter code
Mikko Rasa [Tue, 12 Dec 2023 22:37:43 +0000 (00:37 +0200)]
Use emplace_back return value from C++17 for shorter code

21 months agoUse emplace_back and move semantics where applicable
Mikko Rasa [Tue, 12 Dec 2023 22:22:18 +0000 (00:22 +0200)]
Use emplace_back and move semantics where applicable

21 months agoConvert sub-object loading to use the new API in mspdatafile
Mikko Rasa [Tue, 12 Dec 2023 11:15:58 +0000 (13:15 +0200)]
Convert sub-object loading to use the new API in mspdatafile

21 months agoUse unique_ptr to manage memory outside the shader compiler
Mikko Rasa [Mon, 11 Dec 2023 18:56:11 +0000 (20:56 +0200)]
Use unique_ptr to manage memory outside the shader compiler

The compiler has its own complexities and will be converted in a later
commit.

21 months agoUpgrade C++ standard version to C++14
Mikko Rasa [Sun, 10 Dec 2023 14:07:14 +0000 (16:07 +0200)]
Upgrade C++ standard version to C++14

21 months agoMake boolean conversion operators explicit
Mikko Rasa [Sun, 10 Dec 2023 13:29:32 +0000 (15:29 +0200)]
Make boolean conversion operators explicit

21 months agoReplace a volatile variable with an atomic
Mikko Rasa [Sun, 10 Dec 2023 13:21:28 +0000 (15:21 +0200)]
Replace a volatile variable with an atomic

21 months agoAdd more default member initializers
Mikko Rasa [Sun, 10 Dec 2023 13:18:19 +0000 (15:18 +0200)]
Add more default member initializers

Some inner classes in particular were missed in the earlier pass.

21 months agoFix a local variable which was supposed to be static
Mikko Rasa [Sun, 10 Dec 2023 11:45:02 +0000 (13:45 +0200)]
Fix a local variable which was supposed to be static

21 months agoUse the override specifier on overridden virtual functions
Mikko Rasa [Sun, 10 Dec 2023 10:53:21 +0000 (12:53 +0200)]
Use the override specifier on overridden virtual functions

21 months agoRemove an unnecessary move
Mikko Rasa [Sun, 10 Dec 2023 10:06:31 +0000 (12:06 +0200)]
Remove an unnecessary move

Temporaries will be moved automatically

21 months agoAdd missing includes and forward declarations
Mikko Rasa [Sun, 10 Dec 2023 10:06:05 +0000 (12:06 +0200)]
Add missing includes and forward declarations

21 months agoUse nullptr instead of 0
Mikko Rasa [Sun, 10 Dec 2023 09:05:34 +0000 (11:05 +0200)]
Use nullptr instead of 0

2 years agoRemove unnecessary scoping
Mikko Rasa [Sat, 16 Sep 2023 11:32:38 +0000 (14:32 +0300)]
Remove unnecessary scoping

This was confusing MSVC in a release build and it's not needed anyway.

2 years agoAdd some missing API exports
Mikko Rasa [Sat, 16 Sep 2023 11:31:04 +0000 (14:31 +0300)]
Add some missing API exports

2 years agoEnable vsync in the OpenGL backend
Mikko Rasa [Sat, 9 Sep 2023 14:12:34 +0000 (17:12 +0300)]
Enable vsync in the OpenGL backend

Since there's multiple backends now, applications should not touch the
context directly.  The Vulkan backend already uses vsync.  I may make it
an option on the Device in the future.

2 years agoAdd some missing includes
Mikko Rasa [Tue, 5 Sep 2023 11:16:43 +0000 (14:16 +0300)]
Add some missing includes

2 years agoAdd Windows build products to .gitignore
Mikko Rasa [Tue, 5 Sep 2023 10:37:42 +0000 (13:37 +0300)]
Add Windows build products to .gitignore

2 years agoFix other warnings from MSVC
Mikko Rasa [Tue, 5 Sep 2023 10:33:27 +0000 (13:33 +0300)]
Fix other warnings from MSVC

2 years agoMove a few things to .cpp files
Mikko Rasa [Tue, 5 Sep 2023 10:28:01 +0000 (13:28 +0300)]
Move a few things to .cpp files

Otherwise they generate undefined references on MSVC.

2 years agoRefactor viewer to use Geometry::Angle
Mikko Rasa [Tue, 5 Sep 2023 10:26:31 +0000 (13:26 +0300)]
Refactor viewer to use Geometry::Angle

2 years agoPull in various constants and functions through extensions
Mikko Rasa [Tue, 5 Sep 2023 09:58:20 +0000 (12:58 +0300)]
Pull in various constants and functions through extensions

Windows SDK does not have glext.h and the base gl.h only has definitions
for OpenGL 1.1.

2 years agoReformat gl.h to make it easier to read
Mikko Rasa [Tue, 5 Sep 2023 09:56:04 +0000 (12:56 +0300)]
Reformat gl.h to make it easier to read

2 years agoUse the mspcore version of getenv
Mikko Rasa [Tue, 5 Sep 2023 09:50:03 +0000 (12:50 +0300)]
Use the mspcore version of getenv

2 years agoAdd some files to the source tarball
Mikko Rasa [Tue, 5 Sep 2023 09:49:09 +0000 (12:49 +0300)]
Add some files to the source tarball

This also includes them in the Visual Studio project, which is useful
for development.

2 years agoInvoke the extension generator through the python3 binary
Mikko Rasa [Tue, 5 Sep 2023 09:48:11 +0000 (12:48 +0300)]
Invoke the extension generator through the python3 binary

On Windows it's not executable directly.

2 years agoExport get_backend_api from the library
Mikko Rasa [Tue, 5 Sep 2023 08:50:32 +0000 (11:50 +0300)]
Export get_backend_api from the library

2 years agoDefer retrieval of default resources in Renderer until needed
Mikko Rasa [Thu, 17 Aug 2023 11:53:22 +0000 (14:53 +0300)]
Defer retrieval of default resources in Renderer until needed

This allows the Renderer to work when no resources are present. provided
that all resources are explicitly supplied.

2 years agoRedesign OffscreenView to own the render target
Mikko Rasa [Wed, 2 Aug 2023 20:33:30 +0000 (23:33 +0300)]
Redesign OffscreenView to own the render target

Change RenderTarget::get_framebuffer to const to accommodate this;
outsiders should not modify the framebuffer's structure anyway.

2 years agoFix compiler warnings introduced by gcc 13
Mikko Rasa [Wed, 2 Aug 2023 20:32:40 +0000 (23:32 +0300)]
Fix compiler warnings introduced by gcc 13

2 years agoRequire GLSL 1.40 for layout qualifiers
Mikko Rasa [Tue, 18 Jul 2023 09:28:57 +0000 (12:28 +0300)]
Require GLSL 1.40 for layout qualifiers

2 years agoDon't run conversion passes when compiling a GLSL module
Mikko Rasa [Tue, 18 Jul 2023 09:25:34 +0000 (12:25 +0300)]
Don't run conversion passes when compiling a GLSL module

Such modules are intended to be later consumed by the same compiler, so
there's no need to convert them to a lower version.

2 years agoAdd a function in Renderer to upload data to a buffer
Mikko Rasa [Tue, 18 Jul 2023 08:29:55 +0000 (11:29 +0300)]
Add a function in Renderer to upload data to a buffer

This accounts for the current frame in flight if necessary.