diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index 63c16e6d23..2f3eae0c59 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -38,6 +38,10 @@ namespace Slang bool isUniformParameterType(Type* type); + /// Create a new component type based on `inComponentType`, but with all its requiremetns filled. + RefPtr fillRequirements( + ComponentType* inComponentType); + Type* checkProperType( Linkage* linkage, TypeExp typeExp, diff --git a/source/slang/slang-compiler-tu.cpp b/source/slang/slang-compiler-tu.cpp index 8ae06a419a..49595117d8 100644 --- a/source/slang/slang-compiler-tu.cpp +++ b/source/slang/slang-compiler-tu.cpp @@ -6,6 +6,7 @@ #include "slang-ir-insts.h" #include "slang-ir-util.h" #include "slang-capability.h" +#include "slang-check-impl.h" namespace Slang { @@ -117,6 +118,8 @@ namespace Slang linkage, allComponentTypes); + composite = fillRequirements(composite); + TargetProgram tp(composite, targetReq); tp.getOrCreateLayout(&sink); Slang::Index const entryPointCount = m_entryPoints.getCount(); diff --git a/tests/library/precompiled-glsl.slang b/tests/library/precompiled-glsl.slang new file mode 100644 index 0000000000..f8a8ae58e7 --- /dev/null +++ b/tests/library/precompiled-glsl.slang @@ -0,0 +1,30 @@ +// precompiled-glsl.slang + +// A test that precompiles a slang-module using GLSL functions. + +//TEST:COMPILE: tests/library/precompiled-glsl.slang -target spirv -stage fragment -entry main +//TEST:COMPILE: tests/library/precompiled-glsl.slang -target spirv -stage fragment -entry main -embed-downstream-ir + +#version 310 es +precision highp float; +precision highp int; + +public vec3 func(vec3 v) +{ + return v; +} + +layout(location = 0) out mediump vec4 dEQP_FragColor; + +layout(location = 0) flat in uint out0; +layout(binding = 0, std140) uniform Reference +{ + uint out0; +} ref; + +void main() +{ + dEQP_FragColor = mix(vec4(0.0, 1.0, 0.0, 1.0), + vec4(0.0, 1.0, 0.0, 1.0), + vec4(0.0, 1.0, 0.0, 1.0)); +}