简体   繁体   English

Visual Studio c ++ 2012和着色器问题

[英]Visual Studio c++ 2012 and shader Questions

I'm using VS c++ 2012 and Directx 10 and have encountered some problems. 我正在使用VS c ++ 2012和Directx 10,并且遇到了一些问题。

I found that in vs 2012, I can add .hlsl files directly and can choose which type of shader to create, such as vertex or pixel shader. 我发现在vs 2012中,我可以直接添加.hlsl文件,并可以选择创建哪种类型的着色器,例如顶点或像素着色器。 But I can only add one type of shader at a time, unlike previously in vs 2010, I could just create and load a .fx file that contains both vertex and pixel shader and the technique. 但是我一次只能添加一种类型的着色器,与之前在vs 2010中不同,我可以创建并加载一个同时包含顶点和像素着色器以及该技术的.fx文件。 With present situation, I can add separate .hlsl files but I have no idea where to put the Technique to. 在目前的情况下,我可以添加单独的.hlsl文件,但是我不知道将该技术放在何处。 Also I noticed that the 2012 version cannot find D3D10CreateEffectFromFile. 我也注意到2012版本找不到D3D10CreateEffectFromFile。 How does Shader work in vs 2012 version? Shader在vs 2012版本中如何工作? If I just want to use a vertex shader and one pixel shader, how can I do that? 如果我只想使用顶点着色器和一个像素着色器,该怎么办?

It is a long time that i don't work with directX, but i think it doesn't depend on visual studio version and even also directX. 很长一段时间我不使用DirectX,但是我认为它不依赖Visual Studio版本,甚至不依赖DirectX。 in DX10 and also DX11 you can create a fx file that contain different types of shaders along with a technique.(but in directx 11 you must include effect class in your project) but in DX11 you can also use hlsl files that i think it can contain all types of shaders, just in compiling you send name and type of your specific shader to DX11 functions and i think in DX11 this approach is prefered way. 在DX10和DX11中,您可以创建一个包含不同类型的着色器以及一种技术的fx文件。(但是在Directx 11中,您必须在项目中包括效果类),但是在DX11中,您还可以使用我认为可以的hlsl文件包含所有类型的着色器,仅在编译时就将名称和特定着色器的类型发送给DX11函数,我认为在DX11中,这种方法是首选方法。 For D3D10CreateEffectFromFile i have no idea but i think you don't include headers correctly. 对于D3D10CreateEffectFromFile我不知道,但我认为您没有正确包含标题。 again i say it is long time that i don't work with DX and my answer can be incorrect. 再次,我说我很长时间不使用DX,我的答案可能不正确。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM