Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize Renderer #527

Merged
merged 29 commits into from
Aug 20, 2024
Merged

Conversation

tophyr
Copy link
Contributor

@tophyr tophyr commented Aug 13, 2024

Pull Request Type

  • GitHub Workflow changes
  • Documentation or Wiki changes
  • Build and Dependency changes
  • Runtime changes
    • Render changes
    • Audio changes
    • Input changes
    • Network changes
    • Other changes

Description

Modernize the Descent 3 renderer to use OpenGL 3 (GLES 3, eventually) and shaders. A major caveat here is that this is a minimal modernization of just the OpenGL calls. Performance should be at least as good, but I am not by any means promising that the renderer is now "well-designed". It just now works using non-immediate-mode and non-fixed-function concepts.

Rendering behavior should be identical! Any difference should be considered a bug, unless discussed, determined to be acceptable, and specifically called out here.

Known Issues

None

Related Issues

@tophyr tophyr mentioned this pull request Aug 13, 2024
9 tasks
@tophyr tophyr force-pushed the pr/modernize-renderer branch 3 times, most recently from ada33f1 to 81b450d Compare August 13, 2024 05:49
Copy link
Collaborator

@winterheart winterheart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some quick non-related to functionality request changes.

renderer/CMakeLists.txt Outdated Show resolved Hide resolved
renderer/ShaderProgram.h Outdated Show resolved Hide resolved
renderer/shaders.cmake Outdated Show resolved Hide resolved
renderer/shaders/fragment.glsl Outdated Show resolved Hide resolved
renderer/shaders/vertex.glsl Outdated Show resolved Hide resolved
renderer/dyna_gl.h Outdated Show resolved Hide resolved
@winterheart
Copy link
Collaborator

On Linux I got runtime error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  invalid enum
SIGNAL 6 caught, aborting

@tophyr
Copy link
Contributor Author

tophyr commented Aug 13, 2024

On Linux I got runtime error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  invalid enum
SIGNAL 6 caught, aborting

interesting. run it under a debugger and it should give you a stack trace of the failing call. some GL call is failing with INVALID_ENUM.

@winterheart
Copy link
Collaborator

Thread 1 (Thread 0x7ffff7082540 (LWP 11664) "Descent3"):
#0  CheckError () at /home/winterheart/playground/Descent3/renderer/dyna_gl.h:49
        _dglGetError = 0x7ffff19df5a0
        err = 1280
#1  0x000055555587c34c in FnPtr<unsigned char const* (unsigned int)>::operator()(unsigned int) const (this=0x5555565f7658 <dglGetString>, args#0=7939) at /home/winterheart/playground/Descent3/renderer/dyna_gl.h:75
        ret = 0x0
#2  0x0000555555870da2 in opengl_GetInformation () at /home/winterheart/playground/Descent3/renderer/HardwareOpenGL.cpp:242
No locals.
#3  0x0000555555872110 in opengl_Init (app=0x7fffffffd400, pref_state=0x555555a08160 <Render_preferred_state>) at /home/winterheart/playground/Descent3/renderer/HardwareOpenGL.cpp:588
        width = 640
        height = 480
        retval = 1
        i = 0
        windowX = 0
        windowY = 0
        __FUNCTION__ = {111 'o', 112 'p', 101 'e', 110 'n', 103 'g', 108 'l', 95 '_', 73 'I', 110 'n', 105 'i', 116 't', 0 '\000'}
#4  0x0000555555874676 in rend_Init (state=RENDERER_OPENGL, app=0x7fffffffd400, pref_state=0x555555a08160 <Render_preferred_state>) at /home/winterheart/playground/Descent3/renderer/HardwareOpenGL.cpp:1302
        retval = 0
        flags = 15360
#5  0x00005555555f3f16 in SetScreenMode (sm=2, force_res_change=false) at /home/winterheart/playground/Descent3/Descent3/game.cpp:970
        scr_width = 640
        scr_height = 480
        scr_bitdepth = 32
        old_sm = 0
        rend_width = 0
        rend_height = 0
        rs = {initted = 116 't', cur_bilinear_state = 10 '\n', cur_zbuffer_state = -103 '\231', cur_texture_type = 21845, cur_color_model = (unknown: 0xffffd1e0), cur_light_state = 32767, cur_alpha_type = -16 '\360', cur_wrap_type = (WT_CLAMP | WT_WRAP_V | unknown: 0x7ffc), cur_alpha = 1431942794, cur_color = 21845, cur_texture_quality = -16 '\360', clip_x1 = 32767, clip_x2 = 1435216648, clip_y1 = 21845, clip_y2 = -140061248, screen_width = 32767, screen_height = -311065088}
