Skip to content

[SPIR-V] Add error for casting from vector to scalar#4688

Closed
cassiebeckley wants to merge 1 commit into
microsoft:mainfrom
cassiebeckley:vector-truncation
Closed

[SPIR-V] Add error for casting from vector to scalar#4688
cassiebeckley wants to merge 1 commit into
microsoft:mainfrom
cassiebeckley:vector-truncation

Conversation

@cassiebeckley

Copy link
Copy Markdown
Contributor

Fixes #4640

@cassiebeckley cassiebeckley added the spirv Work related to SPIR-V label Sep 26, 2022

@vettoreldaniele vettoreldaniele left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, but I believe DXIL only outputs a warning and extends the variable with zero values.

Do we want to match DXIL's behavior here?

I also get two errors from this - is it intended?

../tools/clang/test/CodeGenSPIRV/cast.scalar-to-vec.implicit.hlsl:15:7: error: casting from 'float' to 'float3' unsupported
  foo(bar);
      ^
../tools/clang/test/CodeGenSPIRV/cast.scalar-to-vec.implicit.hlsl:15:7: error: casting from 'float3' to 'float' unsupported

@AppVeyorBot

Copy link
Copy Markdown

@vettoreldaniele vettoreldaniele left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also, I just noticed this fix only applies to float. But this behavior seems to be independent of type (see https://shader-playground.timjones.io/f1b2e245672750fae10053e504f16e22 for an example with int).

@s-perron

Copy link
Copy Markdown
Collaborator

#5249 will make this obsolete.

@s-perron s-perron closed this Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spirv Work related to SPIR-V

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal compiler error when targeting spirv

4 participants