]> git.tdb.fi Git - libs/gl.git/log
libs/gl.git
3 years agoMove all OpenGL-specific code to a separate directory
Mikko Rasa [Fri, 1 Oct 2021 16:58:11 +0000 (19:58 +0300)]
Move all OpenGL-specific code to a separate directory

3 years agoUse QueryPool in OccludedScene
Mikko Rasa [Fri, 1 Oct 2021 16:43:35 +0000 (19:43 +0300)]
Use QueryPool in OccludedScene

3 years agoRefactor VertexSetup format checking
Mikko Rasa [Fri, 1 Oct 2021 16:35:32 +0000 (19:35 +0300)]
Refactor VertexSetup format checking

3 years agoAlways require EXT_texture3D and ARB_shadow for samplers
Mikko Rasa [Fri, 1 Oct 2021 16:11:51 +0000 (19:11 +0300)]
Always require EXT_texture3D and ARB_shadow for samplers

These are fairly old extensions and can be assumed to be always
available.

3 years agoTweak handling flags in PipelineState::set_framebuffer
Mikko Rasa [Fri, 1 Oct 2021 15:26:07 +0000 (18:26 +0300)]
Tweak handling flags in PipelineState::set_framebuffer

Viewports work slightly differently on Vulkan, so set only the
framebuffer flag here and instead check both when applying the state.

3 years agoUse friend declaration to access hidden data in Batch
Mikko Rasa [Fri, 1 Oct 2021 14:00:56 +0000 (17:00 +0300)]
Use friend declaration to access hidden data in Batch

3 years agoAdd an abstraction for queries
Mikko Rasa [Fri, 1 Oct 2021 09:51:31 +0000 (12:51 +0300)]
Add an abstraction for queries

3 years agoAdd color write mask to blend state
Mikko Rasa [Fri, 1 Oct 2021 09:48:01 +0000 (12:48 +0300)]
Add color write mask to blend state

3 years agoMake backend idenfication more generic
Mikko Rasa [Thu, 30 Sep 2021 21:11:46 +0000 (00:11 +0300)]
Make backend idenfication more generic

The API and version queries are now in their own file and extension.h is
reserved for the OpenGL extension mechanism.

3 years agoStore GLSL features in DeviceInfo
Mikko Rasa [Thu, 30 Sep 2021 20:57:16 +0000 (23:57 +0300)]
Store GLSL features in DeviceInfo

This makes the GLSL compiler independent of any OpenGL-specific code.

3 years agoWrap Limits into a DeviceInfo struct
Mikko Rasa [Thu, 30 Sep 2021 18:24:32 +0000 (21:24 +0300)]
Wrap Limits into a DeviceInfo struct

This allows adding more types of information.

3 years agoAlways use instanced rendering in InstanceArray
Mikko Rasa [Thu, 30 Sep 2021 14:15:22 +0000 (17:15 +0300)]
Always use instanced rendering in InstanceArray

All the required extensions are present in OpenGL 3.3, so there's little
reason to keep the fallback code.

3 years agoClean up includes and forward declarations for the core classes
Mikko Rasa [Thu, 30 Sep 2021 13:23:43 +0000 (16:23 +0300)]
Clean up includes and forward declarations for the core classes

3 years agoCompletely hide OpenGL from the public headers
Mikko Rasa [Thu, 30 Sep 2021 13:19:48 +0000 (16:19 +0300)]
Completely hide OpenGL from the public headers

3 years agoRefactor uploading texture data from a buffer
Mikko Rasa [Thu, 30 Sep 2021 11:50:19 +0000 (14:50 +0300)]
Refactor uploading texture data from a buffer

This allows getting rid of Buffer::get_id() and using a friend
declaration instead.

3 years agoAdd an srgb flag to pixelformat_from_image
Mikko Rasa [Thu, 30 Sep 2021 11:28:14 +0000 (14:28 +0300)]
Add an srgb flag to pixelformat_from_image

This simplifies the pixel format handling in the texture classes.

3 years agoEliminate the polymorphic Uniform class hierarchy
Mikko Rasa [Tue, 28 Sep 2021 22:49:20 +0000 (01:49 +0300)]
Eliminate the polymorphic Uniform class hierarchy

Dynamically allocating a separate object for every uniform is not very
cache friendly.  ProgramData now stores uniform values in a single memory
block instead.

3 years agoAdd a TypeTraits struct to convert C++ types into DataType enum values
Mikko Rasa [Tue, 28 Sep 2021 22:42:30 +0000 (01:42 +0300)]
Add a TypeTraits struct to convert C++ types into DataType enum values

3 years agoRemove the deprecated texunit-based texture assignments from RenderPass
Mikko Rasa [Tue, 28 Sep 2021 13:47:58 +0000 (16:47 +0300)]
Remove the deprecated texunit-based texture assignments from RenderPass

