Commit Graph

957 Commits

Author SHA1 Message Date
rdb 8be70ed16d glgsg: auto convert to srgb(a) if sluminance not supported
This is particularly the case when requesting a core-only profile (gl-version 3 2) where luminance textures are deprecated.

There is apparently no way to emulate them with swizzles (as we do with luminance textures), so we'll have to duplicate the channels out.

Fixes #693
2019-08-12 21:04:48 +02:00
rdb 42dff65e4d general: fix various unprotected debug() outputs
These should be protected by an is_debug() check so that they can be optimized out properly in a release build.  Setting check-debug-notify-protect in Config.prc can be used to track down cases of missed checks.
2019-08-03 10:33:43 +02:00
Mitchell Stokes f2686c5ad8 glsl: Fix Shader::_error_flag not being set on compile errors (#622) 2019-08-01 12:14:31 +02:00
rdb 7f385b5ddf glsl: fix use of multiple p3d_TextureMatrix[] values 2019-07-30 19:30:15 +02:00
rdb f25532db78 glgsg: properly handle shader compilation failure
Fixes #645
2019-05-03 20:49:08 +02:00
rdb 475bd55bb1 glgsg: add gl-forward-compatible config variable
This is meant to be used alongside gl-version to request a "forward compatible" OpenGL 3.0 or 3.1 context, which removes support for deprecated features such as the fixed-function pipeline.
2019-05-03 15:46:01 +02:00
rdb 53612512d5 glgsg: more reliable check for core/compat profile
Fixes #643
2019-05-03 15:43:20 +02:00
rdb 8b79fb75b9 glgsg: allow multisampling on FBO even if host has no multisamples
Fixes #601
2019-04-09 13:24:52 +02:00
rdb b0a5cceafd glgsg: fix support for matrix arrays in vertex data 2019-03-21 12:35:53 +01:00
rdb 60a944e783 glgsg: fix shader inputs not being updated in esoteric case
Specifically, this happens if you have a custom ShaderGenerator that assigns shader inputs via the ShaderAttrib.  If two objects then both have the auto-shader turned on, and the shader generator generates ShaderAttribs with the same shaders but different inputs, the inputs will not be updated properly for one of the objects.
2019-01-09 22:39:36 +01:00
rdb 886d44d15d glgsg: fix multisampling for floating-point framebuffers 2019-01-09 22:39:05 +01:00
rdb 84df25cfe3 glgsg: fix sRGB support in multisample FBOs 2019-01-09 00:49:14 +01:00
rdb 83374de0ff shader: don't use GENERIC profile to compile Cg shaders
Instead, make an educated guess of what the GSG we are going to be compiling this shader for wants to use as profile.
2018-12-31 14:01:26 +01:00
rdb 0cfd86d0f4 glgsg: warn if Cg shader uses float4 vtx_normal
See #495; Cg's glslv profile does not handle a float4 vtx_normal well and causes garbage to be in the w coordinate.
2018-12-31 13:11:33 +01:00
rdb 981c44f636 glgsg: fix misleading errors from p3d_LightSource[].shadowMap 2018-12-26 23:31:48 +01:00
rdb 669a655366 Fix ShaderBuffer cleanup assertion with state cache disabled 2018-12-26 22:47:14 +01:00
rdb 840f28ef18 glgsg: fix framebuffer_copy_to_ram format for float framebuffers 2018-12-19 12:43:39 +01:00
rdb 11526852ed glgsg: add ability to get red/rg-only floating-point renderbuffers 2018-12-18 20:00:59 +01:00
rdb 3adc7d977e glgsg: fix compilation in double-precision mode 2018-12-04 16:16:05 +01:00
rdb 3c6b6e47ec glgsg: don't call glLineWidth with higher value than maximum
Officially, in core profile OpenGL 3.2+, calling it with a value higher than 1.0 is an error, but many vendors seem to let us.  Apple's implementation does not.  It appears that checking the maximum line width is a way to deal with this.

Fixes #466
2018-12-04 15:53:56 +01:00
rdb 97d4e32a06 general: use nassert_raise instead of nassertv(false) et al
Even a brief error message in the assertion is infinitely more useful to a user who is not at home in the source code, especially for assertions that may reasonably be triggered by honest user mistakes.
2018-11-28 17:35:20 +01:00
rdb 272f13023e glgsg: unbind buffers after draw callback
Some libraries (eg. Kivy) leave their buffers bound, so this takes care of that.
2018-11-25 16:46:38 +01:00
rdb 3f91615a22 glgsg: reset color write mask before calling draw callback 2018-11-23 00:23:52 +01:00
rdb 8ad0cb6b57 glgsg: add support for p3d_FragData fragment output
This is necessary for GLSL 1.30 which deprecates gl_FragData but does not yet support layout(location=) specifiers

Also fix some function pointer checks for pre-GL 3.0

Fixes #455
2018-11-22 23:55:54 +01:00
rdb ec4b0825e9 glgsg: restore more OpenGL state after draw callback 2018-11-20 12:41:43 +01:00
rdb 53cec96c07 Fix draw calls being listed under Primitive Setup in PStats, etc.
Previously, all draw calls would be grouped under "Primitive Setup", rather than under the appropriate bin collector.  This commit fixes that and adds a few other useful collectors as well.
2018-11-20 12:41:30 +01:00
rdb c18cdcf36e display: add support for debug markers, to help with debugging
This is useful when running Panda in a tool like apitrace, so that the different calls in a frame are ordered in a neat hierarchy.
2018-11-20 12:41:20 +01:00
rdb 8f73f95e79 display: make PStats clear collectors per-window 2018-11-19 20:02:38 +01:00
Sam Edwards a9dfd8352e general: Distinguish local/system includes
This changes includes so that local includes are consistently
#include "localFile.h"
while system and third-party includes are consistently
#include <systemFile.h>

This commit mostly converts the former to the latter; the two
exceptions are in android_main.cxx and fmodAudioSound.h, where
the reverse was necessary.
2018-11-10 18:00:10 -07:00
rdb dfbe728bad glgsg: fix shader point sprites when not using core-only profile 2018-11-08 15:50:44 +01:00
Brian Lach da05ef1f5c glgsg: send fog parameters to GLSL shaders
Closes #438
2018-11-05 22:14:25 +01:00
rdb 90c13cbd4e glgsg: fix error downloading texture with WM_repeat 2018-10-17 17:32:19 +02:00
rdb 75826c9a51 glgsg: fix error with multisampled float depth buffer
Fixes #416
2018-10-16 15:20:45 +02:00
rdb 70f4c1cd4e glgsg: change missing Cg attrib error message to debug
This can occur if a variable is optimized out by the GLSL compiler but not by the Cg compiler.  So it should not be reported as an error.

Fixes #417
2018-10-15 14:09:39 +02:00
rdb 93a3e7e699 Changes to make ColorAttrib behavior more consistent:
- T_off now actually properly disables vertex colours
- T_vertex is now the default, to preserve the previous behaviour
- ShaderGenerator behavior is now the same as in the FFP
- tests are updated to verify new behavior
- tests now properly use vertex colours, previously they accidentally only used flat colors
- With color-scale-via-lighting off and no color scale, color is no longer munged
- p3d_Color in GLSL shaders is now properly set to white instead of black with T_off mode
- In DX9 shaders will now sample white color for absent or disabled vertex color

Fixes #401
Also see #371
2018-10-08 22:09:22 +02:00
rdb e1af4abf11 glgsg: fix sRGB for FBOs created from non-sRGB host window
In this case _current_properties in begin_frame() will not have srgb_color set, as the current props are set by the host window
2018-10-07 21:42:23 +02:00
rdb 47496068d3 Show materials with only base color applied properly 2018-09-09 20:56:37 +02:00
rdb 2556d006f7 glgsg: a few version check tweaks 2018-08-05 13:09:25 +02:00
rdb 8348f16665 glgsg: fix incorrect behavior if mat has either ambient or diffuse
This might have only been an issue in some drivers (not sure, spec is a bit vague here).
Apparently we need to call glMaterial *after* the color material setting has been disabled for it to stick.

Fixes #369
2018-08-05 12:54:32 +02:00
rdb ad3ab3ad21 Define stable ordering for WeakPointerTo for use as map/set key
Currently, the WeakPointerTo comparison operators compare the raw pointers, but this is not useful as it may cause a false equality if one weak pointer in the comparison is expired and points to memory that has since been reused.

Instead, we can define a comparison based on the control block pointer, which exists since the new weak pointer implementation in 0bb81a43c9.  This is implemented in the owner_before method, matching C++11 std::weak_ptr semantics.

I would now recommend deprecating most comparison operators of WeakPointerTo or redefining them to make more sense, ie. comparing equal if they (once) referred to the same object and not if they simply point to the same memory address.  This has not yet been done, though code that uses the comparison operators has been fixed in this commit.

Overloads of std::owner_less have been provided for creating a map or set with Weak(Const)PointerTo keys.
2018-07-30 17:27:09 +02:00
rdb 02b32a5814 glgsg: support vertices-float64 in core profile shaders
Requires OpenGL 4.1 or GL_ARB_vertex_attrib_64bit extension.
2018-07-26 22:58:15 +02:00
rdb ecfeae8a27 shader: support double-precision vertex columns in GLSL 2018-07-26 22:07:20 +02:00
rdb 7fe72c47f3 glgsg: update copy of glext.h 2018-07-23 09:02:12 +02:00
rdb 359ce3e9ef glgsg: fix error with glObjectLabel and SSBO 2018-07-17 22:59:23 +02:00
rdb b5194d9ff2 glgsg: pad SSBOs to 16 byte boundary (required by some drivers) 2018-07-17 22:59:15 +02:00
rdb 06539f5c66 glsl: support passing uint variables to shader 2018-07-17 22:32:34 +02:00
rdb 799f0b4f78 glgsg: work around driver bug extracting buffer texture data
Some drivers would report the wrong internal format.  But it's silly that we query the internal format anyway, since buffer textures have a fixed sized internal format.
2018-07-17 17:04:50 +02:00
rdb e41eeaae23 glgsg: if 32-bit unorm depth is not available, fallback to float
This prevents falling back to 24-bit depth if 32-bit depth is requested.
2018-07-12 14:17:02 +02:00
rdb 828233a8f2 glgsg: support gl-depth-zero-to-one to get same NDC Z range as D3D 2018-07-12 14:13:32 +02:00
rdb 16daf08e42 glgsg: fix some GCC warning messages 2018-07-11 13:33:50 +02:00