mstewart248 / Q2RTX-MOD

Quake2 RTX
Other
25 stars 1 forks source link

Missing DLSS parameters, cannot compile. #1

Open RandomDude4 opened 10 months ago

RandomDude4 commented 10 months ago

I cannot compile the code because of 5 errors relatedto missing definitions in the DLSS sdk.

I cloned "https://github.com/NVIDIA/DLSS" and made my own environment variable "DLSS_SDK_PATH" to the folder where put the cloned DLSS files.

But I get 5 errors that some parameters are undeclared, for example 'NVSDK_NGX_Parameter_SuperSamplingDenoising_Available' is not found in "nvsdk_ngx_defs.h" from the DLSS 3.5 SDK. (\src\refresh\vkpt\DLSS.c line:198)

But other parameters such as NVSDK_NGX_Parameter_SuperSampling_Available are declared and found by Visual Studio. This makes me suspect that you are using a different DLSS SDK version than 3.5, or I am missing some other header file where these definitions?

RandomDude4 commented 10 months ago

After a night sleep I suspect that I'm using the public DLSS SDK without Ray Reconstruction. But perhaps the code requires the full early access DLSS SDK?

rajkosto commented 4 months ago

This is still the case with the current available DLSS sdk... Even after adding the defines/functions mentioned here: https://www.reddit.com/r/quake/comments/16fg1by/comment/k4k445b/

I'm getting the following errors:

3>C:\Projects\Q2RTX-MOD\src\refresh\vkpt\DLSS.c(376,79): error C2065: 'NVSDK_NGX_Parameter_DenoiseMode': undeclared identifier
3>C:\Projects\Q2RTX-MOD\src\refresh\vkpt\DLSS.c(386,81): error C2065: 'NVSDK_NGX_Feature_Reserved13': undeclared identifier
3>C:\Projects\Q2RTX-MOD\src\refresh\vkpt\DLSS.c(606,58): error C2065: 'NVSDK_NGX_GBUFFER_BEFORE_PARTICLES': undeclared identifier
3>C:\Projects\Q2RTX-MOD\src\refresh\vkpt\DLSS.c(607,61): error C2065: 'NVSDK_NGX_GBUFFER_BEFORE_TRANSPARENCY': undeclared identifier
3>C:\Projects\Q2RTX-MOD\src\refresh\vkpt\DLSS.c(610,58): error C2065: 'NVSDK_NGX_GBUFFER_REFLECTED_ALBEDO': undeclared identifier

i can guess at the values of the NVSDK_NGXGBUFFER defines, which might be like this ?

    NVSDK_NGX_GBUFFER_BEFORE_PARTICLES = 13,
    NVSDK_NGX_GBUFFER_BEFORE_TRANSPARENCY = 14,
    NVSDK_NGX_GBUFFER_DIFFUSE_LENGTH = 15,
    NVSDK_NGX_GBUFFER_SPECULAR_LENGTH = 16,
    NVSDK_NGX_GBUFFER_REFLECTED_ALBEDO = 17,
    NVSDK_NGX_GBUFFERTYPE_NUM = 18
} NVSDK_NGX_GBufferType;

and mentions of "NVSDK_NGX_Feature_Reserved13" should probably be replaced with its proper name: "NVSDK_NGX_Feature_RayReconstruction" and NVSDK_NGX_Parameter_DenoiseMode should be replaced with the name mentioned in the reddit comment: "NVSDK_NGX_Parameter_DLSS_DenoiseMode"

mstewart248 commented 4 months ago

Hi sorry I haven’t done much with this for a little while. I got Ray reconstruction working and I edited my SDK with definitions to make Ray reconstruction work. I am out and about right now but as soon as I get home I will post the info needed to get this to build.

I was using a version of the SDK from September of 2023 it looks like

Okay Add these in nvsdk_ngx_defs.h

