https://github.com/shader-slang/slang
Raw File
Tip revision: 768e62f6c7541439e2edc18dad5fb3846d2e05f9 authored by Yong He on 10 October 2022, 22:59:45 UTC
Support multi-level break + single-return conversion + general inline. (#2436)
Tip revision: 768e62f
slang-ir-specialize-function-call.h
// slang-ir-specialize-function-call.h
#pragma once

namespace Slang
{
    struct CodeGenContext;
    struct IRInst;
    struct IRModule;
    struct IRParam;
    class Module;

    class FunctionCallSpecializeCondition
    {
    public:
        virtual bool doesParamWantSpecialization(IRParam* param, IRInst* arg) = 0;

        virtual bool isParamSuitableForSpecialization(IRParam* param, IRInst* arg);
    };


    /// Specialize calls to functions with certain type of parameters.
    ///
    /// For any function that has a specific type of input parameters
    /// this pass will rewrite its call sites that pass suitable arguments
    /// (e.g., direct references to global shader parameters) to instead call
    /// a specialized variant of the function that does not have
    /// those resource parameters (and instead, e.g, refers to the
    /// global shader parameters directly).
    /// Returns true if any changes are made.
    bool specializeFunctionCalls(
        CodeGenContext* codeGenContext,
        IRModule* module,
        FunctionCallSpecializeCondition* condition);
}
back to top