GPUOpen-Effects / FidelityFX-SPD

Single Pass Downsampler (SPD)
https://gpuopen.com/fidelityfx-spd/
MIT License
182 stars 35 forks source link

SpdConstants and SpdLinearSamplerConstants #9

Open sagaceilo opened 1 year ago

sagaceilo commented 1 year ago

I think it would be better to move

        struct SpdConstants
        {
            int mips;
            int numWorkGroupsPerSlice;
            int workGroupOffset[2];
        };

        struct SpdLinearSamplerConstants
        {
            int mips;
            int numWorkGroupsPerSlice;
            int workGroupOffset[2];
            float invInputSize[2];
            float padding[2];
        };

To ffx_spd.h under a A_CPU define. That would make it more convinient of using just

#define A_CPU
#include <fidelityfx/ffx_a.h>
#include <fidelityfx/ffx_spd.h>

In the implementation file. Currently they are hidden in example project file.

jeremyong commented 1 year ago

FWIW, I can see why this remains in the SPD samples. In fact, I would go one step further and suggest that all the CPU code be separated altogether. The SPD constants are bound to be sourced very differently in different engines since you may not need the workgroup offset support, multiple-slice operation, and whatnot. Not to mention that you might want to pack this data along with other data that's persistently mapped in the frame or something (it's not uncommon for framebuffer metadata to be stored somewhere and reused by other postprocessing work). As a final consideration, different renderers/engines have different ways to "glue" data on the host and device.