Image Based Variable Rate Shading Implementation

So I have been trying to make my own implementation of image based VRS based on this post and I am a little stumped on how to make this work.

I have no knowledge of compute shading so I am unsure how to generate the texture as mentioned by the user here.

This is the code I have so far -
.h

#pragma once

#include "CoreMinimal.h"
#include "RHI.h"
#include "RendererInterface.h"
#include "RenderGraphDefinitions.h"
#include "VariableRateShadingImageManager.h"
#include "Engine/Engine.h"


class  FTextureVRSGenerator : public IVariableRateShadingImageGenerator
{

public:
	virtual ~FTextureVRSGenerator() override {};
	virtual FRDGTextureRef GetImage(FRDGBuilder& GraphBuilder, const FViewInfo& ViewInfo, FVariableRateShadingImageManager::EVRSImageType ImageType) override;
	virtual void PrepareImages(FRDGBuilder& GraphBuilder, const FSceneViewFamily& ViewFamily, const FMinimalSceneTextures& SceneTextures) override;
	virtual bool IsEnabledForView(const FSceneView& View) const override;
	virtual FRDGTextureRef GetDebugImage(FRDGBuilder& GraphBuilder, const FViewInfo& ViewInfo, FVariableRateShadingImageManager::EVRSImageType ImageType) override;

private:
	FRDGTextureRef VRSTexture = nullptr;

	UPROPERTY()
	UTexture2D* VRSTextureResource;
};

.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "TextureVRSGenerator.h"
#include "SystemTextures.h"
#include "GlobalShader.h"
#include "SceneView.h"
#include "UnrealClient.h"
#include "DataDrivenShaderPlatformInfo.h"
#include "SceneTexturesConfig.h"
#include "Runtime/Renderer/Private/SceneRendering.h"
#include "TextureVRSConfig.h"

static TAutoConsoleVariable<int32> CVarTextureVRSEnabled(
    TEXT("r.VRS.TextureVRS"),
    0,
    TEXT("Enable Texturebased VRS\n")
    TEXT(" 0: Disabled (default);\n")
    TEXT(" 1: Enabled\n"),
    ECVF_RenderThreadSafe);

constexpr int32 kComputeGroupSize = FComputeShaderUtils::kGolden2DGroupSize;
constexpr int32 kMaxCombinedSources = 4;

class FComputeVRSTextureGeneration : public FGlobalShader
{
public:
	DECLARE_GLOBAL_SHADER(FComputeVRSTextureGeneration);
	SHADER_USE_PARAMETER_STRUCT(FComputeVRSTextureGeneration, FGlobalShader);

	BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
		SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<uint>, RWInputTexture)
		SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<uint>, RWOutputTexture)
	END_SHADER_PARAMETER_STRUCT()

	static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
	{
		return FDataDrivenShaderPlatformInfo::GetSupportsVariableRateShading(Parameters.Platform);
	}

	static void ModifyCompilationEnvironment(const FGlobalShaderPermutationParameters& Parameters, FShaderCompilerEnvironment& OutEnvironment)
	{
		FGlobalShader::ModifyCompilationEnvironment(Parameters, OutEnvironment);

		// Shading rates:
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_1x1"), VRSSR_1x1);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_1x2"), VRSSR_1x2);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_2x1"), VRSSR_2x1);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_2x2"), VRSSR_2x2);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_2x4"), VRSSR_2x4);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_4x2"), VRSSR_4x2);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_4x4"), VRSSR_4x4);

		OutEnvironment.SetDefine(TEXT("MAX_COMBINED_SOURCES_IN"), kMaxCombinedSources);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_TILE_WIDTH"), GRHIVariableRateShadingImageTileMinWidth);
		OutEnvironment.SetDefine(TEXT("SHADING_RATE_TILE_HEIGHT"), GRHIVariableRateShadingImageTileMinHeight);
		OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZEX"), kComputeGroupSize);
		OutEnvironment.SetDefine(TEXT("THREADGROUP_SIZEY"), kComputeGroupSize);	
    }
};

IMPLEMENT_GLOBAL_SHADER(FComputeVRSTextureGeneration, "/Plugin/TextureVRS/TextureVRSShader.usf", "GenerateShadingRateTexture", SF_Compute);

FRDGTextureRef FTextureVRSGenerator::GetImage(FRDGBuilder& GraphBuilder, const FViewInfo& ViewInfo, FVariableRateShadingImageManager::EVRSImageType ImageType)
{
    if (ImageType == FVariableRateShadingImageManager::EVRSImageType::Disabled)
    {
        return nullptr;
    }

    else
    {
        return VRSTexture;
    }
}

void FTextureVRSGenerator::PrepareImages(FRDGBuilder& GraphBuilder, const FSceneViewFamily& ViewFamily, const FMinimalSceneTextures& SceneTextures)
{
    // In this case, preparation involves ensuring the texture is valid and available in the Render Graph.
    if (!VRSTexture)
    {
        UE_LOG(LogTemp, Warning, TEXT("Preparing VRS images failed. Texture resource is not valid."));
    }
	
    // Create texture to hold shading rate image
    FRDGTextureDesc _Desc = FVariableRateShadingImageManager::GetSRIDesc();

    FRHITexture2D* _RHIInputTexture = VRSTextureResource->GetResource()->TextureRHI;



    FRDGTextureRef _InputRDGTexture = GraphBuilder.RegisterExternalTexture(CreateRenderTarget(_RHIInputTexture, TEXT("VRS_ShadingRateTexture")));

    FRDGTextureRef _ShadingRateTexture = GraphBuilder.CreateTexture(_Desc, TEXT("CustomVRSTexture"));

    FComputeVRSTextureGeneration::FParameters* _PassParameters = GraphBuilder.AllocParameters<FComputeVRSTextureGeneration::FParameters>();
    

    _PassParameters->RWInputTexture = GraphBuilder.CreateUAV(_InputRDGTexture);;
    _PassParameters->RWOutputTexture = GraphBuilder.CreateUAV(_ShadingRateTexture);
}

bool FTextureVRSGenerator::IsEnabledForView(const FSceneView& View) const
{
    return VRSTexture != nullptr && View.bIsViewInfo && CVarTextureVRSEnabled.GetValueOnRenderThread();
}

FRDGTextureRef FTextureVRSGenerator::GetDebugImage(FRDGBuilder& GraphBuilder, const FViewInfo& ViewInfo, FVariableRateShadingImageManager::EVRSImageType ImageType)
{
    return VRSTexture;
}

.h for the developer setting to assign the texture in game.

#pragma once

#include "CoreMinimal.h"
#include "Engine/DeveloperSettings.h"
#include "TextureVRSConfig.generated.h"

/**
 * 
 */
UCLASS(config=Game, defaultconfig, meta=(DisplayName="Texture VRS Settings"))
class TEXTUREVRS_API UTextureVRSConfig : public UDeveloperSettings
{
	GENERATED_BODY()

	UPROPERTY(config, EditAnywhere, Category = Configuration)
	TSoftObjectPtr<UTexture2D> VRSTexture;

	public : UTexture2D* GetVRSTexture()const{return VRSTexture.LoadSynchronous();}
};

I was trying to copy from the foveation code to get things to work but I am really lost how to do the rest now esp when it comes to generating the texture via compute shader (unless some other alternative exists like directly sending the texture in the format).