When I try to compile two HLSL files included in my project, the compilation fails with an error:
Error error X4502: invalid vs_2_0 input semantic 'INSTANCE'
However, I notice it's trying to use shader model 2.0; when I'm trying to use 5.0:
Why is the shader compiler trying to use the 2.0 model when I've told VS to use 5.0? Or have I misunderstood?
All you need to do is set the "Shader Type" attribute to the correct type of shader you're trying to compile. Then the issue should go away.
Related
I am learning DirectX11 but can't get around this problem when compiling the project:
Error 1 error MSB6006: "fxc.exe" exited with code 1. C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets 1126 5 DirectX
I am using Visual Studio 2013, DirectX 11, and the Effects framework.
I've searched the internet and did every single thing that they suggested such as properly setting the HLSL Compiler with fx as shader type and 5_0 as shader model. The include, lib and bin directories are properly set. There is a question on the topic here but it's not answered properly so I figured someone could explain how to overcome it now.
Thank you in advance.
You should configure HLSL file correctly. It means shader model(3.0, 4.0, 5.0), shader types(PS, VS, GS, or general just FX(with entry point if u got it) ....). fxc.exe is HLSL compiler which compiles your shader code, but it seems entire compiler is not targeted on right shader file(s). As well error says to you that compiler execution had been exited with result 1 , now you should click on shader(s) file with right mouse button and configure your shader that's it.
Hope this helps.
P.S. Oh and which version of Windows do you use ? because it's matter how would you talking with DirectX SDK ? This is important.
I am trying to test some code that has recently passed into my responsibilities. While the CUDA projects passed onto me work, I can't seem to get a [new Project] inside the VS13 [Solution] to work.
I've created a CUDA 6.5 runtime project. I've also added the dependencies needed for my own code.
Upon compiling, I receive several [error C2061: Syntax error : Identifier 'surface'] or 'texture'.
I'm currently at a loss as to what I am missing. I would guess there is some dependency I need to add to the project, but it is hard to find any relevant resources online when looking for this error message. I've already added "compute_30,sm_30" in the correct place (i.e. the same place as in the projects that compile).
EDIT: Relevant is that the file throwing errors is #included in someClass.h which is included in the main function.
As is pointed out below, the problem is that CUDA-specific files are included in the visual compiler.
As discussed in the cross-posting here, the root cause of this problem is that the code that involves surface and texture keywords is in a .h file that is ultimately being included in a .cpp file
In a VS CUDA project, by default, .cpp files get compiled by cl.exe, the windows host code compiler. .cu files get compiled by nvcc, the NVIDIA GPU compiler/driver.
cl.exe does not understand the surface or texture keywords, and so throws the mentioned syntax errors.
The only solution is to arrange your project such that those constructs only appear in, or get included in, files that will be process by nvcc, which is the compiler that understands surface and texture (and other CUDA) keywords.
For reference, there are various CUDA sample codes (such as this one) that use surface and texture constructs, and also have project code partitioned between .cpp and .cu files. You can study these if you wish for examples of how such projects might be organized.
Recently I want to change my run-time shader compilation into build-time shader compilation by use vs built-in shader compiler (so you could right click on the hlsl file from vs solution explorer, and change the item type to HLSL compiler to use this built-time shader compilation thing, so every time you compile your project, the shader will be compiled, and you only need to load the compiled byte code in runtime). The problem I have is that most of my shaders files need to compiled to multiple versions (different macro define flags), it's very easy to do it during run-time (just compile, change define flag, and compile again), however I can't find any option in vs which allow you to compile the same hlsl file multiple times with different defines.
So I come here and ask you guys for help, suggestions.
Thanks
You can create multiple project configurations, and set up different preprocessor definitions for them in the HLSL Compiler/General settings.
I have a cocos2d-iphone project. When I run the project on simulator I don't get any error. But if I try to profile it I get multiple errors in OpenGl functions found inside CCParticleSystemQuad.m file. To make it clearer I'm posting the snapshot of the error zone.
Here's the link to the image in case you want to see it closely.
Do you have any clues?
offsetof is a macro that resolves to an LLVM compiler builtin function. It's defined in stddef.h, but it's possible your project's headers don't include that file when building for a device.
The CUDA 4.2 SDK example project simpleTexture compiles and runs correctly in vs2008 sp1, but when I attempt to add textures to an ongoing CUDA kernel project, some of the necessary functions to create and use the binding are not recognized:
1>c:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/C/src/rohan/Rohan-kernel.cu(67): error: identifier "channelDesc" is undefined
1>c:/ProgramData/NVIDIA Corporation/NVIDIA GPU Computing SDK 4.2/C/src/rohan/Rohan-kernel.cu(664): error: identifier "tex2d" is undefined
The texture declaration itself seems okay:
texture<cuDoubleComplex, cudaTextureType2D, cudaReadModeElementType> tex;
I have duplicated all of the #includes from simpleTexture, include paths look the same, and the ongoing project uses the supplied template project/solution files customized as directed.
Everything was working well before adding the texture bits, what gives?
Try to compile with the flag -arch sm_20