Commit Graph

178 Commits

Author SHA1 Message Date
8a547af2bd Remove border clamping. Usually we just want to clamp to edge instead.
Note - checked all glTexImage functions and we never use that. Border is
ifdefed out too here.
2015-01-05 14:25:22 +01:00
3e61478b1b Fix T42917 shadow maps not working on ATIs.
This is yet another issue with framebuffers. There are two issues: We
need the framebuffer fully bound to check for completeness and when we
bind a depth texture as frame buffer we need to disable read/write.
2014-12-16 21:52:55 +01:00
e1e984e437 Fix T42807, variance shadow map broken afterFBO changes.
This code was a bit do-it-yourself instead of relying on the API. Should
be OK now.
2014-12-05 16:01:18 +01:00
Dalai Felinto
409043c69d GPU: code cleanup, no fundamental changes 2014-12-03 17:56:20 -02:00
4afd5db47e Only annoy coders with warnings, not users. 2014-12-03 19:49:48 +01:00
0154096fd5 Cleanup: unused headers 2014-11-28 23:12:12 +01:00
9f64a86436 Fix framebuffer completeness being broken after last framebuffer cleanup
commits.

Basically, we don't set a draw buffer until draw time comes. Also add
explicit validation function to validate after all textures have been
attached (could be done automatically at bind time too probably, but
left out for now)
2014-11-25 16:16:50 +01:00
a08ac5513f Fix for previous commit 2014-11-18 12:44:56 +01:00
3ae0126f86 GPUFramebuffer API cleanup:
* read buffers are set at texture binding time
* change naming when setting a texture as framebuffer
* add function to set slot of framebuffer as current target instead of
texture.
* Binding a buffer reuses the dimensions of the texture at bind time
(can use viewport to set to arbitrary range later)
* Removed offscreen buffer width/height, use the generated texture
dimensions instead. Those were supposed to be checked to see if
generated texture had the requested size but were never actually changed
to the texture dimensions (and it's redundant to store twice).
2014-11-18 12:37:55 +01:00
0f947f2cc5 GPU framebuffer/texture API: Warn when binding a texture that is also
attached to a framebuffer or vice versa.

might be more correct to just handle the case and unbind here.
2014-11-18 12:15:16 +01:00
998a867ba3 GPU framebuffer API:
Allow binding a texture to a different texture attachment than the
first.

Also fix a number error in seperable gaussian blur shader.
2014-11-18 11:56:37 +01:00
8d084e8c8f Ghost Context Refactor
https://developer.blender.org/D643
Separates graphics context creation from window code in Ghost so that they can vary separately.
2014-10-07 15:47:32 -05:00
7901faf335 Fix T42049: Crash exiting /w GL1.1 2014-10-02 16:24:14 +02:00
78b79a91f2 Fix T41596 GLSL error on ATIs after clipping workaround commit.
This was a little difficult to track down, basically it was a missing
escape sequence that only manifested itself when GPU did not support
bicubic filtering.

Extra:

* Fix memory leaks when an error occurs in shader compilation
* Display full shader when a compilation error occurs. Makes it easier
to diagnose if problem is caused by a syntax or compatibility error.
2014-08-29 16:23:50 +02:00
8986883de1 Fix T41314: OpenGL error when using Cycles engine 2014-08-18 13:55:22 +06:00
4097f9c3c4 Another attempt for T40981, clipping border does not work with GLSL on
ATIs.

This is actually a test to see if this can be enabled on ATI cards.
According to various sources, newer ATI cards supporting GLSL 3.0
support gl_ClippingDistance in shaders, which is the forward compatible
way to do custom clipping.

This fix will bind 6 additional varying variables on ATIs, which may
lead to some shaders not compiling due to limiting out of those
variables, or to performance degradation. Also I do not have an ATI
handy to test.

Having those in mind, this commit may well be reverted later.

Clipping planes are usually 4 (6 is for cube clipping), but making
shaders depend on viewport state is really bad, and would lead to
recompilation, so I took the worst case here to avoid that.
Hopefully driver does some optimization there.
2014-07-11 19:17:40 +03:00
9f0466fb6b Quiet double promotion warning & ws edit 2014-06-13 02:22:40 +10:00
e8c63caf77 Fix T40498 invalid textures flickering.
Issue here is most likely sampler uniforms and textures not being
updated properly when zero binding is created. Solution for now is to
allow zero binding but when this happens use sexy pink invalid texture
instead :p.
2014-06-10 01:43:54 +03:00
7ca74fc1c0 Code cleanup: use 'const' for arrays (blenloader, gpu, imbuf, makesdna, modifiers, nodes) 2014-04-27 00:25:16 +10:00
617557b08e Code cleanup: remove TRUE/FALSE & WITH_BOOL_COMPAT define 2014-04-01 15:22:28 +11:00
621bf47e91 Docs: doxygen file descriptions for BLF, GPU and WM 2014-01-19 23:15:25 +11:00
494687908c BGE: Potential fix for [#35522] Broken game engine compatibility since 2.66a on some ATI cards?
Disabling display lists for legacy ATI cards since they don't support display lists well.

Also removing an unused variable from the display list rasterizer.
2013-09-11 23:24:45 +00:00
f7037737f3 BGE fix [#35472] Sun variance shadows does not work in game engine
The game engine had depth testing enabled when blurring the shadows which caused the blurring to not work properly.
2013-07-23 00:52:49 +00:00
cda5770160 code cleanup: also fix crash in GPU_state_print(). and confine to debug mode builds. 2013-06-13 11:59:28 +00:00
359edc27d3 style cleanup 2013-05-11 01:06:01 +00:00
feeab1ad53 Fix #34997: when starting the game engine in one window and switching to a second
window, the game would stop drawing in the first and mess up the OpenGL state of
the second.

Also fixes glPushAttrib/glPopAttrib getting out of sync in some cases.
2013-04-18 16:28:39 +00:00
2f9b7410dc code cleanup: warnings + style 2013-04-13 00:43:49 +00:00
d0beabb642 Add function to query maximum texture size. Also, make texture upload
functions aware of this limit.
2013-04-12 17:56:07 +00:00
0aada35e93 Fix #34788, #34744: GLSL error, #version line needs to be at the top of the shader
and this wasn't the case anymore after recent changes.
2013-04-02 16:37:31 +00:00
e8d532f1dd style cleanup 2013-03-31 03:28:46 +00:00
d15d78a33a style cleanup: osl and NULL pointer use, also correct sequencer gap operator id's 2013-03-27 20:27:07 +00:00
2d21e6521f Fix: multisample viewport drawing didn't work well with selection or particle
brushes, due to issues with color coded drawing or slow/buggy reading from such
a buffer on some systems.

In case multisample is enabled now, it uses an offscreen buffer for such drawing,
which is not multisampled and so should not cause issues. This does mean there is
some extra GPU memory usage when multisample is enabled, and we could optimize
triple buffer to work together here somehow to share buffers, but it's better than
having selection not working.
2013-03-15 19:56:33 +00:00
962865d19f fix for 2 errors where the 2d arrays were used as 3d. (out of bounds read).
also minor code cleanup.
2013-03-13 18:10:05 +00:00
5ff0daf1ac Fix #34492: clipping border not working with GLSL/matcap and Nouveau drivers. 2013-03-13 18:00:13 +00:00
ee3d910f8f code cleanup: quiet struct gcc warnings, also use more conventional names for bmesh dissolve. 2013-03-12 08:50:02 +00:00
9fe858264c OpenGL: more work on fixed function lighting implementation as GLSL.
* Rename functions and move to own header.
* Add wrapper functions for glLight.
* Auto detect if we can use faster code for solid lighting.
* Various fixes for textured draw mode.
2013-03-10 15:38:23 +00:00
4643d61ffb OpenGL: implemenation of fixed function lighting as per pixel GLSL shaders. The
code is still unused, but the intention is to use this to solve the double sided
lighting problem on NVidia, and to make the materials work on OpenGL ES 2.0
eventually.

The code works and matches the fixed function lighting pretty much exactly, but
still needs optimizations. The actual integration in object draw will be
committed later when more fixing & testing, there's lots of different combinations
and unclear OpenGL state here.
2013-02-26 00:49:42 +00:00
c411cde415 header cleanup, include BLI before BKE, also use bool for ntreeShaderExecTree 2013-01-24 21:57:13 +00:00
e11d22a6b7 Matcap support in 3D Viewport.
Full log is here:
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability#Matcap_in_3D_viewport

Implementation notes:

- Matcaps are an extension of Solid draw mode, and don't show in other drawmodes.
  (It's mostly intended to aid modeling/sculpt)

- By design, Matcaps are a UI feature, and only stored locally for the UI itself, and
  won't affect rendering or materials.

- Currently a set of 16 (GPL licensed) Matcaps have been compiled into Blender. 
  It doesn't take memory or cpu time, until you use it.

- Brush Icons and Matcaps use same code now, and only get generated/allocated on
  actually using it (instead of on startup).

- The current set might get new or different images still, based on user feedback.

- Matcap images are 512x512 pixels, so each image takes 1 Mb memory. Unused matcaps get 
  freed immediately. The Matcap icon previews (128x128 pixels) stay in memory.

- Loading own matcap image files will be added later. That needs design and code work 
  to get it stable and memory-friendly.

- The GLSL code uses the ID PreviewImage for matcaps. I tested it using the existing
  Material previews, which has its limits... especially for textured previews the
  normal-mapped matcap won't look good.
2013-01-22 11:18:41 +00:00
857df8065f style cleanup 2012-12-28 14:19:05 +00:00
94f85c3c72 Fix #33371: blender freezing in material draw mode.
When FBO failed in a particular way it could cause the opengl draw buffer to be
set wrong, effectively disabling all opengl drawing. The FBO error was caused
by cycles GLSL materials with no nodes that would still use blender internal
materials, which caused issues with lamp shadow buffers FBO.

This also fixes a GLSL refresh issue when switching render engines.
2012-12-03 08:31:16 +00:00
f213ae0b19 style cleanup 2012-11-01 09:54:00 +00:00
85d9ba5cbb Fix issue after commit 50282: float texture painting non-color data textures did
not do correct partial updates, now it remembers if the opengl texture is a
non-color data texture or not and takes that into account for the update.

Also includes some renaming ncd => is_data for consistency with color space
terminology used elsewhere.
2012-10-25 15:25:28 +00:00
cb634b9100 Google Summer of Code project: "Smoke Simulator Improvements & Fire".
Documentation & Test blend files:
------------------
http://wiki.blender.org/index.php/User:MiikaH/GSoC-2012-Smoke-Simulator-Improvements

Credits:
------------------
Miika Hamalainen (MiikaH): Student / Main programmer

Daniel Genrich (Genscher): Mentor / Programmer of merged patches from Smoke2 branch
Google: For Google Summer of Code 2012
2012-10-10 13:18:07 +00:00
b25ca62f20 Fix #32404: GLSL normal maps using float images were incorrectly getting
color managed.
2012-08-30 17:42:04 +00:00
da710b3e14 style cleanup: brace placement/newlines 2012-05-24 16:35:45 +00:00
9dd981a440 style cleanup: block comments 2012-05-16 23:37:23 +00:00
6327c9aae1 style cleanup: whitespace, braces 2012-05-01 20:08:23 +00:00
ae4fda82b0 Merging phase 1 of the BGE Harmony branch:
* Shadow color now usable in the BGE
 * Simplified the shadow panel while "Blender Game" renderer is active
 * Added variance shadow maps for the BGE
 * Buffered shadows on sun lamps in the BGE (orthographic)
 * Light textures in the BGE
2012-05-01 02:50:17 +00:00
b340f930ec style cleanup: changes to brace placement / newlines - for/while/if/switch 2012-04-28 06:31:57 +00:00