microsoft / DirectXShaderCompiler

This repo hosts the source for the DirectX Shader Compiler which is based on LLVM/Clang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ftime-trace flag is not respected by the `DxcCompiler3` interface

bp-galopin opened this issue · comments

Description

When using the DxcCompiler3 interface. The compilation argument -ftime-trace is ignored and no DXC_OUT_TIME_TRACE will be produced, same with the -ftime-report flag

Additionally, I should say that -ftime-report unconditionally writing to DXC_OUT_ERRORS is unfortunate and it would be nice if we could prevent it in a future release, just like the -ftime-trace=file allow !

In dxccompilerobj.cpp, the trace flag is only handled by the DxcCompilerAdapter::WrapCompile function. It is used internally by DxcCompilerAdapter::CompileWithDebug, DxcCompilerAdapter::Preprocess and DxcCompilerAdapter::Disassemble but calling IDxcCompiler3::Compile get you straight to DxcCompiler::Compile that has no support for it. The current workaround is to demote our user code from using the v3 interface to the v2 interface in order to compile though the internal adapter.

Steps to Reproduce

Instantiate a DxcCompiler3 in code and use the Compile function to compile a shader with one of the provided argument be -ftime-trace. Then try to query the output DXC_OUT_TIME_TRACE out of the DxcResult object, you will receive a INVALID_ARG error

Environment

  • DXC version 2024_03_29 and latest github source
  • Host Operating System Win11