Skip to content

duplicate output from TSL #32589

@trusktr

Description

@trusktr

Description

Migrated from the forum.

Looks like TSL can output duplicate statements in some case(s).

Reproduction steps

  • open the linked fiddle
  • uncomment either of the .debug lines
  • run the fiddle

Code

I wrote this TSL,

If(diffuseColor.a.mul(alphaFactor).lessThanEqual(0.1337), () => Discard())

and I noticed the output has duplicate discard statements:

	if ( ( ( DiffuseColor.w * nodeVar1 ) <= 0.1337 ) ) {

		discard;
		discard;
		

	}

However if I write this TSL,

diffuseColor.a.mul(alphaFactor).lessThanEqual(0.1337).discard()

then the output is fine:

	if ( ( ( DiffuseColor.w * nodeVar1 ) <= 0.1337 ) ) {

		discard;
		

	}

This example happens to be harmless. Might be worth checking to ensure other less-harmless statements are not duplicated (if they were, maybe someone would have errors already).

Live example

Screenshots

No response

Version

r182

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugTSLThree.js Shading Language

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions