Commit graph

449 commits

Author SHA1 Message Date
Ronald M. Clifford a9fb3c9df9 Add missing glDisableClientState call. 2018-04-22 23:31:27 -07:00
Ronald M. Clifford e9d36a29c1 Fix Blocky Filtered option.
[Kp: as discussed in pull #377
<https://github.com/dxx-rebirth/dxx-rebirth/pull/377>, the previous
implementation requested a parameter combination not permitted by
OpenGL.  At best, this error was silently ignored.  Fix the error by
falling through to a switch case statement that sets valid parameters.]
2018-04-23 05:07:15 +00:00
Kp 869fea9498 Make SDL-only SDL_Surface pointers static 2018-03-02 03:19:02 +00:00
Kp 131c1b9f4d Add support for PNG screenshots 2018-02-18 00:42:42 +00:00
Kp 6e5c5f5c49 Mark some ogl parameters const 2018-02-01 05:38:47 +00:00
Kp 01e1b28d71 Replace useless printf with puts 2017-12-05 05:29:55 +00:00
Kp d049f738c8 Convert various gr_set_current_canvas calls to reference form 2017-11-05 20:49:08 +00:00
Kp ca804d5186 Clear canvas to fix missing exit tunnel movie
Global variable `grd_curcanv` is set to a variety of canvases, some of
which are local stack variables.  Use of global variables in this way is
fragile, but works as long as the global is not used beyond the life of
the backing local.

Unfortunately, some existing uses do access the canvas beyond the
lifetime of the backing local.  Playing movies sets the font of the
current canvas.  If the current canvas is an expired stack variable,
setting the font overwrites other stack data.  This data corruption
causes various symptoms, such as inability to play the escape tunnel
movie.

Prior to 03cca2b3dc, the corruption on
playing the endlevel movie had no user-visible effect.  That commit
created a large local variable, which changed stack layout.  Starting
with that commit, the corruption causes the movie to play as all black.

Fix this, and protect against some other data corruption possiblities,
by clearing the global when the local goes out of scope.

Reported-by: Havner <https://github.com/dxx-rebirth/dxx-rebirth/issues/345> (only as cutscene failure to play, not as the underlying corruption issue)
2017-11-05 20:49:08 +00:00
Kp 49c0cdae2e Simplify calls to gr_set_default_canvas
Rather than use an inline wrapper and rely on the compiler optimizer to
redirect gr_set_current_canvas(nullptr) to gr_set_default_canvas,
rewrite all relevant calls directly in the source.

git grep -l 'gr_set_current_canvas' | xargs sed -i -e 's:gr_set_current_canvas(\s*NULL\|nullptr\s*);:gr_set_default_canvas();:'
2017-11-05 20:49:08 +00:00
Kp e58956ddeb Simplify digi_audio_stop_all_channels 2017-10-14 17:10:31 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp 3340a6c16c Report compiled/loaded library versions at verbose level
When reporting use of SDL_mixer, report its loaded version.  When
running in verbose mode, report both the compile-time and load-time
versions of PhysFS, libSDL, and SDL_mixer.
2017-08-26 19:47:51 +00:00
Kp 6b209c8713 Decorate OpenGL messages
Some Linux libraries print their own messages to stdout/stderr,
particularly in case of severe errors.  Decorate messages generated by
Rebirth to distinguish them from library generated messages.

For specific blacklisted renderers, add a message informing the user
that the blacklist matched and changed settings.
2017-08-26 19:47:51 +00:00
Kp b65b6339f4 Make g3_draw_sphere pnt argument const (for OGL only)
SDL still needs to modify it, so use alias type `cg3s_point`, which is
`const g3s_point` in OGL and `g3s_point` in SDL.
2017-08-16 01:54:26 +00:00
Kp c9d733dd10 Add experimental Windows manifest 2017-08-02 02:49:12 +00:00
Kp 7b12619c3a Unify resource file compilation 2017-08-02 02:49:12 +00:00
Kp eff53bfa90 Tighten OGL cache parameter validation 2017-07-26 03:15:59 +00:00
Kp dc33a58225 Use array<> in more places 2017-07-08 18:17:49 +00:00
Kp a7e0e05e19 Rename vertex_array -> vertices
Future work will introduce a typedef vertex_array.  That typedef would
cause these uses to trigger a -Wshadow warning.
2017-07-08 18:17:49 +00:00
Kp dd4bdcb770 Inline OGL_TEXTURE_LIST_SIZE 2017-03-18 18:07:37 +00:00
Kp 297746024b Use enum for GR blending mode 2017-03-18 18:07:36 +00:00
Kp 274f9047aa Fix -Wodr for _g3_draw_poly
x86_64-pc-linux-gnu-g++-6.3 issues a -Wodr diagnostic for the mismatch
between

common/include/3d.h:	void _g3_draw_poly(grs_canvas &, uint_fast32_t nv, cg3s_point *const *pointlist, uint8_t color);
similar/arch/ogl/ogl.cpp:	void _g3_draw_poly(grs_canvas &canvas, const uint_fast32_t nv, const g3s_point *const *const pointlist, const uint8_t palette_color_index)

