Mikko Rasa [Fri, 17 Nov 2017 21:54:43 +0000 (23:54 +0200)]
Refactor the structure of extgen.py
Functionality should be more or less preserved at this stage, modulo new
or fixed bugs. Some extensions are detected differently on OpenGL ES but
those were largely incorrect anyway and will be fixed soon.
Mikko Rasa [Sun, 10 Sep 2017 12:33:41 +0000 (15:33 +0300)]
Immediately process window size to set correct viewport size
The system framebuffer acquires its size from the window when the GL
context is created, but in some use cases the window may change size
before a View is created on it.
Mikko Rasa [Fri, 6 Jan 2017 11:49:20 +0000 (13:49 +0200)]
Simplify reflections in the singlepass shader
Specular reflection of the sky was dropped. It's better implemented
through an environment map. In the future I'll add a skybox utility
class which provides a simple environment map.
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).
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.