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

7 years agoRemove the Renderer-less overload of Renderable::render
Mikko Rasa [Mon, 5 Dec 2016 16:10:52 +0000 (18:10 +0200)]
Remove the Renderer-less overload of Renderable::render

It's been sort-of deprecated for a long time even though it wasn't marked
as such.  None of my code code uses it with anything else than Pipeline
(and that code path is being replaced with View).

7 years agoAssociate camera and setup/finish_frame calls with View
Mikko Rasa [Mon, 5 Dec 2016 14:15:27 +0000 (16:15 +0200)]
Associate camera and setup/finish_frame calls with View

... instead of Pipeline.  Having a Camera in the Pipeline but using the
Renderer's camera to override it for some things feels like a hack.

Pipeline gets to keep it's top-level render function for now.

7 years agoRefactor postprocessor uniform usage
Mikko Rasa [Sat, 3 Dec 2016 16:37:53 +0000 (18:37 +0200)]
Refactor postprocessor uniform usage

A lot of the values are shared between processing passes, so it doesn't
make sense to keep multiple copies.  ProgramData will take care of only
setting the required uniforms.

7 years agoUse RenderTarget objects to manage FBOs in postprocessors
Mikko Rasa [Sat, 3 Dec 2016 16:31:48 +0000 (18:31 +0200)]
Use RenderTarget objects to manage FBOs in postprocessors

7 years agoAdd a RenderTarget class to manage and annotate FBOs
Mikko Rasa [Sat, 3 Dec 2016 16:03:12 +0000 (18:03 +0200)]
Add a RenderTarget class to manage and annotate FBOs

I want to have deferred lighting support at some point, and it requires
multiple outputs from the geometry rasterization stage.  There needs to
be some way to annotate which buffer holds which information.

7 years agoDon't bother with RAII here
Mikko Rasa [Sat, 3 Dec 2016 15:56:50 +0000 (17:56 +0200)]
Don't bother with RAII here

There are already RAII objects in the outer scope.

7 years agoRemove dynamic allocation from VertexFormat
Mikko Rasa [Sat, 3 Dec 2016 15:53:19 +0000 (17:53 +0200)]
Remove dynamic allocation from VertexFormat

On 64-bit systems the pointer takes eight bytes, and a typical malloc
implementation will have two pointers worth of overhead.  Vertex formats
hardly ever reach even eight components, so it's cheaper to just store
a fixed-size array in the class itself.

7 years agoEnsure that program syntax nodes get deep-copied properly
Mikko Rasa [Fri, 2 Dec 2016 20:17:50 +0000 (22:17 +0200)]
Ensure that program syntax nodes get deep-copied properly

The changes in 57c1139 prevented copies happening even when they should,
so the shared section got inserted into shader stages by reference.  This
caused some funny business with the variable resolver and unused variable
locator.

Containers of nodes must have RefPtrs inside them, since insertions will
create some temporary copies of the element and with NodePtr that would
trigger copying the node as well.  So the cloning of nodes is performed
when the container itself is copied.

7 years agoInline trivial shader functions that are only called once
Mikko Rasa [Fri, 2 Dec 2016 10:32:23 +0000 (12:32 +0200)]
Inline trivial shader functions that are only called once

I.e. functions that consist of a single return statement.

7 years agoReorder declarations in shaders
Mikko Rasa [Fri, 2 Dec 2016 10:26:12 +0000 (12:26 +0200)]
Reorder declarations in shaders

So that structs appear before variables and variables appear before
functions.  This ensures that the declarations stay visible if an
expression is moved to an earlier point while inlining functions.

7 years agoRemove some VariableResolver calls that are no longer needed
Mikko Rasa [Fri, 2 Dec 2016 10:24:14 +0000 (12:24 +0200)]
Remove some VariableResolver calls that are no longer needed

Now that nodes don't get copied when moving around the previously
resolved declaration pointers will stay valid.

7 years agoUpgrade NodePtr to RefPtr
Mikko Rasa [Thu, 1 Dec 2016 11:29:29 +0000 (13:29 +0200)]
Upgrade NodePtr to RefPtr

Allows Nodes to be moved from one Block to another without copying them.
When targeting GLSL 1.30 LegacyConverter has a sequence where it flattens
an interface block and later checks the type of those variables through
their declaration pointer.  This caused memory errors because the
original nodes were destroyed in the flatten operation.

7 years agoSome fixes for the scene exporter
Mikko Rasa [Wed, 30 Nov 2016 22:39:34 +0000 (00:39 +0200)]
Some fixes for the scene exporter

7 years agoImprove the color curve postprocessor
Mikko Rasa [Mon, 28 Nov 2016 21:31:19 +0000 (23:31 +0200)]
Improve the color curve postprocessor

7 years agoProperly scale the the bounding sphere for frustum culling
Mikko Rasa [Mon, 28 Nov 2016 00:20:20 +0000 (02:20 +0200)]
Properly scale the the bounding sphere for frustum culling

The original radius must be squared too.  Also, negative distances mean
the sphere is inside the frustum and should not be culled.

7 years agoUse Renderer for rendering PostProcessors
Mikko Rasa [Sat, 26 Nov 2016 11:09:00 +0000 (13:09 +0200)]
Use Renderer for rendering PostProcessors

7 years agoEnsure that DepthTest and Blend get unbound for PostProcessors
Mikko Rasa [Sat, 26 Nov 2016 05:29:20 +0000 (07:29 +0200)]
Ensure that DepthTest and Blend get unbound for PostProcessors

7 years agoDeprecate Renderer::begin() and remove the already deprecated escape()
Mikko Rasa [Sat, 26 Nov 2016 05:01:36 +0000 (07:01 +0200)]
Deprecate Renderer::begin() and remove the already deprecated escape()

7 years agoMake the camera part of changeable Renderer state
Mikko Rasa [Sat, 26 Nov 2016 04:56:54 +0000 (06:56 +0200)]
Make the camera part of changeable Renderer state

I'd like to move to a single, persistent renderer at some point and this
is a necessary step towards that.  Some effects want to use their own
camera to render into an FBO.

7 years agoSet the appropriate flags on Renderer state changes
Mikko Rasa [Sat, 26 Nov 2016 04:52:39 +0000 (06:52 +0200)]
Set the appropriate flags on Renderer state changes

7 years agoAccount for scale when performing frustum culling
Mikko Rasa [Fri, 25 Nov 2016 21:19:08 +0000 (23:19 +0200)]
Account for scale when performing frustum culling

It will still break with non-uniform scaling.

7 years agoEvaluate parenthesized expression as the contained expression's value
Mikko Rasa [Fri, 25 Nov 2016 12:22:38 +0000 (14:22 +0200)]
Evaluate parenthesized expression as the contained expression's value

7 years agoUse layout declarations to set attribute and fragment data locations
Mikko Rasa [Sat, 19 Nov 2016 16:24:18 +0000 (18:24 +0200)]
Use layout declarations to set attribute and fragment data locations

A fallback to glBind*Location functions is provided in case the
implementation does not support GLSL 3.30.

7 years agoSupport layout declarations on variables
Mikko Rasa [Sat, 19 Nov 2016 16:23:58 +0000 (18:23 +0200)]
Support layout declarations on variables

7 years agoEliminate the separate matrix stack in Renderer
Mikko Rasa [Sat, 19 Nov 2016 14:20:06 +0000 (16:20 +0200)]
Eliminate the separate matrix stack in Renderer

Instead incorporate the modelview matrix into the main render state.

7 years agoAllow redeclarations to override the type of a variable
Mikko Rasa [Fri, 18 Nov 2016 22:01:40 +0000 (00:01 +0200)]
Allow redeclarations to override the type of a variable

This can be used to e.g. change the sampler type of the diffuse map.  At
the moment the appropriate sampling function also needs to be overridden
since texcoord dimensions are not handled automatically.

7 years agoMove postprocessor shaders to the builtin shaderlib
Mikko Rasa [Fri, 18 Nov 2016 21:45:00 +0000 (23:45 +0200)]
Move postprocessor shaders to the builtin shaderlib

7 years agoGenerate the entire shaderlib into a single file
Mikko Rasa [Fri, 18 Nov 2016 21:16:54 +0000 (23:16 +0200)]
Generate the entire shaderlib into a single file

Generating lots of small files seemed rather silly, and I found no good
way to automatically generate the builtin init code.

7 years agoAutomatically backport shaders to earlier GLSL versions if necessary
Mikko Rasa [Fri, 18 Nov 2016 17:40:16 +0000 (19:40 +0200)]
Automatically backport shaders to earlier GLSL versions if necessary

Fragment shader output replacement is a bit crude and will just replace
any output with gl_FragColor.  It will be made better later.

7 years agoRefactor block modification operations into an intermediate base class
Mikko Rasa [Fri, 18 Nov 2016 17:38:10 +0000 (19:38 +0200)]
Refactor block modification operations into an intermediate base class

7 years agoAdd a builtin module for standard shaders
Mikko Rasa [Tue, 15 Nov 2016 17:09:50 +0000 (19:09 +0200)]
Add a builtin module for standard shaders

It doesn't support multiple lights as generating the necessary array
interfaces through a geometry shader turned out to be rather non-trivial.
I plan to add deferred rendering modules with multi-light support later.

7 years agoRemove unused functions from the shader source
Mikko Rasa [Mon, 14 Nov 2016 15:46:35 +0000 (17:46 +0200)]
Remove unused functions from the shader source

7 years agoRemove conditionals and loops that can be determined to never run
Mikko Rasa [Mon, 14 Nov 2016 13:33:45 +0000 (15:33 +0200)]
Remove conditionals and loops that can be determined to never run

This is the other major step required for standard shader generation.
Currently the constant condition eliminator is pretty conservative and
will only consider the initialization values of variables.  Globals are
only considered if they are declared const.

7 years agoImplement an import system
Mikko Rasa [Mon, 14 Nov 2016 12:22:02 +0000 (14:22 +0200)]
Implement an import system

This is the first of two major steps required to replicate the core
functionality of the old ProgramBuilder system, namely generating
standard shaders.  The other is conditionally including pieces of code,
which will be added soon.

7 years agoFurther reduce overhead of applying ProgramCompiler visitors
Mikko Rasa [Mon, 14 Nov 2016 11:41:46 +0000 (13:41 +0200)]
Further reduce overhead of applying ProgramCompiler visitors

7 years agoCheck if blocks need braces at formatting time
Mikko Rasa [Mon, 14 Nov 2016 11:39:50 +0000 (13:39 +0200)]
Check if blocks need braces at formatting time

7 years agoParse true and false as literals rather than identifiers
Mikko Rasa [Mon, 14 Nov 2016 09:52:14 +0000 (11:52 +0200)]
Parse true and false as literals rather than identifiers

7 years agoFix formatting issues with else ifs
Mikko Rasa [Sun, 13 Nov 2016 22:35:55 +0000 (00:35 +0200)]
Fix formatting issues with else ifs

7 years agoOverhaul assignment tracking to work properly with conditionals
Mikko Rasa [Sun, 13 Nov 2016 21:39:45 +0000 (23:39 +0200)]
Overhaul assignment tracking to work properly with conditionals

7 years agoGenerate a passthrough for gl_Position in geometry shader
Mikko Rasa [Sat, 12 Nov 2016 18:09:16 +0000 (20:09 +0200)]
Generate a passthrough for gl_Position in geometry shader

7 years agoAdd a module for builtin interface variables
Mikko Rasa [Sat, 12 Nov 2016 18:08:24 +0000 (20:08 +0200)]
Add a module for builtin interface variables

Required to make unused assignment removal work for gl_Position.

7 years agoBetter handling of array flag for generated interfaces
Mikko Rasa [Sat, 12 Nov 2016 16:41:32 +0000 (18:41 +0200)]
Better handling of array flag for generated interfaces

7 years agoMove unused aggregate detection to UnusedVariableDetector
Mikko Rasa [Sat, 12 Nov 2016 16:40:29 +0000 (18:40 +0200)]
Move unused aggregate detection to UnusedVariableDetector

It isn't really NodeRemover's job.

7 years agoFix unused variable decetion for self-referenging assignments
Mikko Rasa [Sat, 12 Nov 2016 16:09:32 +0000 (18:09 +0200)]
Fix unused variable decetion for self-referenging assignments

Extend it to initialization expressions as well.

7 years agoIntegrate ProgramCompiler with Program and Resources
Mikko Rasa [Sat, 12 Nov 2016 00:25:49 +0000 (02:25 +0200)]
Integrate ProgramCompiler with Program and Resources

7 years agoReturn back to first stage after some optimization happens
Mikko Rasa [Sat, 12 Nov 2016 00:04:14 +0000 (02:04 +0200)]
Return back to first stage after some optimization happens

Unused variable removal can propagate towards earlier stages so those
have to be checked again.

7 years agoProcess existing inputs in passthrough
Mikko Rasa [Sat, 12 Nov 2016 00:00:09 +0000 (02:00 +0200)]
Process existing inputs in passthrough

Vertex shader inputs are not linked to any outputs so they weren't being
recognized for passthrough.  Also, some inputs might have already been
declared either explicitly or implicitly so those declarations should be
preferred over creating new ones.

7 years agoRecognize superceded assignments even for out variables
Mikko Rasa [Fri, 11 Nov 2016 23:19:00 +0000 (01:19 +0200)]
Recognize superceded assignments even for out variables

7 years agoAssorted refactoring and fixes
Mikko Rasa [Fri, 11 Nov 2016 17:02:06 +0000 (19:02 +0200)]
Assorted refactoring and fixes

7 years agoRefactor module and stage management
Mikko Rasa [Fri, 11 Nov 2016 16:39:57 +0000 (18:39 +0200)]
Refactor module and stage management

Originally I envisioned that ProgramParser would handle imports, but it's
non-trivial to make re-entrant.  The parser will now only hold one module
at a time and ProgramCompiler will handle combining them.

7 years agoRename ProgramSyntax::Context to Stage
Mikko Rasa [Fri, 11 Nov 2016 13:59:38 +0000 (15:59 +0200)]
Rename ProgramSyntax::Context to Stage

7 years agoExtend unused variable analysis to assignments and across interfaces
Mikko Rasa [Fri, 11 Nov 2016 11:37:18 +0000 (13:37 +0200)]
Extend unused variable analysis to assignments and across interfaces

Assignments are removed if there are no further references to the
assigned variable, except if it's a linked out variable.

7 years agoStreamline interface declarations
Mikko Rasa [Fri, 11 Nov 2016 09:05:15 +0000 (11:05 +0200)]
Streamline interface declarations

Out variables can now be declared inside functions and will be exported
to global scope.  In variables don't need to be declared at all; they are
pulled in from the previous stage.  There's a new passthrough statement
to copy all inputs to outputs.

7 years agoRemove unused variable and struct declarations from the syntax tree
Mikko Rasa [Wed, 9 Nov 2016 13:59:17 +0000 (15:59 +0200)]
Remove unused variable and struct declarations from the syntax tree

7 years agoInject the global context to the syntax tree
Mikko Rasa [Wed, 9 Nov 2016 13:35:25 +0000 (15:35 +0200)]
Inject the global context to the syntax tree

... rather than concatenating its text with the other contexts.

7 years agoImplement an actual expression parser
Mikko Rasa [Tue, 8 Nov 2016 20:36:07 +0000 (22:36 +0200)]
Implement an actual expression parser

Doing pretty much anything interesting with the syntax tree requires
having access to expressions.

7 years agoBegin implementing a new shader program generator system
Mikko Rasa [Mon, 7 Nov 2016 21:10:51 +0000 (23:10 +0200)]
Begin implementing a new shader program generator system

ProgramBuilder is good enough when working within its standard features,
but it's difficult to expand.  Custom variables are overly sensitive to
declration order.  Adding loops or conditionals (other than the operator
flavor) requires using an additional shader.  It's not possible to modify
a variable's expression without replicating it in its entirety.

All of the internal processing with coordinate spaces, interfaces and
indices can also be difficult to understand.  Not to mention the reverse
processing order which starts from the goal variables and works backwards
to figure out how they can be computed.

The new ProgramCompiler system, as its name implies, works more like a
compiler.  It's designed to take GLSL as input, apply transformations to
it and produce different GLSL as output.  Storing the progrem as an
abstract syntax tree allows much more comprehensive processing than the
old system which barely understood what an identifier is.

At the moment it doesn't do much yet.  The only transformation is to
split a single source file into vertex, geometry and fragment parts and
add a common section at the beginning of each of them.  More will be
added soon.

7 years agoRestructure the extension detection code
Mikko Rasa [Sun, 6 Nov 2016 10:46:44 +0000 (12:46 +0200)]
Restructure the extension detection code

Extension disabling is now more forceful and will prevent the use of the
relevant functionality even if it was promoted to core.

7 years agoAdd a less-than operator to Version
Mikko Rasa [Sun, 6 Nov 2016 09:34:00 +0000 (11:34 +0200)]
Add a less-than operator to Version

7 years agoDetect deprecation versions for extensions
Mikko Rasa [Sat, 5 Nov 2016 23:37:55 +0000 (01:37 +0200)]
Detect deprecation versions for extensions