The declaration and definition are compatible because `cg3s_point` is a
type alias for `const g3s_point`, so the code worked as it was.  Switch
the definition to use `cg3s_point` like the declaration to prevent this
warning and to protect against any future (unlikely) changes to the
definition of `cg3s_point`.
2017-03-18 18:07:35 +00:00
Kp 4e1156a996 Use canvas in OGL g3_draw_sphere 2017-03-11 19:56:24 +00:00
Kp 9311548eba Pass grs_bitmap to ogl_upixelc 2017-03-11 19:56:23 +00:00
Kp 393e96b8d8 Unify SDL/OGL save_screen_shot
This simplifies maintenance and reduces the potential for inconsistency.
It also cleans up one existing inconsistency.
2017-03-10 01:22:27 +00:00
Kp 242c96b679 Cache canvas in ogl/ogl.cpp 2017-03-10 01:22:26 +00:00
Kp 6b8f08142f Pass canvas to LINE_SPACING
Macro LINE_SPACING previously used global grd_curcanv implicitly.
Change it to take a canvas argument.  Change all callers to pass
grd_curcanv, so that usage is explicit.
2017-02-11 21:42:42 +00:00
Kp 48bf96fe6a Pass canvas to g3_draw_bitmap 2017-02-11 21:42:42 +00:00
Kp f279bb8497 Pass canvas to _g3_draw_tmap_2 2017-02-11 21:42:41 +00:00
Kp ac7eac1269 Factor out _g3_draw_tmap_2 lighting checks 2017-02-11 21:42:41 +00:00
Kp 66ee668e48 Pass canvas to _g3_draw_poly 2017-02-11 21:42:41 +00:00
Kp 4791a40007 Pass canvas to _g3_draw_tmap 2017-02-11 21:42:39 +00:00
Kp 6f81d13c41 Pass canvas to gr_set_curfont 2017-02-11 21:42:38 +00:00
Kp 740b3a9649 Pass canvas to ogl_start_frame 2017-02-11 21:42:33 +00:00
Kp 80e7ade6a1 Pass canvas to g3_draw_sphere 2017-02-11 21:42:33 +00:00
Kp 513e7ceceb Pass canvas to g3_draw_line 2017-02-11 21:42:33 +00:00
Kp ae33aaafc1 Pass canvas to gr_set_fontcolor 2017-02-11 21:42:32 +00:00
Kp 0dcae721d9 Make canvas an explicit argument to gr_printf
Previously, a macro implied *grd_curcanv as the canvas.  Pass the canvas
explicitly so that callers can choose the canvas to use.
2017-02-11 21:42:32 +00:00
Kp 8783c22003 Remove obsolete ogl_pal 2017-02-11 21:42:31 +00:00
Kp c1440ff995 Factor out RLE expansion
Many sites open-coded walking a bitmap and handling whether it was
RLE_BIG.  Factor that out into a helper class and redirect those sites
to use it.
2017-02-11 21:42:30 +00:00
Kp 1b81013a9b Pass active palette to ogl_loadtexture 2017-01-15 00:03:13 +00:00
Kp 764d20d4e1 Make grs_bitmap::bm_flags private 2017-01-15 00:03:13 +00:00
Kp 362d526546 Pass canvas to gr_disk 2016-12-29 03:27:13 +00:00
Kp acd309099b Pass canvas to gr_ucircle 2016-12-29 03:27:13 +00:00
Kp 99f5cfbb10 Pass canvas to ogl_ubitmapm_cs 2016-12-29 03:27:12 +00:00
Kp 1ed06c91b7 Pass canvas to ogl_ulinec 2016-12-29 03:27:09 +00:00
Kp fee4346dc1 Pass canvas to ogl_urect 2016-12-29 03:27:08 +00:00
Kp 290cb6e7c0 Use array<> for ogl_urect float arrays 2016-12-29 03:27:08 +00:00
derhass 551570d29b Unify OpenGL extension handling between OpenGL and OpenGL ES code paths.
Split ogl_get_verinfo() into ogl_tune_for_current() and
ogl_extensions_init(), and consolidate all the OpenGL extension handling
into ogl_extensions.cpp. Unify the code paths for texture anisotropy and
GPU synchronization for OpenGL and OpenGL ES.

Currently, our renderer only uses GLES 1.0, so no real world implementation
will support sync objects for such an old context, but the logic is valid,
and this way, the GLES specific code paths are reduced.

This patch also fixes an issue where the old ogl_get_verinfo() did modify
the texture filtering mode if no anisotropic filter was available. This
was some leftover from the time when the anisotropic filter was a just
a specific CGameConfig.TexFilt mode, and not a separate, orthogonal setting
CGameCfg.TexAnisotropy that it is now.
2016-11-03 21:59:11 +01:00
Kp 52667fae6c Merge branch derhass/patches/ogles-warning-cleanup
derhass reports that OpenGL ES builds warn for unused parameter
`texanis`.  This parameter controls a feature that is not available in
current Rebirth OpenGL ES builds.  Cast the parameter to void to silence
the warning.  Long term, the code ought to be changed to advise the user
when their platform lacks this feature.  In the short term, merge this
fix so that the build will succeed.

https://github.com/dxx-rebirth/dxx-rebirth/pull/256
2016-10-30 18:30:48 +00:00