DirectX 11 SDK - Imgui Debug Error

So Im using Visual Studio 2019 and when i debug at x64 it gives no errors what so ever and the program runs fine. However, when i build the solution and try to run the exe, it gives me a debug error as shown in the image.

https://imgur.com/a/nuKdVRI

And obviously im using the Directx 11 SDK with ImGui. the github for it can be found here:

https://github.com/Pindrought/DirectX-11-Engine-VS2017/tree/Tutorial_35

Someone please help me fix this. And i've already tried re-installing all C++ packages, repaired them and restarted my computer multiple times and checked videos out on how to solve them.
If you run it in Release through Visual Studio, what happens?

What happens if you press Retry to debug the application? Do you get a stack trace of where the assert (presumably) is failinG?
Last edited on
1. If i run it as a release it just gives me errors and doesnt work.
2. If i press retry it just closes instantly and does nothing.

here is the error:
error X4502: invalid vs_2_0 output semantic 'SV_TARGET'

and here is the code where the error occurs:

1
2
3
4
5
float4 main(PS_INPUT input) : SV_TARGET
{
    float3 pixelColor = objTexture.Sample(objSamplerState, input.inTexCoord);
    return float4(pixelColor, 1.0f);
}

Last edited on
Oh, for some reason I thought this was a Debug vs. Release thing,

If the issue is running the exe vs. running inside visual studio, it's most likely a working directory issue, i.e. it can't find a file because you're looking at the wrong working directory.

If you do system("cd");, it will print the current working directory. Does that directory match where your expected files are?

If you can't debug it the normal way, the next best thing would be to have print statements in your code, and keep re-running and narrow down the place where the error happens, so you know which part of the code is actually causing the error.

EDIT: Oh, it's the shader program giving you an issue.
I don't know too much about DX shaders.
However, a quick search shows this might help:
https://stackoverflow.com/questions/45422730/error-invalid-vs-2-0-output-semantic
Last edited on
I can debug it normally in visual studio i just cant run the exe itself, lemme see if want u send might help

EDIT: it doesnt work that fix u sent, its for something completely different because im running it as x64 on debug and it works fine its just when i open the solution and run the exe itself it causes this debug error and i have no idea what it means or how to fix it. and i really need to fix it.
Last edited on
are you using "vs_2_0" as the shader module when compiling the pixel shader? maybe try using "ps_2_0", and by the way directx 11 supports vs_5_0 and ps_5_0 so why are you not using it.


try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

ID3D10Blob *pPSBlob = nullptr;
ID3D10Blob *pErrorBlob = nullptr;

DWROD dwShaderFlags = D3DCOMPILE_ENABLE_STRICTNESS;

#ifdef _DEBUG
    dwShaderFlags |= D3DCOMPILE_DEBUG;
#endif

HRESULT hr = D3DCompileFromFile(     // D3DCompiler.h
  L"PixelShader.hlsl",
  nullptr,
  nullptr,
  "main"    // Pixel Shader Entry Point
  "ps_5_0"
  dwShaderFlags,
  0,
  &pPSBlob,
  &pErrorBlob
);

if (FAILED(hr))
{
    // handle error
}
Last edited on
I don't understand anything. I said that i debug at x64 and it works fine, but when i builld the solution and run the .exe it gives me this debug error. I just have this SDK to use ImGui other than that i have no idea how to use this SDK or where i'm meant to place this code or what i'm meant to do, so a step by step would be nice
basically what this line says "error X4502: invalid vs_2_0 output semantic 'SV_TARGET'"
is that you are trying to compile the PixelShader using the vertex shader compiler so you wanna go to your pixel shader compiling code and change vs_2_0 to ps_2_0

contact me on discord (mizoxes#9691), I have a basic Imgui DirectX 11 program that I've recently written and I can share the source code with you if you are interested.
https://imgur.com/QFj0CYA

btw you don't need an SDK to use ImGui all you need is a few cpp and header files that you can get from here https://github.com/ocornut/imgui
Last edited on
Topic archived. No new replies allowed.