예제 #1
0
void TOutputVulkanGLSL::writeQualifier(TQualifier qualifier,
                                       const TType &type,
                                       const TSymbol *symbol)
{
    if (qualifier != EvqUniform && qualifier != EvqAttribute && qualifier != EvqVertexIn &&
        !sh::IsVarying(qualifier))
    {
        TOutputGLSLBase::writeQualifier(qualifier, type, symbol);
        return;
    }

    if (symbol == nullptr)
    {
        return;
    }

    ImmutableString name = symbol->name();

    // For interface blocks, use the block name instead.  When the qualifier is being replaced in
    // the backend, that would be the name that's available.
    if (type.isInterfaceBlock())
    {
        name = type.getInterfaceBlock()->name();
    }

    TInfoSinkBase &out = objSink();
    out << "@@ QUALIFIER-" << name.data() << " @@ ";
}
예제 #2
0
ImmutableString ImageFunctionHLSL::ImageFunction::name() const
{
    static const ImmutableString kGlImageName("gl_image");

    ImmutableString suffix(nullptr);
    if (readonly)
    {
        suffix = ImmutableString(TextureTypeSuffix(image, imageInternalFormat));
    }
    else
    {
        suffix = ImmutableString(RWTextureTypeSuffix(image, imageInternalFormat));
    }

    ImmutableStringBuilder name(kGlImageName.length() + suffix.length() + 5u);

    name << kGlImageName << suffix;

    switch (method)
    {
        case Method::SIZE:
            name << "Size";
            break;
        case Method::LOAD:
            name << "Load";
            break;
        case Method::STORE:
            name << "Store";
            break;
        default:
            UNREACHABLE();
    }

    return name;
}
예제 #3
0
파일: UtilsHLSL.cpp 프로젝트: null77/angle
TString Decorate(const ImmutableString &string)
{
    if (!string.beginsWith("gl_"))
    {
        return "_" + TString(string.data());
    }

    return TString(string.data());
}
예제 #4
0
// static
ImmutableString ImageFunctionHLSL::GetImageReference(
    TInfoSinkBase &out,
    const ImageFunctionHLSL::ImageFunction &imageFunction)
{
    static const ImmutableString kImageIndexStr("[index]");
    if (imageFunction.readonly)
    {
        static const ImmutableString kReadonlyImagesStr("readonlyImages");
        ImmutableString suffix(
            TextureGroupSuffix(imageFunction.image, imageFunction.imageInternalFormat));
        out << "    const uint index = imageIndex - readonlyImageIndexOffset" << suffix.data()
            << ";\n";
        ImmutableStringBuilder imageRefBuilder(kReadonlyImagesStr.length() + suffix.length() +
                                               kImageIndexStr.length());
        imageRefBuilder << kReadonlyImagesStr << suffix << kImageIndexStr;
        return imageRefBuilder;
    }
    else
    {
        static const ImmutableString kImagesStr("images");
        ImmutableString suffix(
            RWTextureGroupSuffix(imageFunction.image, imageFunction.imageInternalFormat));
        out << "    const uint index = imageIndex - imageIndexOffset" << suffix.data() << ";\n";
        ImmutableStringBuilder imageRefBuilder(kImagesStr.length() + suffix.length() +
                                               kImageIndexStr.length());
        imageRefBuilder << kImagesStr << suffix << kImageIndexStr;
        return imageRefBuilder;
    }
}
예제 #5
0
파일: UtilsHLSL.cpp 프로젝트: null77/angle
TString DecorateField(const ImmutableString &string, const TStructure &structure)
{
    if (structure.symbolType() != SymbolType::BuiltIn)
    {
        return Decorate(string);
    }

    return TString(string.data());
}
예제 #6
0
파일: UtilsHLSL.cpp 프로젝트: null77/angle
TString DecoratePrivate(const ImmutableString &privateText)
{
    return "dx_" + TString(privateText.data());
}