Skip to content
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
6 changes: 3 additions & 3 deletions SPIRV/GlslangToSpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4560,17 +4560,17 @@ spv::Id TGlslangToSpvTraverser::convertGlslangToSpvType(const glslang::TType& ty
{
const glslang::TSampler& sampler = type.getSampler();
if (sampler.isPureSampler()) {
spvType = builder.makeSamplerType();
spvType = builder.makeSamplerType(sampler.getString().c_str());
} else {
// an image is present, make its type
spvType = builder.makeImageType(getSampledType(sampler), TranslateDimensionality(sampler),
sampler.isShadow(), sampler.isArrayed(), sampler.isMultiSample(),
sampler.isImageClass() ? 2 : 1, TranslateImageFormat(type));
sampler.isImageClass() ? 2 : 1, TranslateImageFormat(type), sampler.removeCombined().getString().c_str());
if (sampler.isCombined() &&
(!sampler.isBuffer() || glslangIntermediate->getSpv().spv < glslang::EShTargetSpv_1_6)) {
// Already has both image and sampler, make the combined type. Only combine sampler to
// buffer if before SPIR-V 1.6.
spvType = builder.makeSampledImageType(spvType);
spvType = builder.makeSampledImageType(spvType, sampler.getString().c_str());
}
}
}
Expand Down
22 changes: 6 additions & 16 deletions SPIRV/SpvBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Id Builder::makeBoolType()
return type->getResultId();
}

Id Builder::makeSamplerType()
Id Builder::makeSamplerType(const char* debugName)
{
Instruction* type;
if (groupedTypes[OpTypeSampler].size() == 0) {
Expand All @@ -137,7 +137,7 @@ Id Builder::makeSamplerType()

if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeCompositeDebugType({}, "type.sampler", NonSemanticShaderDebugInfo100Structure, true);
auto const debugResultId = makeCompositeDebugType({}, debugName, NonSemanticShaderDebugInfo100Structure, true);
debugId[type->getResultId()] = debugResultId;
}

Expand Down Expand Up @@ -639,7 +639,7 @@ Id Builder::makeDebugFunctionType(Id returnType, const std::vector<Id>& paramTyp
}

Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, bool ms, unsigned sampled,
ImageFormat format)
ImageFormat format, const char* debugName)
{
assert(sampled == 1 || sampled == 2);

Expand Down Expand Up @@ -720,24 +720,14 @@ Id Builder::makeImageType(Id sampledType, Dim dim, bool depth, bool arrayed, boo

if (emitNonSemanticShaderDebugInfo)
{
auto TypeName = [&dim]() -> char const* {
switch (dim) {
case Dim1D: return "type.1d.image";
case Dim2D: return "type.2d.image";
case Dim3D: return "type.3d.image";
case DimCube: return "type.cube.image";
default: return "type.image";
}
};

auto const debugResultId = makeCompositeDebugType({}, TypeName(), NonSemanticShaderDebugInfo100Class, true);
auto const debugResultId = makeCompositeDebugType({}, debugName, NonSemanticShaderDebugInfo100Class, true);
debugId[type->getResultId()] = debugResultId;
}

return type->getResultId();
}

Id Builder::makeSampledImageType(Id imageType)
Id Builder::makeSampledImageType(Id imageType, const char* debugName)
{
// try to find it
Instruction* type;
Expand All @@ -757,7 +747,7 @@ Id Builder::makeSampledImageType(Id imageType)

if (emitNonSemanticShaderDebugInfo)
{
auto const debugResultId = makeCompositeDebugType({}, "type.sampled.image", NonSemanticShaderDebugInfo100Class, true);
auto const debugResultId = makeCompositeDebugType({}, debugName, NonSemanticShaderDebugInfo100Class, true);
debugId[type->getResultId()] = debugResultId;
}

Expand Down
6 changes: 3 additions & 3 deletions SPIRV/SpvBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ class Builder {
Id makeArrayType(Id element, Id sizeId, int stride); // 0 stride means no stride decoration
Id makeRuntimeArray(Id element);
Id makeFunctionType(Id returnType, const std::vector<Id>& paramTypes);
Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format);
Id makeSamplerType();
Id makeSampledImageType(Id imageType);
Id makeImageType(Id sampledType, Dim, bool depth, bool arrayed, bool ms, unsigned sampled, ImageFormat format, const char* debugNames);
Id makeSamplerType(const char* debugName);
Id makeSampledImageType(Id imageType, const char* debugName);
Id makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id cols, Id use);
Id makeCooperativeMatrixTypeNV(Id component, Id scope, Id rows, Id cols);
Id makeCooperativeMatrixTypeWithSameShape(Id component, Id otherType);
Expand Down
Loading