If the core profile is in use, deprecated extensions will be made
unavailable unless the driver explicitly advertises them.  In particular,
MSP_legacy_features is made unavailable so code that tries to access
legacy features with a core profile context will throw an exception.
Additionally no enable/disable calls will be generated for textures, as
they are only used for legacy texture units.

7 years agoAdd a function to determine the active GL profile
Mikko Rasa [Sat, 5 Nov 2016 23:37:11 +0000 (01:37 +0200)]
Add a function to determine the active GL profile

7 years agoBe smarter when detecting the core version of extensions
Mikko Rasa [Sat, 5 Nov 2016 23:28:58 +0000 (01:28 +0200)]
Be smarter when detecting the core version of extensions

7 years agoUse an orthographic camera for rendering the shadow map
Mikko Rasa [Sat, 5 Nov 2016 22:20:40 +0000 (00:20 +0200)]
Use an orthographic camera for rendering the shadow map

7 years agoProperly compute frustum culling for orthographic cameras
Mikko Rasa [Sat, 5 Nov 2016 22:10:59 +0000 (00:10 +0200)]
Properly compute frustum culling for orthographic cameras

It's still incorrect for skewed frustums but I'll fix that later.

7 years agoAlso convert RenderBuffer formats to sized variants if possible
Mikko Rasa [Sat, 5 Nov 2016 15:12:20 +0000 (17:12 +0200)]
Also convert RenderBuffer formats to sized variants if possible

7 years agoPrefer RG pixelformats over LUMINANCE
Mikko Rasa [Thu, 3 Nov 2016 11:12:06 +0000 (13:12 +0200)]
Prefer RG pixelformats over LUMINANCE

LUMINANCE formats were deprecated in OpenGL 3.0.  ARB_texture_swizzle
was not promoted to core until 3.3, so it's possible this won't work on
some transition period hardware.

SLUMINANCE formats are marked as deprecated in mspgl since it's not
possible to properly emulate them through swizzling.

7 years agoExpand the PixelFormat conversion API
Mikko Rasa [Thu, 3 Nov 2016 10:50:35 +0000 (12:50 +0200)]
Expand the PixelFormat conversion API

Get_sized_pixelformat now takes an explicit size parameter.  The decision
between 16-bit and 32-bit depth component formats has been moved to
Texture::set_internal_format.

Get_unsized_pixelformat was added as an intermediate step for
get_base_pixelformat.  It preserves sRGB information.

7 years agoFix Texture2D::get_data_size to use get_pixel_size
Mikko Rasa [Thu, 3 Nov 2016 08:29:08 +0000 (10:29 +0200)]
Fix Texture2D::get_data_size to use get_pixel_size

7 years agoHave get_component_size return zero for unsized formats
Mikko Rasa [Thu, 3 Nov 2016 08:27:50 +0000 (10:27 +0200)]
Have get_component_size return zero for unsized formats

Get_pixel_size still assumes a component size of at least one byte.

7 years agoMove internal format management to the Texture base class
Mikko Rasa [Thu, 3 Nov 2016 08:08:29 +0000 (10:08 +0200)]
Move internal format management to the Texture base class

7 years agoUse indexed string query to get extensions on OpenGL 3.0 and above
Mikko Rasa [Wed, 2 Nov 2016 22:23:08 +0000 (00:23 +0200)]
Use indexed string query to get extensions on OpenGL 3.0 and above

7 years agoAdd the ARB_texture_rg extension
Mikko Rasa [Wed, 2 Nov 2016 20:57:10 +0000 (22:57 +0200)]
Add the ARB_texture_rg extension

7 years agoAdd properties to export materials as texture array layers
Mikko Rasa [Sat, 29 Oct 2016 17:02:10 +0000 (20:02 +0300)]
Add properties to export materials as texture array layers

7 years agoUse ARB_direct_state_access to avoid some bind calls
Mikko Rasa [Fri, 28 Oct 2016 17:03:54 +0000 (20:03 +0300)]
Use ARB_direct_state_access to avoid some bind calls

7 years agoRefactor TextureCube face information functions with lookup tables
Mikko Rasa [Fri, 28 Oct 2016 16:34:10 +0000 (19:34 +0300)]
Refactor TextureCube face information functions with lookup tables

7 years agoRefactor Framebuffer::update_attachment for less indentation
Mikko Rasa [Fri, 28 Oct 2016 15:54:39 +0000 (18:54 +0300)]
Refactor Framebuffer::update_attachment for less indentation