3 years agoStore default-block uniform data in a memory block
Mikko Rasa [Tue, 28 Sep 2021 09:29:47 +0000 (12:29 +0300)]
Store default-block uniform data in a memory block

This is more cache-friendly than using individually allocated polymorphic
objects.  It also makes it easier to use push constants in Vulkan.

3 years agoSet array and matrix strides for default-block uniforms
Mikko Rasa [Tue, 28 Sep 2021 09:22:51 +0000 (12:22 +0300)]
Set array and matrix strides for default-block uniforms

These are based on the client memory layout required by glUniform* calls.

3 years agoRestructure Program to remove linking from the public interface
Mikko Rasa [Sun, 26 Sep 2021 13:41:03 +0000 (16:41 +0300)]
Restructure Program to remove linking from the public interface

It doesn't map to Vulkan at all.  Doing it from add_stages also
simplifies handling some temporary data.

3 years agoSplit reflection data from Program to a separate struct
Mikko Rasa [Sun, 26 Sep 2021 11:32:25 +0000 (14:32 +0300)]
Split reflection data from Program to a separate struct

This is necessary for splitting the API-specific code.

3 years agoRemove the misc.h header
Mikko Rasa [Sun, 26 Sep 2021 11:22:26 +0000 (14:22 +0300)]
Remove the misc.h header

It was mostly unused already.

3 years agoRemove the now unused BufferBits enum
Mikko Rasa [Sat, 25 Sep 2021 15:39:47 +0000 (18:39 +0300)]
Remove the now unused BufferBits enum

3 years agoAutomatically detect which multisample buffers to resolve
Mikko Rasa [Sat, 25 Sep 2021 15:37:32 +0000 (18:37 +0300)]
Automatically detect which multisample buffers to resolve

3 years agoClear the pipeline state through Commands
Mikko Rasa [Sat, 25 Sep 2021 11:34:20 +0000 (14:34 +0300)]
Clear the pipeline state through Commands

3 years agoRestore sampler refresh call
Mikko Rasa [Sat, 25 Sep 2021 11:20:54 +0000 (14:20 +0300)]
Restore sampler refresh call

This got accidentally removed in 2e09b4f.

3 years agoRe-export desertpillars data with clear values
Mikko Rasa [Sat, 25 Sep 2021 11:07:34 +0000 (14:07 +0300)]
Re-export desertpillars data with clear values

3 years agoMake it possible to specify explicit clear values
Mikko Rasa [Sat, 25 Sep 2021 11:06:53 +0000 (14:06 +0300)]
Make it possible to specify explicit clear values

3 years agoMake clearing the render target a responsibility of Sequence
Mikko Rasa [Sat, 25 Sep 2021 11:03:58 +0000 (14:03 +0300)]
Make clearing the render target a responsibility of Sequence

3 years agoAllow creating sequences without size
Mikko Rasa [Fri, 24 Sep 2021 22:38:59 +0000 (01:38 +0300)]
Allow creating sequences without size

Also require a frame format when a size is specified.  Sequences used as
content renderables of effects commonly have no postprocessors, in which
case internal render targets are not needed either and the size is not
meaningful.

3 years agoRemove the View and Framebuffer constructors from Sequence
Mikko Rasa [Fri, 24 Sep 2021 21:41:51 +0000 (00:41 +0300)]
Remove the View and Framebuffer constructors from Sequence

They had no other purpose than to take the size from the other object,
and that fits better in SequenceBuilder.

3 years agoQuery the attachments of the default framebuffer
Mikko Rasa [Sun, 19 Sep 2021 11:04:02 +0000 (14:04 +0300)]
Query the attachments of the default framebuffer

The exact pixel formats are unimportant for now and would be somewhat
convoluted to query.

3 years agoCheck supported attachment formats in Framebuffer::set_format
Mikko Rasa [Sun, 19 Sep 2021 10:37:13 +0000 (13:37 +0300)]
Check supported attachment formats in Framebuffer::set_format

3 years agoRemove the FramebufferStatus enum
Mikko Rasa [Sun, 19 Sep 2021 10:36:23 +0000 (13:36 +0300)]
Remove the FramebufferStatus enum

It's not easily supportable on Vulkan.

3 years agoInitialize Texture's format to an invalid value
Mikko Rasa [Sun, 19 Sep 2021 10:33:18 +0000 (13:33 +0300)]
Initialize Texture's format to an invalid value

This makes it possible to determine if a texture has storage defined or
not.

3 years agoUse friend declarations to access OpenGL IDs of objects
Mikko Rasa [Sat, 18 Sep 2021 12:57:24 +0000 (15:57 +0300)]
Use friend declarations to access OpenGL IDs of objects