#6  0x00005555555e46e1 in Descent3 () at /home/winterheart/playground/Descent3/Descent3/descent.cpp:483
        proxyarg = 0
        type = 1
#7  0x00005555557842a7 in oeD3LnxApp::run (this=0x7fffffffd400) at /home/winterheart/playground/Descent3/Descent3/sdlmain.cpp:164
No locals.
#8  0x0000555555783720 in main (argc=5, argv=0x7fffffffd5d8) at /home/winterheart/playground/Descent3/Descent3/sdlmain.cpp:365
        d3 = {<oeLnxApplication> = {<oeApplication> = {_vptr.oeApplication = 0x555555958ea0 <vtable for oeD3LnxApp+16>, m_AppActive = true}, m_WasCreated = false, m_DeferFunc = 0x5555555e4e22 <D3DeferHandler(bool)>, static os_initialized = false, static first_time = true, m_Flags = 15360, m_X = 0, m_Y = 0, m_W = 640, m_H = 480}, shutdown = false, final_shutdown = false, old_screen_mode = 0}
        dbase = {<oeLnxAppDatabase> = {<oeAppDatabase> = {_vptr.oeAppDatabase = 0x555555958e40 <vtable for oeD3LnxDatabase+16>}, database = 0x5555567078a0}, <No data fields>}
        flags = 15360
        run_d3 = true
        __PRETTY_FUNCTION__ = {105 'i', 110 'n', 116 't', 32 ' ', 109 'm', 97 'a', 105 'i', 110 'n', 40 '(', 105 'i', 110 'n', 116 't', 44 ',', 32 ' ', 99 'c', 104 'h', 97 'a', 114 'r', 42 '*', 42 '*', 41 ')', 0 '\000'}
        defaultLogger = 0x555556698500
        rc = 0
        winArg = 2
        fsArg = 0
#9  0x00007ffff78ce330 in ?? () from /usr/lib64/libc.so.6
No symbol table info available.
#10 0x00007ffff78ce3e9 in __libc_start_main () from /usr/lib64/libc.so.6
No symbol table info available.
#11 0x0000555555579a65 in _start ()
No symbol table info available.

@tophyr tophyr force-pushed the pr/modernize-renderer branch from 81b450d to 52305a9 Compare August 13, 2024 07:20
@tophyr
Copy link
Contributor Author

tophyr commented Aug 13, 2024

Force-push to address @winterheart feedback

@tophyr
Copy link
Contributor Author

tophyr commented Aug 13, 2024

Aha, interesting, the mprintf() call on that line is no-op'ed on my build for some reason. I'll force it to execute that and adjust

edit: ah, i'm not building with LOGGER=ON

@tophyr tophyr force-pushed the pr/modernize-renderer branch from 52305a9 to 16cc66d Compare August 13, 2024 07:30
@tophyr
Copy link
Contributor Author

tophyr commented Aug 13, 2024

On Linux I got runtime error:

terminate called after throwing an instance of 'std::runtime_error'
  what():  invalid enum
SIGNAL 6 caught, aborting

Fixed

@tophyr tophyr requested a review from winterheart August 14, 2024 15:40
@winterheart winterheart added this to the 1.6 milestone Aug 15, 2024
Copy link
Collaborator

@winterheart winterheart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR is ready to merge, let's merge it after 1.5 release.

@winterheart
Copy link
Collaborator

Please resolve conflicts on files and we ready to set.

@Lgt2x Lgt2x mentioned this pull request Aug 18, 2024
13 tasks
@tophyr tophyr force-pushed the pr/modernize-renderer branch from e455ed5 to 8bd1b67 Compare August 19, 2024 06:00
@tophyr
Copy link
Contributor Author

tophyr commented Aug 19, 2024

Rebased onto latest main

@winterheart
Copy link
Collaborator

Retested on Linux, no visible issues found.

@winterheart winterheart merged commit 1026a6e into DescentDevelopers:main Aug 20, 2024
10 checks passed
@tophyr tophyr deleted the pr/modernize-renderer branch September 2, 2024 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants