Skip to content

Commit

Permalink
Common: Bump stack
Browse files Browse the repository at this point in the history
- .vcpkg/ports: Bump ports
- vcpkg.json: Bump dependencies
- movies.cpp: Adapt code to work with FFMpeg 5+
- cfg.cpp/cfg.h/FFNx.toml: Remove the movie_sync_debug flag, no more required
- CMakeLists.txt: Use the new profile names on shaderc for D3D9/11/12
  • Loading branch information
julianxhokaxhiu committed Feb 5, 2023
1 parent 6b08b39 commit b6bf503
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 71 deletions.
12 changes: 6 additions & 6 deletions .vcpkg/ports/bgfx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
vcpkg_from_github(OUT_SOURCE_PATH BX_SOURCE_DIR
REPO "julianxhokaxhiu/bx"
HEAD_REF master
REF 4ec517ea0bd237e581c12adc6121eeddd7616a24
SHA512 20268e66c2903617a9abac7a71d5922bc7ac3e3ca50e21bb73d72076b4762ba64b3244b37c9e4bd0c6d1539c71be928a1967b2c91e97c430b444c44270f8c8fc
REF 059dbad774a98f180a98df15772440190d367150
SHA512 92ca7ca80db7d870682dfa30a29d14009185779a4bfc2b074b5e22b3d622839f13891817ac4bdbb8dd4e0424de38f2a6ab2ac7dbdb1dfea28ccbe959a6b83c9e
)

vcpkg_from_github(OUT_SOURCE_PATH BIMG_SOURCE_DIR
REPO "julianxhokaxhiu/bimg"
HEAD_REF master
REF 1955d8f99af705fec6e704bfb90615cd7fd79545
SHA512 e71bef8e349712b4341989b0424aac7a90d70590412d260251b786b56d9eca85dbb68276c21feff815b3c68895cf93083c585b08c843b7b403a727bfe5855d62
REF 7afa2419254fd466c013a51bdeb0bee3022619c4
SHA512 514deed00f8bc4106f67b777dca72d0ed0accb1ae057ad37d22a21c83ad3a85ad23d220ac0cf40b6a8006d43c308b1acfad464b51e64075aa01598731a1557df
)

vcpkg_from_github(OUT_SOURCE_PATH SOURCE_DIR
REPO "julianxhokaxhiu/bgfx"
HEAD_REF master
REF 69f236c31bed0cfe69f003fd3faed6aedd4f4da8
SHA512 21e04a0103ff0473b1ecc6d21e2c5a0ec96e15dcc70929a966520e8d47d62308524374d3919dda65acc0b8563bf1ca0618e753b9c01e412fa2b2a850e57daa95
REF 4f608091ae760651a7460ce1528ec7138ee5026f
SHA512 cb8f913902cfbc7ac5bb503cecbb7ac3b821ff188d83e9702eb971300c8c3793a6c9ffb2f4428a46f03d6f0160a636625b6daf1981aae0f27fc5b8d740d9e1e4
)

# Move bx source inside bgfx source tree
Expand Down
8 changes: 4 additions & 4 deletions .vcpkg/ports/bimg/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
vcpkg_from_github(OUT_SOURCE_PATH BX_SOURCE_DIR
REPO "julianxhokaxhiu/bx"
HEAD_REF master
REF 4ec517ea0bd237e581c12adc6121eeddd7616a24
SHA512 20268e66c2903617a9abac7a71d5922bc7ac3e3ca50e21bb73d72076b4762ba64b3244b37c9e4bd0c6d1539c71be928a1967b2c91e97c430b444c44270f8c8fc
REF 059dbad774a98f180a98df15772440190d367150
SHA512 92ca7ca80db7d870682dfa30a29d14009185779a4bfc2b074b5e22b3d622839f13891817ac4bdbb8dd4e0424de38f2a6ab2ac7dbdb1dfea28ccbe959a6b83c9e
)

vcpkg_from_github(OUT_SOURCE_PATH SOURCE_DIR
REPO "julianxhokaxhiu/bimg"
HEAD_REF master
REF 1955d8f99af705fec6e704bfb90615cd7fd79545
SHA512 e71bef8e349712b4341989b0424aac7a90d70590412d260251b786b56d9eca85dbb68276c21feff815b3c68895cf93083c585b08c843b7b403a727bfe5855d62
REF 7afa2419254fd466c013a51bdeb0bee3022619c4
SHA512 514deed00f8bc4106f67b777dca72d0ed0accb1ae057ad37d22a21c83ad3a85ad23d220ac0cf40b6a8006d43c308b1acfad464b51e64075aa01598731a1557df
)

