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

Safer multisample detection #9336

Open
wants to merge 10 commits into
base: v7.x
Choose a base branch
from
Open

Safer multisample detection #9336

wants to merge 10 commits into from

Conversation

dev7355608
Copy link
Collaborator

@dev7355608 dev7355608 commented Apr 4, 2023

Description of change

Should fix #9269.

Number of samples is chosen based on the internal format. Samples above MAX_SAMPLES are filtered out as well as samples that are not valid depth/stencil samples.

Changed the type of GLFramebuffer.multisample to number, because technically it isn't necessarily a value in MSAA_QUALITY.

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 4, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 1008800:

Sandbox Source
pixi.js-sandbox Configuration

@dev7355608
Copy link
Collaborator Author

dev7355608 commented Apr 4, 2023

Before I mark this ready-for-review: Should we change how detectSamples works? If the valid samples are [8, 4] then with MSAA_QUALITY.LOW there's no multisampling. Maybe we should select the minimum of the samples that are greater or equal to the number of requested samples. Then LOW would map to 4 in the the case of [8, 4]. That might make more sense considering that the samples parameter of renderbufferStorageMultisample is just a minimum: the implementation is free choose a higher number of samples than requested.

@dev7355608
Copy link
Collaborator Author

Before I mark this ready-for-review: Should we change how detectSamples works? If the valid samples are [8, 4] then with MSAA_QUALITY.LOW there's no multisampling. Maybe we should select the minimum of the samples that are greater or equal to the number of requested samples. Then LOW would map to 4 in the the case of [8, 4]. That might make more sense considering that the samples parameter of renderbufferStorageMultisample is just a minimum: the implementation is free choose a higher number of samples than requested.

I'll leave this for another PR.

@dev7355608 dev7355608 marked this pull request as ready for review April 10, 2023 20:04
@dev7355608
Copy link
Collaborator Author

I put the Framebuffer.multisample changes in a separate PR (#9390) wondering why I didn't in the first place, but now I recall: without the changes here #9390 does of course nothing, because the samples are detected and set in initFramebuffer. With the changes here the samples are detected in updateFramebuffer, and so it makes sense for Framebuffer.multisample to increase dirtyId.

Copy link
Member

@GoodBoyDigital GoodBoyDigital left a comment

Choose a reason for hiding this comment

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

sorry it took so long to get round to this! all makes sense! one tiny comment. Could we move the logic out to a getMaxSamples() function? - but other than that good to go!

packages/core/src/framebuffer/FramebufferSystem.ts Outdated Show resolved Hide resolved
@Zyie Zyie deleted the branch v7.x March 5, 2024 17:16
@Zyie Zyie closed this Mar 5, 2024
@Zyie Zyie reopened this Mar 5, 2024
@Zyie Zyie changed the base branch from dev to v7.x March 5, 2024 18:07
@Zyie Zyie added the v7 label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Wrong multisample quality detected
3 participants