Commit Graph

1204 Commits

Author SHA1 Message Date
Alexander Szpakowski c4a5b16447 Merged from main? 2013-01-13 21:37:52 -05:00
vrld 2db9bfad11 Fix PixelEffect texture unit pool.
Fixes two problems: (1) Overwriting externs with the same name and (2) not using unused texture units properly.

1) Sending two different images to two different effects using the same extern name would use the same image for both effects, e.g.:

	effect_1:send('img', img_1)
	effect_2:send('img', img_2) -- also changes img to point to img_2 in effect_1!

Fixed by localizing the name -> texture unit mapping for each pixel effect.

2) When a pixel effect was destroyed, the allocated texture units were not marked as being available again. Fixed by having a vector<bool> marking the free units instead of just a counter how many units are in use.


Still problematic: Sending more than GL_MAX_TEXTURE_IMAGE_UNITS (>= 16, depending on the implementation) images/canvases *in total* to pixel effects. Effects could hold references to used *texture-ids* and bind/unbind them dynamically on a effect switch. Con: Introduces additional complexity when switching effects. However, benchmarks by Alexander Szpakowski have shown the performance loss is negligible.
2013-01-13 16:19:27 +01:00
Alexander Szpakowski 8fdd6cbbb2 Merged in from main repository (originally from love-mipmap fork) 2013-01-12 18:07:14 -05:00
vrld 3b80c52cc2 Merged in slime73/love-mipmap (pull request #18: Add mipmapping support to images) 2013-01-12 23:54:15 +01:00
rude 697f4de80a Fix compilation issue in MSVC2012. 2013-01-12 11:28:32 +01:00
Alexander Szpakowski 69dc6c76e8 Better boolean shader extern support 2013-01-11 00:47:15 -04:00
Alexander Szpakowski ca1a9caf91 Added boolean value support to ShaderEffect:send 2013-01-11 00:21:28 -04:00
Alexander Szpakowski 3a9659b608 More minor graphics.lua cleanup 2013-01-09 01:01:13 -04:00
Alexander Szpakowski f1e72efd30 Cleaned up graphics.lua script a bit 2013-01-08 23:59:48 -04:00
Alexander Szpakowski 3e3f5c6bdd Minor tweaks, balanced disable/enable clientstate calls in SpriteBatches 2013-01-08 05:33:22 -04:00
Alexander Szpakowski 808a09f786 Changed shader source list from a vector of sources to a map of shader types to source codes 2013-01-07 19:13:19 -04:00
Alexander Szpakowski b6088115c9 Changed some variable names to be more descriptive 2013-01-07 18:26:41 -04:00
Alexander Szpakowski 36c5259e12 Font objects now have mipmap filter and mipmap sharpness support 2013-01-07 16:31:48 -04:00
Alexander Szpakowski a6f4a3ab0f Removed names of unused parameters to quiet noisy compilers 2013-01-07 07:29:04 -04:00
Alexander Szpakowski e5388ff73b Removed more unnecessary tabs in blank lines 2013-01-07 07:11:40 -04:00
Alexander Szpakowski eb98e8cc48 Removed unnecessary tabs in empty lines, fixed texture filtering when the minification and mipmap filter are the same 2013-01-07 06:56:59 -04:00
Alexander Szpakowski 609ef2c4e4 Format luaL_error strings properly in ShaderEffect lua wrapper code 2013-01-07 06:39:33 -04:00
Alexander Szpakowski 88af7239c3 Removed unnecessary tabs from empty lines 2013-01-07 06:21:15 -04:00
Alexander Szpakowski 0968fa6f11 More cleanup and some overdone comments 2013-01-05 15:59:01 -04:00
Alexander Szpakowski 37191a5953 Minor cleanup 2013-01-04 05:05:25 -04:00
Alexander Szpakowski dcf9825226 Uniform value defines now exist in both the vertex and fragment shaders 2013-01-04 01:45:46 -04:00
Alexander Szpakowski c13b1fb03b Changed vertex shader callback function name from 'transform' to 'position', added more vertex shader defines (some to make it easier to eventually have a GLES2 backend), hopefully updated Visual Studio project with changed filenames 2013-01-04 01:20:38 -04:00
Alexander Szpakowski 8b3fb1d71c Code cleanup 2013-01-02 17:19:41 -04:00
Alexander Szpakowski 1de26ea1fa Added "mipmap" love.graphics.isSupported string 2013-01-02 05:55:50 -04:00
Alexander Szpakowski 2d077758d1 Fixed mipmap generation for pre-FBO systems, fixed NPOT check if mipmap filtering is enabled on an image before the texture is created 2013-01-02 05:29:17 -04:00
Alexander Szpakowski f067e228b4 Fixed mipmap sharpness setting not being correctly reapplied on resolution change 2013-01-02 04:44:24 -04:00
Alexander Szpakowski fda16e27cd Changed image mipmap api: Image:setFilter now takes an optional third argument (mipmap filter mode), Image:get/setMipmapFilter is removed. 2013-01-02 04:21:22 -04:00
Alexander Szpakowski 2739ea561a Initial image mipmapping implementation. Includes Image:set/getMipmapFilter and Image:set/getMipmapSharpness. setMipMapFilter requires a filter mode, or nil to disable mipmapping.
Enabling mipmapping on an image that does not have power-of-two dimensions will raise an error, due to inconsistent support in older graphics chipsets
2013-01-02 02:50:13 -04:00
Alexander Szpakowski ab98b0de45 Added mipmap support to Image filter struct and OpenGL texture filter helper functions 2013-01-01 21:44:27 -04:00
Alexander Szpakowski 1678252b7a Applied patch from issue #542 (texture filtering inconsistencies) in main LÖVE repository 2013-01-01 21:29:38 -04:00
Alexander Szpakowski 6560019829 opengl graphics module files now always include OpenGL.h rather than GLee.h 2013-01-01 17:54:14 -04:00
Alexander Szpakowski 9143442448 Add internal support for tesselation control and evaluation shaders (not that they'll ever be used), now that GLee has definitions for them 2013-01-01 04:39:33 -04:00
Alexander Szpakowski a18b353e62 Update GLee to latest available version (supports extensions and versions up to when OpenGL 4.2 was released, old GLee only had GL3.0 support) 2013-01-01 04:29:41 -04:00
Alexander Szpakowski da661e8e2f Bind texture id 0 (no texture) instead of disabling/re-enabling texturing entirely, when drawing graphics primitives. This both allows shaders to potentially use their own textures when drawing textureless primitives, and reduces overhead caused by constant GL state changes when drawing many graphics primitives. 2013-01-01 04:08:30 -04:00
Alexander Szpakowski 8bae828924 Don't override texture binding check when calling bindTexture with a texture id of 0 2013-01-01 04:03:26 -04:00
Alexander Szpakowski 15a1fd3552 Re-added "pixeleffect" graphics isSupported string for compatibility 2012-12-31 06:18:43 -04:00
Alexander Szpakowski d62878fbb8 Use GLSL #line preprocessor directive instead of manually trying to convert error message lines; flag shader objects for lazy-deletion after linking with program object instead of detaching them immediately (debuggers can now view source code of shader programs) 2012-12-28 21:32:13 -04:00
Alexander Szpakowski f54c270042 minor cleanup and fixes 2012-12-24 17:07:29 -05:00
Alexander Szpakowski 3047321e71 Use initializer list copy constructor instead of per-element copying for shader source list in ShaderEffect constructor 2012-12-23 00:29:23 -04:00
Alexander Szpakowski 83204c5dc5 ShaderEffects now take a dynamically sized list of source codes instead of one vertex and one fragment shader string 2012-12-22 22:47:07 -04:00
Alexander Szpakowski b55de47fb9 misc cleanup 2012-12-22 05:37:34 -04:00
Alexander Szpakowski 0c525ebb92 shaders now use a static vector of counters for each texture unit to help keep track of completely free texture units 2012-12-22 01:35:36 -04:00
Alexander Szpakowski 79fa42d207 made ShaderEffects individully handle texture units for sent images/canvases, added GL helper function for quickly binding a texture to a specific texture unit, hopefully made ShaderEffects load and unload volatile better 2012-12-22 00:29:11 -04:00
Alexander Szpakowski 16f925affa improved GL texture binding api to take texture units into consideration 2012-12-21 20:35:32 -04:00
Alexander Szpakowski 5626b74b79 reduced unnecessary usage of glUseProgram, shadereffect is now properly detached in unloadVolatile and reattached if necessary in loadVolatile, made current and max texture units static to prevent different shaders from overwriting the value of different texture units 2012-12-21 17:43:47 -04:00
Alexander Szpakowski 5252ed28cd changed shadereffect texture image unit counter and map to be non-static, get max texture units from max combined TIUs instead of max fragment shader TIUs, added the current MVP matrix as an argument to the vertex shader transform function, reduced code duplication in ShaderEffect::sendImage and sendCanvas 2012-12-21 05:03:50 -04:00
Alexander Szpakowski 0611234067 changed PixelEffect name to ShaderEffect, added lua-side support for vert/frag shader combinations with love.graphics.newShaderEffect, added tentative support for single-file vertex+fragment shaders 2012-12-20 21:51:31 -04:00
Alexander Szpakowski 28e3b105e9 added C++side support for combinations of vertex and fragment shaders in pixeleffects 2012-12-20 03:42:48 -04:00
Alexander Szpakowski a8dc813258 Text drawing performance improvements (issue #532) 2012-12-15 22:18:40 +01:00
Bart van Strien 68a895e7c6 Catch errors in love.font.newRasterizer, add luax_pconvobj which pcalls, allowing love.graphics.newFont to clean up before re-erroring 2012-12-15 14:26:46 +01:00