# Move bx source inside bgfx source tree
Expand Down
4 changes: 2 additions & 2 deletions .vcpkg/ports/bx/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(OUT_SOURCE_PATH SOURCE_DIR
REPO "julianxhokaxhiu/bx"
HEAD_REF master
REF 4ec517ea0bd237e581c12adc6121eeddd7616a24
SHA512 20268e66c2903617a9abac7a71d5922bc7ac3e3ca50e21bb73d72076b4762ba64b3244b37c9e4bd0c6d1539c71be928a1967b2c91e97c430b444c44270f8c8fc
REF 059dbad774a98f180a98df15772440190d367150
SHA512 92ca7ca80db7d870682dfa30a29d14009185779a4bfc2b074b5e22b3d622839f13891817ac4bdbb8dd4e0424de38f2a6ab2ac7dbdb1dfea28ccbe959a6b83c9e
)

# Set up GENie (custom project generator)
Expand Down
4 changes: 2 additions & 2 deletions .vcpkg/ports/vgmstream/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO "vgmstream/vgmstream"
HEAD_REF master
REF 49af2cea7d6265a6e063f5d4e09e34df8f861998
SHA512 8cdd22e261b9690508c8d9cdb12b2e2a2a0bd0671819414fb5c56ddb39f4a273163dd344c729cfd36a72829d1f35e97ff6bee91fe3fff25e2f01036bc12536a0
REF 8b0204f3fce845df91adc68e43669f9b660d7c63
SHA512 485313fffc185188a3f24aad1c19c6e70e10d331c50a4019e7b7f00a940e83e4c6b0e30301596a2b69354b52ba20a42bdc7d571bedb2c9f356a5373e38f9f9bb
PATCHES cmake.patch
)

Expand Down
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -201,29 +201,29 @@ foreach(FFNX_SHADER IN LISTS FFNX_SHADERS)
COMMAND
${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/tools/bgfx/shadercRelease -i ${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/include -f ${CMAKE_SOURCE_DIR}/misc/${FFNX_SHADER}.frag -o
${CMAKE_BINARY_DIR}/bin/shaders/${FFNX_SHADER}.${BGFX_VARYING}.d3d9.frag --type f --varyingdef
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p ps_3_0 -O 3
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p s_3_0 -O 3
COMMAND
${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/tools/bgfx/shadercRelease -i ${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/include -f ${CMAKE_SOURCE_DIR}/misc/${FFNX_SHADER}.vert -o
${CMAKE_BINARY_DIR}/bin/shaders/${FFNX_SHADER}.${BGFX_VARYING}.d3d9.vert --type v --varyingdef
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p vs_3_0 -O 3
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p s_3_0 -O 3
# Direct3D 11
COMMAND
${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/tools/bgfx/shadercRelease -i ${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/include -f ${CMAKE_SOURCE_DIR}/misc/${FFNX_SHADER}.frag -o
${CMAKE_BINARY_DIR}/bin/shaders/${FFNX_SHADER}.${BGFX_VARYING}.d3d11.frag --type f --varyingdef
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p ps_5_0 -O 3
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p s_5_0 -O 3
COMMAND
${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/tools/bgfx/shadercRelease -i ${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/include -f ${CMAKE_SOURCE_DIR}/misc/${FFNX_SHADER}.vert -o
${CMAKE_BINARY_DIR}/bin/shaders/${FFNX_SHADER}.${BGFX_VARYING}.d3d11.vert --type v --varyingdef
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p vs_5_0 -O 3
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p s_5_0 -O 3
# Direct3D 12
COMMAND
${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/tools/bgfx/shadercRelease -i ${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/include -f ${CMAKE_SOURCE_DIR}/misc/${FFNX_SHADER}.frag -o
${CMAKE_BINARY_DIR}/bin/shaders/${FFNX_SHADER}.${BGFX_VARYING}.d3d12.frag --type f --varyingdef
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p ps_5_0 -O 3
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p s_5_0 -O 3
COMMAND
${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/tools/bgfx/shadercRelease -i ${CMAKE_BINARY_DIR}/vcpkg_installed/x86-windows-static/include -f ${CMAKE_SOURCE_DIR}/misc/${FFNX_SHADER}.vert -o
${CMAKE_BINARY_DIR}/bin/shaders/${FFNX_SHADER}.${BGFX_VARYING}.d3d12.vert --type v --varyingdef
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p vs_5_0 -O 3)
${CMAKE_SOURCE_DIR}/misc/${RELEASE_NAME}.varying.${BGFX_VARYING}.def.sc --platform windows -p s_5_0 -O 3)
endforeach()
endforeach()

Expand Down
4 changes: 0 additions & 4 deletions misc/FFNx.toml
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,6 @@ vertex_log = false
#~~~~~~~~~~~~~~~~~~~~~~~~~~~
uniform_log = false

# Show debug info regarding movie synchronization.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~
movie_sync_debug = false

###############################################################################
# OPTIONS ONLY FOR FF7
###############################################################################
Expand Down
2 changes: 0 additions & 2 deletions src/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ bool ff8_ssigpu_debug;
bool show_applog;
bool show_missing_textures;
bool show_error_popup;
bool movie_sync_debug;
long renderer_backend;
bool renderer_debug;
bool create_crash_dump;
Expand Down Expand Up @@ -238,7 +237,6 @@ void read_cfg()
show_applog = config["show_applog"].value_or(true);
show_missing_textures = config["show_missing_textures"].value_or(false);
show_error_popup = config["show_error_popup"].value_or(false);
movie_sync_debug = config["movie_sync_debug"].value_or(false);
renderer_backend = config["renderer_backend"].value_or(RENDERER_BACKEND_AUTO);
renderer_debug = config["renderer_debug"].value_or(false);
create_crash_dump = config["create_crash_dump"].value_or(false);
Expand Down
1 change: 0 additions & 1 deletion src/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ extern bool ff8_ssigpu_debug;
extern bool show_applog;
extern bool show_missing_textures;
extern bool show_error_popup;
extern bool movie_sync_debug;
extern long renderer_backend;
extern bool renderer_debug;
extern bool create_crash_dump;
Expand Down
52 changes: 20 additions & 32 deletions src/video/movies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ uint32_t audio_must_be_converted = false;

AVFormatContext *format_ctx = 0;
AVCodecContext *codec_ctx = 0;
AVCodec *codec = 0;
const AVCodec *codec = 0;
AVCodecContext *acodec_ctx = 0;
AVCodec *acodec = 0;
const AVCodec *acodec = 0;
AVFrame *movie_frame = 0;
struct SwsContext *sws_ctx = 0;
SwrContext* swr_ctx = NULL;
Expand Down Expand Up @@ -77,8 +77,8 @@ void ffmpeg_release_movie_objects()
uint32_t i;

if (movie_frame) av_frame_free(&movie_frame);
if (codec_ctx) avcodec_close(codec_ctx);
if (acodec_ctx) avcodec_close(acodec_ctx);
if (codec_ctx) avcodec_free_context(&codec_ctx);
if (acodec_ctx) avcodec_free_context(&acodec_ctx);
if (format_ctx) avformat_close_input(&format_ctx);
if (swr_ctx) {
swr_close(swr_ctx);
Expand Down Expand Up @@ -128,33 +128,24 @@ uint32_t ffmpeg_prepare_movie(char *name, bool with_audio)
goto exit;
}

videostream = -1;
audiostream = -1;
for(i = 0; i < format_ctx->nb_streams; i++)
{
if(format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO && videostream < 0) videostream = i;
if(with_audio && format_ctx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO && audiostream < 0) audiostream = i;
}

if(videostream == -1)
{
videostream = av_find_best_stream(format_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);
if (videostream < 0) {
ffnx_error("prepare_movie: no video stream found\n");
ffmpeg_release_movie_objects();
goto exit;
}

if(with_audio && audiostream == -1 && trace_movies) ffnx_trace("prepare_movie: no audio stream found\n");
audiostream = av_find_best_stream(format_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &acodec, 0);
if(with_audio && audiostream < 0 && trace_movies) ffnx_trace("prepare_movie: no audio stream found\n");

codec_ctx = format_ctx->streams[videostream]->codec;

codec = avcodec_find_decoder(codec_ctx->codec_id);
if(!codec)
{
ffnx_error("prepare_movie: no video codec found\n");
codec_ctx = avcodec_alloc_context3(codec);
if (!codec_ctx) {
ffnx_error("prepare_movie: could not allocate video codec context\n");
codec_ctx = 0;
ffmpeg_release_movie_objects();
goto exit;
}
avcodec_parameters_to_context(codec_ctx, format_ctx->streams[videostream]->codecpar);

if(avcodec_open2(codec_ctx, codec, NULL) < 0)
{
Expand All @@ -163,16 +154,16 @@ uint32_t ffmpeg_prepare_movie(char *name, bool with_audio)
goto exit;
}

if(audiostream != -1)
if(audiostream >= 0)
{
acodec_ctx = format_ctx->streams[audiostream]->codec;
acodec = avcodec_find_decoder(acodec_ctx->codec_id);
if(!acodec)
{
ffnx_error("prepare_movie: no audio codec found\n");
acodec_ctx = avcodec_alloc_context3(acodec);
if (!acodec_ctx) {
ffnx_error("prepare_movie: could not allocate audio codec context\n");
codec_ctx = 0;
ffmpeg_release_movie_objects();
goto exit;
}
avcodec_parameters_to_context(acodec_ctx, format_ctx->streams[audiostream]->codecpar);

if(avcodec_open2(acodec_ctx, acodec, NULL) < 0)
{
Expand All @@ -184,7 +175,7 @@ uint32_t ffmpeg_prepare_movie(char *name, bool with_audio)

movie_width = codec_ctx->width;
movie_height = codec_ctx->height;
movie_fps = 1.0 / (av_q2d(codec_ctx->time_base) * codec_ctx->ticks_per_frame);
movie_fps = av_q2d(av_guess_frame_rate(format_ctx, format_ctx->streams[videostream], NULL));
movie_duration = (double)format_ctx->duration / (double)AV_TIME_BASE;
movie_frames = (uint32_t)::round(movie_fps * movie_duration);
movie_jpeg_range = codec_ctx->color_range == AVCOL_RANGE_JPEG;
Expand Down Expand Up @@ -242,7 +233,7 @@ uint32_t ffmpeg_prepare_movie(char *name, bool with_audio)
}
else sws_ctx = 0;

if(audiostream != -1)
if(audiostream >= 0)
{
if (acodec_ctx->sample_fmt != AV_SAMPLE_FMT_FLT) {
audio_must_be_converted = true;
Expand Down Expand Up @@ -381,9 +372,6 @@ uint32_t ffmpeg_update_movie_sample(bool use_movie_fps)
{
QueryPerformanceCounter((LARGE_INTEGER *)&now);

if(movie_sync_debug)
ffnx_info("update_movie_sample(video): DTS %f PTS %f (timebase %f) placed in video buffer at real time %f (play %f)\n", (double)packet.dts, (double)packet.pts, av_q2d(codec_ctx->time_base), (double)(now - start_time) / (double)timer_freq, (double)movie_frame_counter / (double)movie_fps);

if(sws_ctx)
{
AVFrame* frame = av_frame_alloc();
Expand Down
24 changes: 12 additions & 12 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ffnx",
"version": "1.15.0",
"builtin-baseline": "e69dd972ba64840955f46704ecce6241bf607c0f",
"builtin-baseline": "0ba60bfef5dea4cb2599daa7ad8364e309835a68",
"dependencies": [
"bgfx",
{
Expand Down Expand Up @@ -70,23 +70,23 @@
},
{
"name": "ffmpeg",
"version": "4.4.1",
"port-version": 21
"version": "5.1.2",
"port-version": 1
},
{
"name": "imgui",
"version": "1.88",
"port-version": 1
"version": "1.89.2",
"port-version": 0
},
{
"name": "libpng",
"version": "1.6.37",
"port-version": 19
"version": "1.6.39",
"port-version": 0
},
{
"name": "mimalloc",
"version": "2.0.6",
"port-version": 1
"version": "2.0.9",
"port-version": 0
},
{
"name": "openpsf",
Expand All @@ -95,8 +95,8 @@
},
{
"name": "pugixml",
"version": "1.12.1",
"port-version": 1
"version": "1.13.0",
"port-version": 0
},
{
"name": "soloud",
Expand Down Expand Up @@ -131,7 +131,7 @@
{
"name": "cpuinfo",
"version": "2022-07-19",
"port-version": 0
"port-version": 2
},
{
"name": "cmakerc",
Expand Down

0 comments on commit b6bf503

Please sign in to comment.