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 precompiled glsl modules #5230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/slang/slang-check-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ComponentType> fillRequirements(
ComponentType* inComponentType);

Type* checkProperType(
Linkage* linkage,
TypeExp typeExp,
Expand Down
3 changes: 3 additions & 0 deletions source/slang/slang-compiler-tu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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();
Expand Down
30 changes: 30 additions & 0 deletions tests/library/precompiled-glsl.slang
Original file line number Diff line number Diff line change
@@ -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));
}
Loading