Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #12166 from iwubcode/cubemap_shader_texture_integr…
…ation

VideoCommon: add cubemap to ShaderAsset and TextureAsset
  • Loading branch information
AdmiralCurtiss committed Sep 12, 2023
2 parents 308a52a + 589834f commit 1a82146
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 4 additions & 0 deletions Source/Core/VideoCommon/Assets/ShaderAsset.cpp
Expand Up @@ -49,6 +49,10 @@ bool ParseShaderProperties(const VideoCommon::CustomAssetLibrary::AssetID& asset
{
property.m_type = ShaderProperty::Type::Type_Sampler2D;
}
else if (type == "samplercube")
{
property.m_type = ShaderProperty::Type::Type_SamplerCube;
}
else if (type == "samplerarrayshared_main")
{
property.m_type = ShaderProperty::Type::Type_SamplerArrayShared_Main;
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/VideoCommon/Assets/ShaderAsset.h
Expand Up @@ -26,7 +26,8 @@ struct ShaderProperty
Type_SamplerArrayShared_Main,
Type_SamplerArrayShared_Additional,
Type_Sampler2D,
Type_Max = Type_Sampler2D
Type_SamplerCube,
Type_Max = Type_SamplerCube
};
Type m_type;
std::string m_description;
Expand Down
14 changes: 9 additions & 5 deletions Source/Core/VideoCommon/Assets/TextureAsset.cpp
Expand Up @@ -136,6 +136,15 @@ bool TextureData::FromJson(const CustomAssetLibrary::AssetID& asset_id,
if (type == "texture2d")
{
data->m_type = TextureData::Type::Type_Texture2D;

if (!ParseSampler(asset_id, json, &data->m_sampler))
{
return false;
}
}
else if (type == "texturecube")
{
data->m_type = TextureData::Type::Type_TextureCube;
}
else
{
Expand All @@ -146,11 +155,6 @@ bool TextureData::FromJson(const CustomAssetLibrary::AssetID& asset_id,
return false;
}

if (!ParseSampler(asset_id, json, &data->m_sampler))
{
return false;
}

return true;
}

Expand Down
3 changes: 2 additions & 1 deletion Source/Core/VideoCommon/Assets/TextureAsset.h
Expand Up @@ -28,7 +28,8 @@ struct TextureData
{
Type_Undefined,
Type_Texture2D,
Type_Max = Type_Texture2D
Type_TextureCube,
Type_Max = Type_TextureCube
};
Type m_type;
CustomTextureData m_data;
Expand Down

0 comments on commit 1a82146

Please sign in to comment.