[Solved][UE5.2.1] Error packaging due to IsFeatureLevelSupported

Hello!

When packaging a plugin I’m getting the following error

'IsFeatureLevelSupported': identifier not found

It haven’t happened before

My Build.cs

PrivateDependencyModuleNames.AddRange(
			new string[]
            {
				"Core",
				"CoreUObject",
				"Engine",
				// required for rendering and compositing
				"Projects",
				"RenderCore",
				"RHI",
				"Renderer",
				// required for blueprint
				"Slate",
				"SlateCore"
			}
		);

My .uplugin

	"Modules": [
		{
			"Name": "MyShaderCore",
			"Type": "Runtime",
			"LoadingPhase": "PostConfigInit",
			"PlatformAllowList": [
				"Win64"
			],
			"PlatformDenyList": [
				"IOS",
				"Linux",
				"Android"
			]
		},

My shader .h

#pragma once

#include "GlobalShader.h"
#include "ScreenPass.h"
#include "ShaderParameters.h"
#include "RHIStaticStates.h"
#include "RHIDefinitions.h"

#define NUM_THREADS_XY 8
#define NUM_THREADS_Z 1

class FCopyInputRdgCS : public FGlobalShader
{
public:
	DECLARE_EXPORTED_SHADER_TYPE(FCopyInputRdgCS , Global, HDR10PLUSCORE_API);
	SHADER_USE_PARAMETER_STRUCT(FCopyInputRdgCS , FGlobalShader);

	BEGIN_SHADER_PARAMETER_STRUCT(FParameters, )
		SHADER_PARAMETER_RDG_TEXTURE(Texture2D, InputSceneColor)
		SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<RenderSettings>, RenderSettingsBuffer)
		SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D, OutputSceneColor)
	END_SHADER_PARAMETER_STRUCT()

	static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
	{
		return IsFeatureLevelSupported(Parameters.Platform, ERHIFeatureLevel::SM5);
	}

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

		OutEnvironment.SetDefine(TEXT("THREADS_X"), NUM_THREADS_XY);
		OutEnvironment.SetDefine(TEXT("THREADS_Y"), NUM_THREADS_XY);
		OutEnvironment.SetDefine(TEXT("THREADS_Z"), NUM_THREADS_Z);
	}
};
1 Like

Hi there @EsmeraldaQuinter,

Hope you’re well!

This topic has been moved from International to Programming & Scripting: C++.

When posting, please review the categories to ensure your topic is posted in the most relevant space.

Thanks and happy developing! :slight_smile:

Try include DataDrivenShaderPlatformInfo.h on My shader .h

4 Likes