# Weird PIX behavior with DXC

Recently I've switched from FXC to DXC to compile shader model 6.0. It compiles well without errors (and runs well) but I can't debug shaders because on my netbook PIX says "failed to load PDB file", and on my main laptop PIX can't even start analysis and it shows the error "Timing Data Error".

What am I missing? The compilation generates PDB files (I can see them in the folder with the .exe) but PIX can't find them for some reason. I compile shaders like this:

    // Create compiler and utils.
CComPtr<IDxcUtils> pUtils;
CComPtr<IDxcCompiler3> pCompiler;
DxcCreateInstance(CLSID_DxcUtils, IID_PPV_ARGS(&pUtils));
DxcCreateInstance(CLSID_DxcCompiler, IID_PPV_ARGS(&pCompiler));

// Create default include handler.
CComPtr<IDxcIncludeHandler> pIncludeHandler;
pUtils->CreateDefaultIncludeHandler(&pIncludeHandler);

std::vector<LPCWSTR> vArgs;
vArgs.push_back(L"-E");
vArgs.push_back(L"-T");
vArgs.push_back(DXC_ARG_DEBUG);
vArgs.push_back(DXC_ARG_SKIP_OPTIMIZATIONS);

// Open source file.
CComPtr<IDxcBlobEncoding> pSource = nullptr;
DxcBuffer Source;
Source.Ptr = pSource->GetBufferPointer();
Source.Size = pSource->GetBufferSize();
Source.Encoding = DXC_CP_ACP;

// Compile it with specified arguments.
CComPtr<IDxcResult> pResults;
pCompiler->Compile(
&Source,
vArgs.data(),
vArgs.size(),
pIncludeHandler,
IID_PPV_ARGS(&pResults)
);

// Print errors if present.
CComPtr<IDxcBlobUtf8> pErrors = nullptr;
pResults->GetOutput(DXC_OUT_ERRORS, IID_PPV_ARGS(&pErrors), nullptr);
if (pErrors != nullptr && pErrors->GetStringLength() != 0)
{
OutputDebugStringA(pErrors->GetStringPointer());
}

// Quit if the compilation failed.
HRESULT hrStatus;
pResults->GetStatus(&hrStatus);
if (FAILED(hrStatus))
{
return;
}

{
return;
}

// Save pdb.
CComPtr<IDxcBlob> pPDB = nullptr;
CComPtr<IDxcBlobUtf16> pPDBName = nullptr;
pResults->GetOutput(DXC_OUT_PDB, IID_PPV_ARGS(&pPDB), &pPDBName);
{
FILE* fp = NULL;
_wfopen_s(&fp, pPDBName->GetStringPointer(), L"wb");
fwrite(pPDB->GetBufferPointer(), pPDB->GetBufferSize(), 1, fp);
fclose(fp);
}

• About the PDBs, check in the PIX settings for the PDB search path and make sure it includes the directory where your PDBs are. For the error message - just guessing, but is your laptop one with both discrete and integrated GPUs? You might need to select the correct GPU in PIX to run analysis on (the same one you did the capture on). Otherwise, try using the in-app feedback button to send a bug report; the PIX team at MS might be able to give more insight. Mar 7, 2021 at 18:25
• @NathanReed yep, the PDB search path helped, thanks, I was searching for it in the 'debug' tab for some reason :) About the error, well, I will try this later (I'm not on my laptop right now). Could you post an answer so I can mark it as a solution? Mar 8, 2021 at 17:17