This seems neater than exposing get_id() methods to the public.

Texture2D::AsyncLoader still uses get_id() on the PBO for now, since
it's not reasonably possible to name that class as a friend.

3 years agoAdd missing Require to Commands::resolve_multisample
Mikko Rasa [Sat, 18 Sep 2021 12:54:11 +0000 (15:54 +0300)]
Add missing Require to Commands::resolve_multisample

3 years agoMake the sampler-related enums independent of OpenGL constants
Mikko Rasa [Sat, 18 Sep 2021 12:40:30 +0000 (15:40 +0300)]
Make the sampler-related enums independent of OpenGL constants

3 years agoMake the TextureCubeFace enum independent of OpenGL constants
Mikko Rasa [Sat, 18 Sep 2021 12:21:09 +0000 (15:21 +0300)]
Make the TextureCubeFace enum independent of OpenGL constants

3 years agoMark constant data as const
Mikko Rasa [Sat, 18 Sep 2021 12:15:32 +0000 (15:15 +0300)]
Mark constant data as const

3 years agoOnly enable seamless cube map once
Mikko Rasa [Sat, 18 Sep 2021 11:54:48 +0000 (14:54 +0300)]
Only enable seamless cube map once

3 years agoRemove the separate allocation step from textures and buffers
Mikko Rasa [Sat, 18 Sep 2021 09:56:18 +0000 (12:56 +0300)]
Remove the separate allocation step from textures and buffers

It was conceived as a way to avoid unnecessary OpenGL calls if the object
is initialized by uploading full contents.  However the storage extensions
are almost universally supported now and data uploads are not something
that usually happens every frame, so this optimization is no longer
relevant.

3 years agoRemove remaining deprecated things from the core classes
Mikko Rasa [Sat, 18 Sep 2021 09:07:54 +0000 (12:07 +0300)]
Remove remaining deprecated things from the core classes

3 years agoRemove unnecessary std:: qualifiers
Mikko Rasa [Sat, 18 Sep 2021 00:30:23 +0000 (03:30 +0300)]
Remove unnecessary std:: qualifiers

3 years agoSpecify underlying type for format descriptor enums
Mikko Rasa [Fri, 17 Sep 2021 23:56:23 +0000 (02:56 +0300)]
Specify underlying type for format descriptor enums

This makes it possible to use them directory in the associated format
structs without increasing their size.

3 years agoUse standard fixed-size integer types
Mikko Rasa [Fri, 17 Sep 2021 23:31:16 +0000 (02:31 +0300)]
Use standard fixed-size integer types

3 years agoFix an apparent logic bug in ProgramData
Mikko Rasa [Fri, 17 Sep 2021 23:18:53 +0000 (02:18 +0300)]
Fix an apparent logic bug in ProgramData

Deleting the blocks but leaving the pointers seems like a recipe for
disaster.  This hails from all the way back in 5ae4b00.

3 years agoImprove exceptions in armature lookups
Mikko Rasa [Fri, 17 Sep 2021 23:12:48 +0000 (02:12 +0300)]
Improve exceptions in armature lookups

3 years agoPrefer more compact containers
Mikko Rasa [Fri, 17 Sep 2021 23:09:33 +0000 (02:09 +0300)]
Prefer more compact containers

3 years agoUse C++11 features with containers
Mikko Rasa [Fri, 17 Sep 2021 22:57:58 +0000 (01:57 +0300)]
Use C++11 features with containers

3 years agoRequire C++11 for building
Mikko Rasa [Fri, 17 Sep 2021 21:59:20 +0000 (00:59 +0300)]
Require C++11 for building

3 years agoChange ManagedResource::load_priority to int
Mikko Rasa [Fri, 17 Sep 2021 17:31:48 +0000 (20:31 +0300)]
Change ManagedResource::load_priority to int

For unknown reasons it was made bool in 574abfb even though
Resource::get_load_priority returns an int.

3 years agoRemove automatic mipmap generation from the public interface of Texture
Mikko Rasa [Thu, 16 Sep 2021 22:00:07 +0000 (01:00 +0300)]
Remove automatic mipmap generation from the public interface of Texture

The flag is now only used in conjunction of textures loaded from
datafiles.  Mipmap generation can still be manually triggered.

This causes some lossage with the allocation flags if the texture storage
extension is not supported.  I'll likely refactor the allocation system
soon.

3 years agoUse a scratch binding to modify textures and buffers
Mikko Rasa [Thu, 16 Sep 2021 18:52:22 +0000 (21:52 +0300)]
Use a scratch binding to modify textures and buffers

This simplifies the code quite a bit.  It's assumed that textures are
not modified during rendering, as that would potentially interfere with
the rendering pipeline state.

