mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
VideoCommon: update shader asset to provide a variant default value
This commit is contained in:
@ -3,45 +3,49 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include <picojson.h>
|
||||
|
||||
#include "Common/EnumFormatter.h"
|
||||
#include "VideoCommon/Assets/CustomAsset.h"
|
||||
|
||||
namespace VideoCommon
|
||||
{
|
||||
struct ShaderProperty
|
||||
{
|
||||
// "SamplerShared" denotes that the sampler
|
||||
// already exists outside of the shader source
|
||||
// (ex: in the Dolphin defined pixel shader)
|
||||
// "Main" is the first entry in a shared sampler array
|
||||
// and "Additional" denotes a subsequent entry
|
||||
// in the array
|
||||
enum class Type
|
||||
struct RGB
|
||||
{
|
||||
Type_Undefined,
|
||||
Type_SamplerArrayShared_Main,
|
||||
Type_SamplerArrayShared_Additional,
|
||||
Type_Sampler2D,
|
||||
Type_SamplerCube,
|
||||
Type_Int,
|
||||
Type_Int2,
|
||||
Type_Int3,
|
||||
Type_Int4,
|
||||
Type_Float,
|
||||
Type_Float2,
|
||||
Type_Float3,
|
||||
Type_Float4,
|
||||
Type_RGB,
|
||||
Type_RGBA,
|
||||
Type_Bool,
|
||||
Type_Max = Type_Bool
|
||||
std::array<float, 3> value;
|
||||
};
|
||||
Type m_type;
|
||||
|
||||
struct RGBA
|
||||
{
|
||||
std::array<float, 4> value;
|
||||
};
|
||||
|
||||
struct Sampler2D
|
||||
{
|
||||
CustomAssetLibrary::AssetID value;
|
||||
};
|
||||
|
||||
struct Sampler2DArray
|
||||
{
|
||||
CustomAssetLibrary::AssetID value;
|
||||
};
|
||||
|
||||
struct SamplerCube
|
||||
{
|
||||
CustomAssetLibrary::AssetID value;
|
||||
};
|
||||
|
||||
using Value = std::variant<s32, std::array<s32, 2>, std::array<s32, 3>, std::array<s32, 4>, float,
|
||||
std::array<float, 2>, std::array<float, 3>, std::array<float, 4>, bool,
|
||||
RGB, RGBA, Sampler2D, Sampler2DArray, SamplerCube>;
|
||||
|
||||
Value m_default;
|
||||
std::string m_description;
|
||||
};
|
||||
struct PixelShaderData
|
||||
@ -66,15 +70,3 @@ private:
|
||||
CustomAssetLibrary::LoadInfo LoadImpl(const CustomAssetLibrary::AssetID& asset_id) override;
|
||||
};
|
||||
} // namespace VideoCommon
|
||||
|
||||
template <>
|
||||
struct fmt::formatter<VideoCommon::ShaderProperty::Type>
|
||||
: EnumFormatter<VideoCommon::ShaderProperty::Type::Type_Max>
|
||||
{
|
||||
constexpr formatter()
|
||||
: EnumFormatter({"Undefined", "DolphinSamplerArray_Main", "DolphinSamplerArray_Additional",
|
||||
"2DSampler", "CubeSampler", "Int", "Int2", "Int3", "Int4", "Float", "Float2",
|
||||
"Float3", "Float4", "RGB", "RGBA", "Bool"})
|
||||
{
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user