Using ID3D11ClassLinkage::CreateClassInstance method


I am implementing shader dynamic linking functionality for compute shader. In particular, I am having an interface and a few subclasses without variable members. The shader code is straightforward.

interface MathOperation
    float4 Execute(float4 arg1, float4 arg2);

class MaxOperation : MathOperation
    float4 Execute(float4 arg1, float4 arg2) { return max(arg1, arg2); }

class MinOperation : MathOperation
    float4 Execute(float4 arg1, float4 arg2) { return min(arg1, arg2); }

// Declaring interface varibale in the code. 
// Concrete class instances are not declared.
MathOperation g_Operation;

According to msdn, I have to use ID3D11ClassLinkage::CreateClassInstance method to create concrete class instance. The method requires as the 2nd argument ConstantBufferOffset, that is constant buffer that contains class data. The classes that do not have variable members cannot be put in constant buffer as they are going to be optimized out. Indeed, I have tried to put MathOperation and MinOperation class instances into constant buffer and shader reflection API returns only 1 interface via GetNumInterfaceSlots function.

What is the purpose of this parameter? Has anyone an idea how to use ID3D11ClassLinkage::CreateClassInstance method?

I have not found any example demonstrating that and the sample from DirectX SDK covers the case with member variables only.

Many thanks, indeed.