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

fix: implicit truncation of vector type shader warning #2242

Merged
merged 1 commit into from May 18, 2024

Conversation

Basewq
Copy link
Contributor

@Basewq Basewq commented May 12, 2024

PR Details

Explicitly declare the data components used in the modulo operator & the data conversion to take place (ie. float modulo and convert to int2 data type).

Description

See above.

Related Issue

Using material Transparency -> Dithered Shadows (enabled by default) on a model would trigger "implicit truncation of vector type" warning at run-time.
Feature was introduced in #1256

Motivation and Context

streams.ShadingPosition is float4 data type. The original code would do a float modulo operation returning a float4 and implicit convert to int2. This would trigger a warning due to zw components being dropped.
While the explicit int2(...) is probably not needed, it's better to spell it out that we're not the same data type.

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.

Full disclosure: I did not build/run the editor. I tested the original line & modified line on a local project with a custom shader. The original line triggered the warning on the project, and the modified line did not trigger the warning - the app did not crash.

…arning and be more explicit on the data conversion being done
@Eideren
Copy link
Collaborator

Eideren commented May 18, 2024

Thanks a bunch for fixing my stuff @Basewq !

@Eideren Eideren merged commit f2a97be into stride3d:master May 18, 2024
2 checks passed
@Eideren Eideren changed the title Fix implicit truncation of vector type shader warning fix: implicit truncation of vector type shader warning May 18, 2024
@Basewq Basewq deleted the shader_warning_fix branch May 21, 2024 12:46
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.

None yet

2 participants