mirror of https://github.com/mosra/magnum.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
5.9 KiB
111 lines
5.9 KiB
/* |
|
This file is part of Magnum. |
|
|
|
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
|
2020, 2021 Vladimír Vondruš <mosra@centrum.cz> |
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a |
|
copy of this software and associated documentation files (the "Software"), |
|
to deal in the Software without restriction, including without limitation |
|
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
and/or sell copies of the Software, and to permit persons to whom the |
|
Software is furnished to do so, subject to the following conditions: |
|
|
|
The above copyright notice and this permission notice shall be included |
|
in all copies or substantial portions of the Software. |
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
DEALINGS IN THE SOFTWARE. |
|
*/ |
|
|
|
namespace Magnum { |
|
/** @page troubleshooting Troubleshooting |
|
@brief Various tricks to overcome common building and rendering issues. |
|
|
|
@m_footernavigation |
|
|
|
@section troubleshooting-building Building issues |
|
|
|
If your project suddenly stops building after Magnum upgrade, check these |
|
things: |
|
|
|
- If the building fails on CMake step, be sure that you have up-to-date |
|
`FindCorrade.cmake`, `FindMagnum.cmake` and other CMake modules in your |
|
project (`FindSDL2.cmake`). They are contained in `modules/` directory of |
|
Magnum sources (and sources of other projects) also are installed into |
|
`share/cmake/Magnum`. |
|
- In some cases when the changes done to build system are too drastic, |
|
recreating the build dir or clearing CMake cache is needed, but this is |
|
a very rare occasion. |
|
- The library is constantly evolving, thus some API might get deprecated over |
|
time (and later removed). Either build the libraries with `BUILD_DEPRECATED` |
|
or switch to non-deprecated features. See @ref building for more |
|
information. |
|
|
|
@section troubleshooting-rendering Rendering issues |
|
|
|
If you are experiencing the so-called "black screen of death", weird behavior |
|
or crashes on GL calls, you might want to try these things: |
|
|
|
- Enable @ref GL::DebugOutput "debug output" to see more detailed errors, |
|
warnings and performance hints. You can do that easily through the |
|
`--magnum-gpu-validation` @ref GL-Context-usage-command-line "command-line option" |
|
or an environment variable. |
|
- If you are on Mac, the native OpenGL implementation doesn't support |
|
this. Instead you can manually verify that |
|
@ref GL::Renderer::error() "no OpenGL error was emitted". |
|
- Check that you use only extensions that are |
|
@ref GL::Context::isExtensionSupported() "available on your system". |
|
- Check that you didn't exceed any implementation-defined limit (see |
|
@ref magnum-gl-info output for a list of all of them). |
|
- If using framebuffer objects, |
|
@ref GL::Framebuffer::checkStatus() "check that they are complete". |
|
- Rendering to three-component @ref GL::TextureFormat works on some GPUs |
|
but not others. TO avoid platform-dependent issues, always use one-, |
|
two- or four-component formats. |
|
- Change @ref GL::Renderer::setClearColor() "framebuffer clear color" to |
|
something else than black to verify that at least something is drawn. The |
|
engine sets it to @cpp 0x1f1f1f_rgbf @ce by default to help you a bit in |
|
this regard. |
|
- If nothing is drawn, use @ref GL::PrimitiveQuery to check that at least |
|
some primitives were generated. Use @ref GL::SampleQuery to check whether |
|
fragments were drawn. |
|
- Verify that the mesh is properly set up --- nonzero vertex/index count, |
|
matching type in buffer and @ref GL::Mesh::addVertexBuffer() "vertex specification", |
|
properly set up @ref GL::Mesh::setIndexBuffer() "index buffer" and index |
|
count for indexed mesh. If you specified index range, be sure that all |
|
indices fall into it, otherwise you would get undefined behavior. |
|
- Try disabling the @ref GL::Renderer::Feature::DepthTest "depth test", |
|
@ref GL::Renderer::Feature::FaceCulling "face culling" and other renderer |
|
features that might cause fragments to be discarded. |
|
- Verify that your projection and transformation matrix is properly set up |
|
--- try drawing points instead of triangles, to see if they are in proper |
|
places at least. |
|
- For custom shaders you can @ref GL::AbstractShaderProgram::validate() "Validate them". |
|
Check that all used uniforms and attributes have proper locations. Try |
|
reducing it until it is able to draw something, possibly also with some |
|
simpler mesh. |
|
- Magnum tracks the OpenGL state to improve performance, but the tracker can |
|
get confused if you or any other library are doing OpenGL calls outside of |
|
Magnum. For that to work, you need to |
|
@ref opengl-state-tracking "reset the state tracker" on boundaries between |
|
3rd party and Magnum calls into GL. The other library also needs to be |
|
aware of this fact (either setting all state explicitly every time or |
|
having similar ability to reset its state tracker), otherwise you may need |
|
to save and restore GL state manually for that library to work. |
|
|
|
@section troubleshooting-debugging Debugging rendering |
|
|
|
- Use @ref GL::TimeQuery to find hot spots in the rendering code. |
|
- @ref GL::DebugMessage::insert() "Mark relevant parts of code" to find them |
|
easier in the debugger. |
|
- Use ApiTrace or RenderDoc to trace the program call by call, verify buffer |
|
and texture contents, vertex binding and count of generated primitives, |
|
rendered fragments and time spent in various calls. |
|
*/ |
|
}
|
|
|