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: Added support for per frame logical groups in RootEffectRenderFeature #2597

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

johang88
Copy link
Contributor

@johang88 johang88 commented Jan 19, 2025

PR Details

Adds support for logical groups to the per frame resource groups, this allows for easy binding of per frame global resources. It's the same implementation as the per view / draw resource groups.

Sample usage:

// Setup globally available resource group in sdsl
// It then only have to be bound once no matter how which materials use it.
rgroup PerFrame.Test
{
  stage Texture2D GlobalTexture;
}

// Locate all per frame resource layouts that have the logical grou present.
// This is preferably done in SubRenderFeature.Prepare
var logicalGroupKey = ((RootEffectRenderFeature)RootRenderFeature).CreateFrameLogicalGroup("Test");
foreach (var frameLayout in ((RootEffectRenderFeature)RootRenderFeature).FrameLayouts)
{
  var resourceGroup = frameLayout.Entry.Resources;
  var logicalGroup = frameLayout.GetLogicalGroup(logicalGroupKey);
  if (logicalGroup.Hash == ObjectId.Empty) continue;
  
  resourceGroup.DescriptorSet.SetShaderResourceView(logicalGroup.DescriptorEntryStart + 0, GlobalTexture);
}

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@Eideren
Copy link
Collaborator

Eideren commented Feb 1, 2025

I'll add tebjan and Youness to get their input on this

@ykafia
Copy link
Contributor

ykafia commented Feb 2, 2025

LGTM, surprised it wasn't needed before 🤔

@Eideren Eideren merged commit bdabed8 into stride3d:master Feb 3, 2025
6 checks passed
@Eideren
Copy link
Collaborator

Eideren commented Feb 3, 2025

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants