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

Various GLES state reconstruction fixes #2260

Merged
merged 6 commits into from
Oct 2, 2018

Conversation

pmuetschard
Copy link
Member

Fixes to make the state comparison quieter:

  • Don't compare arenas
  • Don't compare RefIDs
  • Fix the slice comparison to actually work
  • Fix the recreation of programs to use the same IDs as during trace
  • Correctly record what extensions the trace device supported (fixing c++ bool-map default values)
  • Fix handling of resetting the scissor and viewport

@pmuetschard
Copy link
Member Author

pmuetschard commented Oct 1, 2018

Removing the ResetViewportScissor field from the DynamicContextState extra has the following effect, when loading "old" trace files:

  • PreserveBuffersOnSwap becomes true even if it was false during trace time
  • RedSize becomes 0 or 1 depending on the actual PreserveBuffersOnSwap. RedSize is not used anywhere.
  • The remaining color/depth/stencil sizes are "sheared" (e.g GreenSize becomes RedSize, BlueSize becomes GreenSize, etc.). None of them are actually used for anything.

Please advice on what do about this.

if reflect.DeepEqual(oldData, newData) {
return // The pool IDs are different, but the actual data matches exactly.
if l := len(d); l > 1 {
last := d[l-2]
Copy link
Contributor

Choose a reason for hiding this comment

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

How come -2?

Copy link
Member Author

Choose a reason for hiding this comment

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

The last element is the field in the struct that is different (usually the pool id), whereas the penultimate is the actual slice struct itself. I've added a comment.


func init() {
// Don't compare RefIDs.
compare.Register(func(c compare.Comparator, a, b RefID) {
Copy link
Contributor

Choose a reason for hiding this comment

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

No need to change now, but we should probably avoid creating these global comparison functions - I've found they hid differences that you might want to find under different circumstances. The compare package needs a little bit of work to expose this, but we should probably be passing the custom rules down with each compare.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed.

The programs need to reflect the link state, which may be different
than the serialized state. This was done by creating temporary
shaders, link the program, delete the temporaries and attach the ones
from the state. This change simplifies this by:

 - creating the programs before the shaders
 - using the same shader ids for the temporaries as was serialized
 - attaching the shaders to the programs after creating the shaders

This has the benefit of the rebuilt state matching the serialized
state exactly (not just semantically) and no temporary shader IDs
have to be allocated.
`make<bool>(arena)` should return `false` (the zero value), but returns
`true` for any non-null arena, because the template expands to
`bool(arena)`, instead of `bool()` as pointers can be coerced to bools.
This adds the special no-arg case, forcing it to ignore the arena.
`eglMakeCurrent` resets the scissor and viewport box of the
context, but only does so the very first time the context is made
current. We currently were doing it every time the context is made
current. This change moves the detection of whether the reset is
needed from the extras into the API definition. It is impossible
to detect in the spy whether the context was just made current
for the very first time.

Note that the replay's `bindRenderer` now no longer will ever be
asked to reset the viewport because:

  1. For non-MEC replays, we can just rely on the OS's context
     `makeCurrent` call to do it for us (all of them do). This now
     works, because the replay no longer creates dummy surfaces.
  2. For MEC replays, the state reconstruction emits calls to set
     the viewport/scissor to the expected values.
@pmuetschard pmuetschard merged commit 6a3aef5 into google:master Oct 2, 2018
@pmuetschard pmuetschard deleted the compare branch October 2, 2018 20:46
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