Skip to content

Ternary expression of sampler2D results in shader_rd.cpp error wrong operand types: no operation ':' exists that takes a left-hand operand of type ' in highp texture2D' and a right operand of type ' in highp texture2D' #103268

Closed
@pbeart

Description

@pbeart

Tested versions

Reproducible in v4.3.stable.official

System information

Godot v4.3.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated Intel(R) Arc(TM) A370M Graphics (Intel Corporation; 32.0.101.6559) - 13th Gen Intel(R) Core(TM) i7-13700H (20 Threads)

Issue description

You can trick the transpiler into letting you create effectively an intermediate variable of type sampler2D using a ternary expression which will cause an error, even though explicit sampler2D variables are not allowed

Steps to reproduce

Use a ternary expression of two sampler2Ds in a shader, for example in texture like:

texture(true ? my_texture : my_texture, uv);

Minimal reproduction project (MRP)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions