Skip to content

Commit

Permalink
Merge branch 'master' into rtc-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fp64 committed Mar 22, 2023
2 parents 0584c6f + d87f03f commit 3409dba
Show file tree
Hide file tree
Showing 183 changed files with 29,257 additions and 1,731 deletions.
28 changes: 27 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,10 @@ add_library(Common STATIC
Common/Render/Text/draw_text_uwp.h
Common/System/Display.cpp
Common/System/Display.h
Common/System/System.h
Common/System/NativeApp.h
Common/System/Request.cpp
Common/System/Request.h
Common/Thread/Channel.h
Common/Thread/ParallelLoop.cpp
Common/Thread/ParallelLoop.h
Expand Down Expand Up @@ -1099,6 +1103,28 @@ else()
include_directories(ext/libpng17)
endif()

add_library(basis_universal STATIC
ext/basis_universal/basisu.h
ext/basis_universal/basisu_containers.h
ext/basis_universal/basisu_containers_impl.h
ext/basis_universal/basisu_file_headers.h
ext/basis_universal/basisu_transcoder.cpp
ext/basis_universal/basisu_transcoder.h
ext/basis_universal/basisu_transcoder_internal.h
ext/basis_universal/basisu_transcoder_tables_astc.inc
ext/basis_universal/basisu_transcoder_tables_astc_0_255.inc
ext/basis_universal/basisu_transcoder_tables_atc_55.inc
ext/basis_universal/basisu_transcoder_tables_atc_56.inc
ext/basis_universal/basisu_transcoder_tables_bc7_m5_alpha.inc
ext/basis_universal/basisu_transcoder_tables_bc7_m5_color.inc
ext/basis_universal/basisu_transcoder_tables_dxt1_5.inc
ext/basis_universal/basisu_transcoder_tables_dxt1_6.inc
ext/basis_universal/basisu_transcoder_tables_pvrtc2_45.inc
ext/basis_universal/basisu_transcoder_tables_pvrtc2_alpha_33.inc
ext/basis_universal/basisu_transcoder_uastc.h
)
set(BASISU_LIBRARIES basis_universal)

set(nativeExtra)
set(nativeExtraLibs)

Expand Down Expand Up @@ -1362,7 +1388,7 @@ if(ANDROID OR (LINUX AND ARM_DEVICE) OR (LINUX AND RISCV64))
set(ATOMIC_LIB atomic)
endif()

target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARIES} ${ZLIB_LIBRARY} vma gason udis86 ${RT_LIB} ${nativeExtraLibs} ${ATOMIC_LIB} Common)
target_link_libraries(native ${LIBZIP_LIBRARY} ${PNG_LIBRARIES} ${BASISU_LIBRARIES} ${ZLIB_LIBRARY} vma gason udis86 ${RT_LIB} ${nativeExtraLibs} ${ATOMIC_LIB} Common)
if(TARGET Ext::GLEW)
target_link_libraries(native Ext::GLEW)
endif()
Expand Down
22 changes: 22 additions & 0 deletions Common/Common.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,13 @@
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\ext\basis_universal\basisu.h" />
<ClInclude Include="..\ext\basis_universal\basisu_containers.h" />
<ClInclude Include="..\ext\basis_universal\basisu_containers_impl.h" />
<ClInclude Include="..\ext\basis_universal\basisu_file_headers.h" />
<ClInclude Include="..\ext\basis_universal\basisu_transcoder.h" />
<ClInclude Include="..\ext\basis_universal\basisu_transcoder_internal.h" />
<ClInclude Include="..\ext\basis_universal\basisu_transcoder_uastc.h" />
<ClInclude Include="..\ext\libpng17\png.h" />
<ClInclude Include="..\ext\libpng17\pngconf.h" />
<ClInclude Include="..\ext\libpng17\pngdebug.h" />
Expand Down Expand Up @@ -543,6 +550,7 @@
<ClInclude Include="Swap.h" />
<ClInclude Include="SysError.h" />
<ClInclude Include="System\Display.h" />
<ClInclude Include="System\Request.h" />
<ClInclude Include="System\NativeApp.h" />
<ClInclude Include="System\System.h" />
<ClInclude Include="Thread\Barrier.h" />
Expand Down Expand Up @@ -577,6 +585,7 @@
<ClInclude Include="x64Emitter.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\ext\basis_universal\basisu_transcoder.cpp" />
<ClCompile Include="..\ext\libpng17\png.c">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
Expand Down Expand Up @@ -997,6 +1006,7 @@
<ClCompile Include="OSVersion.cpp" />
<ClCompile Include="StringUtils.cpp" />
<ClCompile Include="System\Display.cpp" />
<ClCompile Include="System\Request.cpp" />
<ClCompile Include="Thread\ParallelLoop.cpp" />
<ClCompile Include="Thread\ThreadManager.cpp" />
<ClCompile Include="Thread\ThreadUtil.cpp" />
Expand Down Expand Up @@ -1034,6 +1044,18 @@
<Project>{f761046e-6c38-4428-a5f1-38391a37bb34}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_astc.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_astc_0_255.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_atc_55.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_atc_56.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_bc7_m5_alpha.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_bc7_m5_color.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_dxt1_5.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_dxt1_6.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_pvrtc2_45.inc" />
<None Include="..\ext\basis_universal\basisu_transcoder_tables_pvrtc2_alpha_33.inc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
65 changes: 65 additions & 0 deletions Common/Common.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,30 @@
<ClInclude Include="Data\Format\DDSLoad.h">
<Filter>Data\Format</Filter>
</ClInclude>
<ClInclude Include="..\ext\basis_universal\basisu.h">
<Filter>ext\basis_universal</Filter>
</ClInclude>
<ClInclude Include="..\ext\basis_universal\basisu_containers.h">
<Filter>ext\basis_universal</Filter>
</ClInclude>
<ClInclude Include="..\ext\basis_universal\basisu_containers_impl.h">
<Filter>ext\basis_universal</Filter>
</ClInclude>
<ClInclude Include="..\ext\basis_universal\basisu_file_headers.h">
<Filter>ext\basis_universal</Filter>
</ClInclude>
<ClInclude Include="..\ext\basis_universal\basisu_transcoder.h">
<Filter>ext\basis_universal</Filter>
</ClInclude>
<ClInclude Include="..\ext\basis_universal\basisu_transcoder_internal.h">
<Filter>ext\basis_universal</Filter>
</ClInclude>
<ClInclude Include="..\ext\basis_universal\basisu_transcoder_uastc.h">
<Filter>ext\basis_universal</Filter>
</ClInclude>
<ClInclude Include="System\Request.h">
<Filter>System</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="ABI.cpp" />
Expand Down Expand Up @@ -896,6 +920,12 @@
<ClCompile Include="Data\Format\DDSLoad.cpp">
<Filter>Data\Format</Filter>
</ClCompile>
<ClCompile Include="..\ext\basis_universal\basisu_transcoder.cpp">
<Filter>ext\basis_universal</Filter>
</ClCompile>
<ClCompile Include="System\Request.cpp">
<Filter>System</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="Crypto">
Expand Down Expand Up @@ -1003,10 +1033,45 @@
<Filter Include="VR">
<UniqueIdentifier>{9d1c29fd-8ac7-4475-8ea6-c8c759b695fe}</UniqueIdentifier>
</Filter>
<Filter Include="ext\basis_universal">
<UniqueIdentifier>{d6d5f6e0-1c72-496b-af11-6d52d5123033}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="..\ext\libpng17\CMakeLists.txt">
<Filter>ext\libpng17</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_astc.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_astc_0_255.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_atc_55.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_atc_56.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_bc7_m5_alpha.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_bc7_m5_color.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_dxt1_5.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_dxt1_6.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_pvrtc2_45.inc">
<Filter>ext\basis_universal</Filter>
</None>
<None Include="..\ext\basis_universal\basisu_transcoder_tables_pvrtc2_alpha_33.inc">
<Filter>ext\basis_universal</Filter>
</None>
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions Common/Data/Format/DDSLoad.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,17 @@ struct DDSLoadInfo {
};

bool DetectDDSParams(const DDSHeader *header, DDSLoadInfo *info);

// We use the Basis library for the actual reading, but before we do, we pre-scan using this, similarly to the png trick.
struct KTXHeader {
uint8_t identifier[12];
uint32_t vkFormat;
uint32_t typeSize;
uint32_t pixelWidth;
uint32_t pixelHeight;
uint32_t pixelDepth;
uint32_t layerCount;
uint32_t faceCount;
uint32_t levelCount;
uint32_t supercompressionScheme;
};
10 changes: 7 additions & 3 deletions Common/File/VFS/ZipFileReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
#include "Common/File/VFS/ZipFileReader.h"
#include "Common/StringUtils.h"

ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath) {
ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath, bool logErrors) {
int error = 0;
zip *zip_file;
if (zipFile.Type() == PathType::CONTENT_URI) {
int fd = File::OpenFD(zipFile, File::OPEN_READ);
if (!fd) {
ERROR_LOG(IO, "Failed to open FD for %s as zip file", zipFile.c_str());
if (logErrors) {
ERROR_LOG(IO, "Failed to open FD for '%s' as zip file", zipFile.c_str());
}
return nullptr;
}
zip_file = zip_fdopen(fd, 0, &error);
Expand All @@ -30,7 +32,9 @@ ZipFileReader *ZipFileReader::Create(const Path &zipFile, const char *inZipPath)
}

if (!zip_file) {
ERROR_LOG(IO, "Failed to open %s as a zip file", zipFile.c_str());
if (logErrors) {
ERROR_LOG(IO, "Failed to open %s as a zip file", zipFile.c_str());
}
return nullptr;
}

Expand Down
2 changes: 1 addition & 1 deletion Common/File/VFS/ZipFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

class ZipFileReader : public VFSBackend {
public:
static ZipFileReader *Create(const Path &zipFile, const char *inZipPath);
static ZipFileReader *Create(const Path &zipFile, const char *inZipPath, bool logErrors = true);
~ZipFileReader();

bool IsValid() const { return zip_file_ != nullptr; }
Expand Down
2 changes: 1 addition & 1 deletion Common/GPU/OpenGL/DataFormatGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ bool Thin3DFormatToGLFormatAndType(DataFormat fmt, GLuint &internalFormat, GLuin
alignment = 16;
break;

#if PPSSPP_PLATFORM(WINDOWS)
#ifndef USING_GLES2
case DataFormat::BC1_RGBA_UNORM_BLOCK:
internalFormat = GL_COMPRESSED_RGB_S3TC_DXT1_EXT;
format = GL_RGB;
Expand Down
4 changes: 1 addition & 3 deletions Common/GPU/OpenGL/GLFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,10 +593,8 @@ bool CheckGLExtensions() {
switch (compressedFormats[i]) {
case GL_COMPRESSED_RGB8_ETC2: gl_extensions.supportsETC2 = true; break;
case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: gl_extensions.supportsASTC = true; break;
#if !PPSSPP_PLATFORM(IOS) && !PPSSPP_PLATFORM(MAC)
#ifndef USING_GLES2
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: gl_extensions.supportsBC123 = true; break;
#endif
#if PPSSPP_PLATFORM(WINDOWS)
case GL_COMPRESSED_RGBA_BPTC_UNORM: gl_extensions.supportsBC7 = true; break;
#endif
}
Expand Down
Loading

0 comments on commit 3409dba

Please sign in to comment.