File 从HLSL中的文件加载纹理

File 从HLSL中的文件加载纹理,file,bitmap,shader,hlsl,File,Bitmap,Shader,Hlsl,我希望(在后处理着色器中)将摄影机输出与纹理混合。有没有加载纹理的方法?差不多 texture mytexture = "file.bmp" sampler2D smp = sampler_state { texture = <mytexture>; ... } texture mytexture=“file.bmp” 采样器2D smp=采样器\ U状态{ 纹理=; ... } 着色器是一个微程序,在gpu上运行。因此,它不能像从磁盘加载纹理这样复杂的事情。正确的方法是通过Di

我希望(在后处理着色器中)将摄影机输出与纹理混合。有没有加载纹理的方法?差不多

texture mytexture = "file.bmp"

sampler2D smp = sampler_state {
texture = <mytexture>;
...
}
texture mytexture=“file.bmp”
采样器2D smp=采样器\ U状态{
纹理=;
...
}

着色器是一个微程序,在gpu上运行。因此,它不能像从磁盘加载纹理这样复杂的事情。正确的方法是通过DirectX Api(例如,
D3DX11CreateTextureFromFile
)从程序中加载纹理,并在着色器中的rendercall处设置此资源以在那里使用它。

您使用哪一版本的Direct3D?11? 也许D3DX11CreateTextureFromFile()适合您。