-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
Rendering fixes #1981
Rendering fixes #1981
Conversation
This PR affect core renderer backend, we need more time to test. |
Sure, there's no rush. On my side I did test on Windows, macOS, Android and iOS. |
Do you run all tests of cpp-tests on macOS, because the macOS metal backend will throw exception if any render state incorrect |
lgtm, merged |
I didn't run all the cpp-tests, because auto test doesn't work (it never worked for me, and always crashed). But I did run some tests related to graphics, and all seemed to work. As well as tested on our game, which has some complex rendering stuff like mixing 2D/3D, using render textures, etc. |
@smilediver do you have any idea? |
Is there an existing test in the cpp-tests project that reproduces this? If not, would it be possible for you to add one, or make available a minimal project that reproduces the issue? @halx99 If this issue is not easily solvable, then would it make sense to revert these changes, and have them in a different branch until they're tested and working correctly? |
agree |
reverting |
I updated https://github.com/solan-solan/HeightMap/commits/smooth_lod_passing to correspond it for [a13c6bf] and [0ea9efd] branches, check it please. By the way Then, if I properly understand, they should be changed for each separate But _flags gets 1 everytime after In other words Besides its never reset COLOR like it supposed that one color attachment would be anyway. I use this workaround now:
|
checked, it's correct, due to the TargetBufferFlags is uint8_t, the debugger display char, it's num value is 49 |
I reset axmol to 42bf253 and build your https://github.com/solan-solan/HeightMap/commits/smooth_lod_passing, and the GL errors occured: |
{ // color attachments | ||
GLenum bufs[MAX_COLOR_ATTCHMENT] = {GL_NONE}; | ||
for (size_t i = 0; i < MAX_COLOR_ATTCHMENT; ++i) | ||
{ | ||
if (bitmask::any(_flags, getMRTColorFlag(i))) | ||
if (_color[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
due to _flags was removed, need update color attachment always
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@solan-solan remove the condition check _color[i]
can solve above GL errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@solan-solan remove the condition check
_color[i]
can solve above GL errors
@halx99 I believe that it helps
I'll have a look at this issue next week. |
I'v rebase and drop the merge commit, and a backup branch was created: https://github.com/axmolengine/axmol/tree/refactor-render-target , you can fork it and continue working on it, then create a new PR |
This PR contains two fixes:
Backend: remove RenderTargetFlag and refactor depth/stencil state setup
First fix removes flags from
RenderTarget
. This fixes the problem where depth and stencil flags inRenderTarget
were desynchronizing from theRenderer
state. And this also fixes the issue where a single GPU render pass unnecessarily was split into several incurring a performance hit, because backends instead of changing depth or stencil state were actually changing render targets.RenderTarget
should only represent a stateless thing being rendered into (a framebuffer or a render texture), so it should be just a collection of color/depth/stencil attachments. For some reason it also contained flags for which of those buffers should be enabled or disabled, but it's duplicating the state already tracked inRenderer
.Renderer
can check what attachments are available in theRenderTarget
and what state is set and provide the combined and exact information for what attachments to enable to the backend.Fix Z-test and Z-write being enabled by default for main queue
Second fix by default disables Z-write and Z-tests for 2D sprites for the main queue, and enables them for 3D models.
This fixes the issue that Z-write and Z-test was enabled by default for 2D sprites only in the main render queue. It causes issues when mixing 2D sprites and 3D models. This is possibly an oversight, because they are enabled only for the main queue, and for
GroupCommand
queues (e.g. render textures) they are disabled. So this makes all render queues behave the same.