Errors in NvAPI header file

Hi,

I think I stumbled upon some errors in nvapi.h.

When a new version of a feature is implemented, a new struct for the parameters is defined if needed, which is named foo_V1, foo_V2 , foo_V3 and so on.
Then a new version macro is defined with #define foo_VER_3 MAKE_NVAPI_VERSION(foo_V3, 3).

On at least 2 features that we we use in our code, these defines seem to be wrong:
#define NVAPI_D3D11_CREATEVERTEXSHADEREX_VER_3 MAKE_NVAPI_VERSION(NvAPI_D3D11_CREATE_VERTEX_SHADER_EX_V2, 3)
#define NVAPI_D3D11_CREATEHULLSHADEREX_VER_2 MAKE_NVAPI_VERSION(NvAPI_D3D11_CREATE_HULL_SHADER_EX_V1, 2)

This looks like a copy & paste error

Since MAKE_NVAPI_VERSION encodes the size of the struct in the version field, the size will not match the actual size of the provided struct.

1 Like