typedef enum NVSDK_NGX_GBufferType
{
    NVSDK_NGX_GBUFFER_ALBEDO = 0,
    NVSDK_NGX_GBUFFER_ROUGHNESS,
    NVSDK_NGX_GBUFFER_METALLIC,
    NVSDK_NGX_GBUFFER_SPECULAR,
    NVSDK_NGX_GBUFFER_SUBSURFACE,
    NVSDK_NGX_GBUFFER_NORMALS,
    NVSDK_NGX_GBUFFER_SHADINGMODELID,  /* unique identifier for drawn object or how the object is drawn */
    NVSDK_NGX_GBUFFER_MATERIALID, /* unique identifier for material */
    NVSDK_NGX_GBUFFER_SPECULAR_ALBEDO,
    NVSDK_NGX_GBUFFER_INDIRECT_ALBEDO,
    NVSDK_NGX_GBUFFER_SPECULAR_MVEC,
    NVSDK_NGX_GBUFFER_DISOCCL_MASK,
    NVSDK_NGX_GBUFFER_EMISSIVE,
    NVSDK_NGX_GBUFFER_BEFORE_PARTICLES,
    NVSDK_NGX_GBUFFER_BEFORE_TRANSPARENCY,
    NVSDK_NGX_GBUFFER_REFLECTED_ALBEDO,
    NVSDK_NGX_GBUFFERTYPE_NUM = 18
} NVSDK_NGX_GBufferType;

In the same file NVSDK_NGX_Feature_Reserved13 = 13 came in the version of the SDK I downloaded I didn't add that.,

typedef enum NVSDK_NGX_Feature
{
    NVSDK_NGX_Feature_Reserved0             = 0,

    NVSDK_NGX_Feature_SuperSampling         = 1,

    NVSDK_NGX_Feature_InPainting            = 2,

    NVSDK_NGX_Feature_ImageSuperResolution  = 3,

    NVSDK_NGX_Feature_SlowMotion            = 4,

    NVSDK_NGX_Feature_VideoSuperResolution  = 5,

    NVSDK_NGX_Feature_Reserved1             = 6,

    NVSDK_NGX_Feature_Reserved2             = 7,

    NVSDK_NGX_Feature_Reserved3             = 8,

    NVSDK_NGX_Feature_ImageSignalProcessing = 9,

    NVSDK_NGX_Feature_DeepResolve           = 10,

    NVSDK_NGX_Feature_FrameGeneration       = 11,

    NVSDK_NGX_Feature_DeepDVC               = 12,

    NVSDK_NGX_Feature_Reserved13             = 13,

    // New features go here
    NVSDK_NGX_Feature_Count,

    // These members are not strictly NGX features, but are 
    // components of the NGX system, and it may sometimes
    // be useful to identify them using the same enum
    NVSDK_NGX_Feature_Reserved_SDK          = 32764,

    NVSDK_NGX_Feature_Reserved_Core         = 32765,

    NVSDK_NGX_Feature_Reserved_Unknown      = 32766
} NVSDK_NGX_Feature;

Also if it's not there add the following to nvsdk_ngx_helpers_vk.h


static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSSDN_EXT(
    VkCommandBuffer InCmdList,
    unsigned int InCreationNodeMask,
    unsigned int InVisibilityNodeMask,
    NVSDK_NGX_Handle** ppOutHandle,
    NVSDK_NGX_Parameter* pInParams,
    NVSDK_NGX_DLDenoise_Create_Params* pInDlssCreateParams)
{
    return NGX_VULKAN_CREATE_DLSSDN_EXT1(NULL, InCmdList, InCreationNodeMask, InVisibilityNodeMask, ppOutHandle, pInParams, pInDlssCreateParams);
}

static inline NVSDK_NGX_Result NGX_VULKAN_CREATE_DLSSDN_EXT1(
    VkDevice InDevice,
    VkCommandBuffer InCmdList,
    unsigned int InCreationNodeMask,
    unsigned int InVisibilityNodeMask,
    NVSDK_NGX_Handle** ppOutHandle,
    NVSDK_NGX_Parameter* pInParams,
    NVSDK_NGX_DLDenoise_Create_Params* pInDlssCreateParams)
{
    NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_CreationNodeMask, InCreationNodeMask);
    NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_VisibilityNodeMask, InVisibilityNodeMask);
    NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Width, pInDlssCreateParams->Feature.InWidth);
    NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_Height, pInDlssCreateParams->Feature.InHeight);
    NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutWidth, pInDlssCreateParams->Feature.InTargetWidth);
    NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_OutHeight, pInDlssCreateParams->Feature.InTargetHeight);
    NVSDK_NGX_Parameter_SetI(pInParams, NVSDK_NGX_Parameter_DLSS_Feature_Create_Flags, pInDlssCreateParams->InFeatureCreateFlags);
    NVSDK_NGX_Parameter_SetUI(pInParams, NVSDK_NGX_Parameter_DLSS_DenoiseMode, 1);

    if (InDevice) return NVSDK_NGX_VULKAN_CreateFeature1(InDevice, InCmdList, NVSDK_NGX_Feature_Reserved13, pInParams, ppOutHandle);
    else return NVSDK_NGX_VULKAN_CreateFeature(InCmdList, NVSDK_NGX_Feature_Reserved13, pInParams, ppOutHandle);

}

Also some values for nvsdk_ngx_defs.h. Some of these might be unnecessary because it was a little bit trial and error to figure out what parameters needed to be there for DLSSDN.

#define NVSDK_NGX_Parameter_SuperSamplingDenoising_Available "SuperSamplingDenoising.Available"
#define NVSDK_NGX_Parameter_DenoiseMode "DenoiseMode"
 #define NVSDK_NGX_Parameter_Denoise "Denoise"
 #define NVSDK_NGX_Parameter_DLSS_DenoiseMode   "DLSS.Denoise.Mode"

Also one more thing you might need some of these gbuffer parameters if you don't have them.

#define NVSDK_NGX_Parameter_GBuffer_Normals "GBuffer.Normals"
#define NVSDK_NGX_Parameter_GBuffer_Albedo "GBuffer.Albedo"
#define NVSDK_NGX_Parameter_GBuffer_Roughness "GBuffer.Roughness"
#define NVSDK_NGX_Parameter_GBuffer_DiffuseAlbedo "GBuffer.DiffuseAlbedo"
#define NVSDK_NGX_Parameter_GBuffer_SpecularAlbedo "GBuffer.SpecularAlbedo"
#define NVSDK_NGX_Parameter_GBuffer_IndirectAlbedo "GBuffer.IndirectAlbedo"
#define NVSDK_NGX_Parameter_GBuffer_SpecularMvec "GBuffer.SpecularMvec"
#define NVSDK_NGX_Parameter_GBuffer_DisocclusionMask "GBuffer.DisocclusionMask"
#define NVSDK_NGX_Parameter_GBuffer_Metallic "GBuffer.Metallic"
#define NVSDK_NGX_Parameter_GBuffer_Specular "GBuffer.Specular"
#define NVSDK_NGX_Parameter_GBuffer_Subsurface "GBuffer.Subsurface"
#define NVSDK_NGX_Parameter_GBuffer_ShadingModelId "GBuffer.ShadingModelId"
#define NVSDK_NGX_Parameter_GBuffer_MaterialId "GBuffer.MaterialId"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_8 "GBuffer.Attrib.8"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_9 "GBuffer.Attrib.9"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_10 "GBuffer.Attrib.10"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_11 "GBuffer.Attrib.11"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_12 "GBuffer.Attrib.12"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_13 "GBuffer.Attrib.13"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_14 "GBuffer.Attrib.14"
#define NVSDK_NGX_Parameter_GBuffer_Atrrib_15 "GBuffer.Attrib.15"

Let me know if you are still having trouble. If I can I will try to help.

ccarmatic commented 2 weeks ago

Hello, I am using the latest DLSS SDK as of this writing, 3.7.10

in nvsdk_ngx_defs.h typedef enum NVSDK_NGX_GBufferType already exists , so I copied and pasted your version over the original

also under typedef enum NVSDK_NGX_Feature , I replaced "NVSDK_NGX_RayReconstruction = 13" with NVSDK_NGX_Feature_Reserved13 = 13,

I added the other changes as per the post above to nvsdk_ngx_defs.h and nvsdk_ngx_helpers_vk.h


if I edit screen.c and change "V_RenderView(waterLevel);" to V_RenderView(); in line 2007, and edit main.c and change "SCR_UpdateScreen(waterLevel);" to SCR_UpdateScreen(); in line 3280, it will build the q2rtx.exe successfully