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

feat!: Make resource creation be on demand to enable testing [PROPOSAL] #3411

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

luanpotter
Copy link
Member

Description

Make resource creation be on demand to enable testing.

Basically changes how the Resource class work:

  • resources are lazily loaded
  • the Resource class is responsible for re-creating resources when needed
  • children just provide the recreateResource boolean

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

@@ -10,6 +10,8 @@ import 'package:flutter_gpu/gpu.dart' as gpu;
///
/// {@endtemplate}
class ShaderResource extends Resource<gpu.Shader> {
Copy link
Member Author

Choose a reason for hiding this comment

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

with the new Resource design there is no longer a need to separate ShaderResource and Shader for testing purposes

one would be able to create a "Shader" in tests no problem as long as they don't call the .resource getter

if this new pattern is accepted, I can followup with updating this to be simpler as it was before

@luanpotter luanpotter changed the title feat!: Make resource creation be on demand to enable testing feat!: Make resource creation be on demand to enable testing [PROPOSAL] Dec 15, 2024
@luanpotter luanpotter force-pushed the luan.flame-3d-delayed-resources branch from 2447f54 to 4c5f726 Compare December 15, 2024 15:36
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.

1 participant