3 years agoRemove some obsolete things
Mikko Rasa [Thu, 16 Sep 2021 16:14:06 +0000 (19:14 +0300)]
Remove some obsolete things

3 years agoChange the vertex group attribute to be an integer vector
Mikko Rasa [Wed, 15 Sep 2021 18:52:13 +0000 (21:52 +0300)]
Change the vertex group attribute to be an integer vector

3 years agoAdd support for integer vertex attributes
Mikko Rasa [Wed, 15 Sep 2021 18:51:59 +0000 (21:51 +0300)]
Add support for integer vertex attributes

3 years agoNudge the FrameFormat floating-point flag one bit to the left
Mikko Rasa [Wed, 15 Sep 2021 17:17:38 +0000 (20:17 +0300)]
Nudge the FrameFormat floating-point flag one bit to the left

This puts it in the same position as the corresponding flag in
VertexAttribute.

3 years agoRe-export desert pillars data with attribute types
Mikko Rasa [Wed, 15 Sep 2021 17:16:57 +0000 (20:16 +0300)]
Re-export desert pillars data with attribute types

3 years agoUse more compact data types when exporting meshes
Mikko Rasa [Wed, 15 Sep 2021 14:58:23 +0000 (17:58 +0300)]
Use more compact data types when exporting meshes

3 years agoMake VertexFormat capable of storing type information
Mikko Rasa [Wed, 15 Sep 2021 11:11:54 +0000 (14:11 +0300)]
Make VertexFormat capable of storing type information

3 years agoRemove deprecated things related to vertex formats and arrays
Mikko Rasa [Wed, 15 Sep 2021 10:55:08 +0000 (13:55 +0300)]
Remove deprecated things related to vertex formats and arrays

3 years agoExplicitly specify the target format of Sequence
Mikko Rasa [Tue, 14 Sep 2021 22:24:36 +0000 (01:24 +0300)]
Explicitly specify the target format of Sequence

3 years agoFix a logic error in Sequence
Mikko Rasa [Tue, 14 Sep 2021 21:22:59 +0000 (00:22 +0300)]
Fix a logic error in Sequence

This condition accidentally got flipped in 3ac3a51.

3 years agoFix valgrind warnings
Mikko Rasa [Tue, 14 Sep 2021 21:14:34 +0000 (00:14 +0300)]
Fix valgrind warnings

3 years agoRemove obsolete stuff from Sequence
Mikko Rasa [Tue, 14 Sep 2021 21:00:31 +0000 (00:00 +0300)]
Remove obsolete stuff from Sequence

3 years agoSimplify pipeline state management
Mikko Rasa [Mon, 13 Sep 2021 21:17:12 +0000 (00:17 +0300)]
Simplify pipeline state management

Instead of unbinding things immediately, defer it to when the state is
cleared.  This results in less binding calls overall.  The only reason
to unbind anything is to allow those objects to be destroyed, and that
shouldn't happen in the middle of rendering anyway.

3 years agoRemove deprecated constructors from effects
Mikko Rasa [Mon, 13 Sep 2021 17:13:36 +0000 (20:13 +0300)]
Remove deprecated constructors from effects

3 years agoTweak the comma operator between VertexAttribute and unsigned
Mikko Rasa [Mon, 13 Sep 2021 17:03:12 +0000 (20:03 +0300)]
Tweak the comma operator between VertexAttribute and unsigned

It now returns VertexAttribute instead of VertexFormat, avoiding the need
to call make_indexed_attribute in some cases.

3 years agoConsider all attachments when determining Framebuffer's size
Mikko Rasa [Mon, 13 Sep 2021 17:01:53 +0000 (20:01 +0300)]
Consider all attachments when determining Framebuffer's size

3 years agoTweak some texture allocation checks
Mikko Rasa [Mon, 13 Sep 2021 16:59:07 +0000 (19:59 +0300)]
Tweak some texture allocation checks

Sub_image calls allocate_ internally, so it should avoid doing
unnecessary work.

3 years agoFix a bug in Renderer::resolve_multisample
Mikko Rasa [Mon, 13 Sep 2021 16:57:48 +0000 (19:57 +0300)]
Fix a bug in Renderer::resolve_multisample

Apply_state requires a shader program to be set, but it's not actually
needed here.

3 years agoRedesign framebuffer attachment management
Mikko Rasa [Mon, 13 Sep 2021 16:42:24 +0000 (19:42 +0300)]
Redesign framebuffer attachment management

Framebuffers now have an immutable format to which attachments must
conform.

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

3 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

3 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

3 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

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

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

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

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

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

3 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

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

3 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

3 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

3 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

3 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

3 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

3 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

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

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

3 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

3 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

3 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

3 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

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

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