i’ve been using the D3DX11CompileFromFile function to compile and create ID3D11VertexShader * and ID3D11PixelShader * from the blob pointer after, like so:
ID3D10Blob * vertexShaderBuffer;
ID3D10Blob * errorMessage;
if(FAILED(D3DX11CompileFromFile(vsFilename.c_str(), NULL, NULL, "LightVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL, &vertexShaderBuffer, &errorMessage, NULL)))
return false;
if(FAILED(device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader)))
return false;
where vsFilename is a valid std::string and m_vertexShader is an ID3D11ShaderVertex *. i’m curious what the fourth parameter is for? Where is it used, when would i use it, what does it do? does it matter what it is? I ask, because with where i call it in my code, i don’t want the user to have to specify it if it has no other purpose than being unique.
It’s a name of your vertex shader function in file
For example, if you have same code in shader file
With function call like D3DX11CompileFromFile(shaderFileName.c_str(), nullptr, nullptr, “VS”, …); you explain to DirectX which function from shader file starts work with vertex shader