Mikko Rasa [Mon, 27 Oct 2014 20:28:35 +0000 (22:28 +0200)]
Move eye_obj matrices back out of the uniform block
It turns out that updating the buffer for every draw call causes trouble
for drivers, especially OpenGL ES. Projection matrix typically does not
change during a frame, so it can stay.
Mikko Rasa [Sun, 19 Oct 2014 16:59:36 +0000 (19:59 +0300)]
Deprecate Renderer::escape() and replace it with end()
I never used escape() for much anything, and now it's causing problems on
OpenGL ES by trying to apply state with no shader and consequently set
system matrices. In the future I'll add a corresponding begin() call to
allow persistent Renderers.
Mikko Rasa [Fri, 17 Oct 2014 18:30:08 +0000 (21:30 +0300)]
Allow applying a VertexArray in non-legacy mode
Mesh::bind now has consistent results whether or not vertex array objects
are available. This is unlikely to be needed on full OpenGL, but is
necessary for OpenGL ES 2.0 support (ES 3.0 has VAOs).
Mikko Rasa [Wed, 15 Oct 2014 21:12:32 +0000 (00:12 +0300)]
Delay loading matrices until they are needed
If all renderables use modern shaders, it's not necessary to touch the
system matrix stacks at all. OpenGL ES 2.0 and OpenGL 3.0 core do not
even have system matrix stacks.
Mikko Rasa [Wed, 15 Oct 2014 16:40:16 +0000 (19:40 +0300)]
Remove a number of rarely used legacy features
ShadowMap will now need shaders to work, but it was already broken in
fixed-function anyway due to using large texture unit numbers. Since
all modern hardware supports shaders, even with free drivers, this is
unlikely to be an issue.
The removed pixel format GL_RED is used in ARB_texture_rg, but we don't
support that extension yet.
Mikko Rasa [Wed, 15 Oct 2014 15:36:31 +0000 (18:36 +0300)]
Refactor and optimize the extension generator script
Overly short variable names have been expanded
parse_file was getting a bit unwieldy and has been split
getElementsByTagName is recursive and slow, replaced with custom function
Mikko Rasa [Tue, 30 Sep 2014 17:05:45 +0000 (20:05 +0300)]
Rewrite ResourceManager internals for more scalability
Since loading small resources can often take less than one frame,
especially with vsync enabled, the thread can now handle more than one
resource at once. The code is also somewhat better structured for using
more than one thread in the future.
Mikko Rasa [Mon, 29 Sep 2014 21:07:20 +0000 (00:07 +0300)]
Better handling of unloaded textures
Since it's no longer guaranteed that calling ResourceManager::resource_used
will result in Resource::load being called, it's better to avoid the
binding logic entirely in the unloaded case. In particular, parameters
must not be updated until the GL texture object has been created.
Generating an ID for the texture has been delayed to the last phase of
loading to further differentiate the loaded and unloaded states.
Mikko Rasa [Sun, 28 Sep 2014 17:54:56 +0000 (20:54 +0300)]
Put transform matrices into a uniform block too
I'm fairly certain the glBufferSubData call required to update the block
contents is no slower than the glUniformMatrix* calls to set the uniforms
directly.
Mikko Rasa [Sun, 28 Sep 2014 17:52:17 +0000 (20:52 +0300)]
Don't consider the current buffer in deciding whether to bind BufferRange
glBindBufferRange should only be called if the buffer range bound to that
index was changed. The buffer binding gets changed as a side-effect, but
should not factor into the decision.
Mikko Rasa [Sun, 28 Sep 2014 16:58:08 +0000 (19:58 +0300)]
Rework ProgramData to do less unnecessary work
Changes are now tracked per-uniform, allowing more updates to be skipped.
The buffers used in a program are cached, making the no-changes case
faster.
Additionally, Program now creates a UniformBlockInfo struct for the
default uniform. The program-wide uniform layout hash has been repurposed
to cover the entire program.
Mikko Rasa [Fri, 26 Sep 2014 15:00:18 +0000 (18:00 +0300)]
Unbind things if they are deleted while current
Failing to do so can lead to all sorts of stale-state issues, especially
if a newly created thing happens to get the exact same address as the
just deleted one.
Mikko Rasa [Mon, 16 Jun 2014 21:02:03 +0000 (00:02 +0300)]
Move extension requirements from ProgramData to UniformBlock
ProgramData no longer manipulates GL directly, and it's used in places
like Renderer and Material. This changes allows those things to be used
without shader support.
Mikko Rasa [Tue, 20 May 2014 22:09:49 +0000 (01:09 +0300)]
Rearrange ProgramBuilder's standard variables
The rgb_light_foo names were getting a bit stupid, and the hierarchy also
makes more sense this way. The use of gl_FrontLightProduct was dropped
as too cumbersome to maintain. The future is with modern shaders anyway.
Texture now only affects ambient and diffuse colors, not specular. There
will likely be support for a separate specular map in the future.