[vlc-commits] [Git][videolan/vlc][master] 7 commits: contrib: fxc2: don't build fxc2 by default
Steve Lhomme (@robUx4)
gitlab at videolan.org
Tue Apr 23 17:11:58 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
2d5c1f55 by Steve Lhomme at 2024-04-23T15:35:10+00:00
contrib: fxc2: don't build fxc2 by default
It will be pulled by Qt if needed.
- - - - -
4c316226 by Steve Lhomme at 2024-04-23T15:35:10+00:00
contrib: fxc2: use install to install binaries
- - - - -
d04d70fb by Steve Lhomme at 2024-04-23T15:35:10+00:00
contrib: fxc2: support -O binary output mode
- - - - -
a8493d31 by Steve Lhomme at 2024-04-23T15:35:10+00:00
contrib: fxc2: use a fxc script to call fxc2
So any call to fxc will use our tool, as long as fxc is in the PATH.
We can also handle the option format in the script.
- - - - -
9c80a115 by Steve Lhomme at 2024-04-23T15:35:10+00:00
contrib: fxc2: check the python script exists
Otherwise the package is not found on the system.
It doesn't a pkgconfig file so it was never found so far.
- - - - -
0df47ad7 by Steve Lhomme at 2024-04-23T15:35:10+00:00
configure: keep the fxc path
We need to add it to the PATH when calling qsb which assumes it's in the PATH.
qsb doesn't have an option to tell it where to look (in contribs). So if it's
not in the PATH it will never find it.
Then we can use the one from contribs.
- - - - -
738b9747 by Steve Lhomme at 2024-04-23T15:35:10+00:00
contrib: qtshadertools: don't force calling fxc2
We have a fake fxc that can be called under wine.
In Qt6.7 it may also call dxc (Shader Model 6) which can even be a Linux binary.
- - - - -
11 changed files:
- configure.ac
- + contrib/src/fxc2/0001-handle-O-option-to-write-to-a-binary-file-rather-tha.patch
- − contrib/src/fxc2/0002-accept-windows-style-flags-and-splitted-argument-val.patch
- + contrib/src/fxc2/0002-fix-redefinition-warning.patch
- + contrib/src/fxc2/0003-improve-error-messages-after-compilation.patch
- contrib/src/fxc2/0004-Revert-Fix-narrowing-conversion-from-int-to-BYTE.patch
- + contrib/src/fxc2/fxc
- contrib/src/fxc2/rules.mak
- − contrib/src/qtshadertools/0001-Use-fxc2-through-wine-instead-of-fxc.patch
- contrib/src/qtshadertools/rules.mak
- modules/gui/qt/Makefile.am
Changes:
=====================================
configure.ac
=====================================
@@ -3959,6 +3959,7 @@ have_qt_quick_test="no"
have_qt_declarative_private="no"
have_qt_gui_private="no"
have_qt_core_private="no"
+have_fxc="no"
AS_IF([test "${enable_qt}" != "no"], [
dnl Note that Qt < 6.2.5 does not provide pc files!
QT_MINIMUM_VERSION=6.2
@@ -4048,6 +4049,13 @@ AS_IF([test "${enable_qt}" != "no"], [
],[
])
+ AC_PATH_PROGS(FXC, [fxc], [no], [${CONTRIB_DIR}/bin])
+ AS_IF([test "$FXC" != "no"],[
+ have_fxc="yes"
+ FXC_PATH=$(echo $FXC | head -c-5)
+ AC_SUBST([FXC_PATH])
+ ])
+
dnl Check private headers availability
VLC_SAVE_FLAGS
CPPFLAGS="${CPPFLAGS} ${QT_CFLAGS}"
@@ -4127,6 +4135,7 @@ AM_CONDITIONAL([HAVE_QT_QUICK_TEST], [test "${have_qt_quick_test}" = "yes"])
AM_CONDITIONAL([HAVE_QT_DECLARATIVE_PRIVATE], [test "${have_qt_declarative_private}" = "yes"])
AM_CONDITIONAL([HAVE_QT_GUI_PRIVATE], [test "${have_qt_gui_private}" = "yes"])
AM_CONDITIONAL([HAVE_QT_CORE_PRIVATE], [test "${have_qt_core_private}" = "yes"])
+AM_CONDITIONAL([HAVE_FXC], [test "${have_fxc}" = "yes"])
dnl
dnl detect kde4-config patch (used for kde solids).
=====================================
contrib/src/fxc2/0001-handle-O-option-to-write-to-a-binary-file-rather-tha.patch
=====================================
@@ -0,0 +1,79 @@
+From f6c828b27699c7ee8bdd85b79ac519a13e8b3a57 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Fri, 19 Apr 2024 11:22:12 +0200
+Subject: [PATCH 1/3] handle -O option to write to a binary file rather than a
+ header
+
+---
+ fxc2.cpp | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/fxc2.cpp b/fxc2.cpp
+index 205fa16..a4037af 100755
+--- a/fxc2.cpp
++++ b/fxc2.cpp
+@@ -79,6 +79,7 @@ int main(int argc, char* argv[])
+ D3D_SHADER_MACRO* defines = new D3D_SHADER_MACRO[numDefines];
+ defines[numDefines-1].Name = NULL;
+ defines[numDefines-1].Definition = NULL;
++ bool outputToHeader = true;
+
+ int i, c;
+ static struct option longOptions[] =
+@@ -92,7 +93,7 @@ int main(int argc, char* argv[])
+ D3D_SHADER_MACRO* newDefines;
+
+ int optionIndex = 0;
+- c = getopt_long_only (argc, argv, "T:E:D:V:F:",
++ c = getopt_long_only (argc, argv, "T:E:D:V:F:O:",
+ longOptions, &optionIndex);
+
+ /* Detect the end of the options. */
+@@ -156,6 +157,7 @@ int main(int argc, char* argv[])
+ {
+ case 'h':
+ outputFile = strdup(&optarg[1]);
++ outputToHeader = true;
+ if(verbose) {
+ printf ("option -Fh (Output File) with arg %s\n", &optarg[1]);
+ }
+@@ -166,6 +168,14 @@ int main(int argc, char* argv[])
+ }
+ break;
+
++ case 'O':
++ outputFile = strdup(&optarg[0]);
++ outputToHeader = false;
++ if(verbose) {
++ printf ("option -O (Output File) with arg %s\n", &optarg[0]);
++ }
++ break;
++
+ case '?':
+ default:
+ print_usage_arg();
+@@ -315,8 +325,12 @@ int main(int argc, char* argv[])
+ int len = output->GetBufferSize();
+
+ FILE* f;
+- errno_t err = fopen_s(&f, outputFile, "w");
++ const auto openMode = outputToHeader ? "wb" : "w";
++ errno_t err = fopen_s(&f, outputFile, openMode);
+
++ if (!outputToHeader) {
++ fwrite(outString, 1, len, f);
++ } else {
+ fprintf(f, "const BYTE %s[] =\n{\n", variableName);
+ for (i = 0; i < len; i++) {
+ fprintf(f, "%4i", outString[i]);
+@@ -327,6 +341,7 @@ int main(int argc, char* argv[])
+ }
+
+ fprintf(f, "\n};");
++ }
+ fclose(f);
+
+ if(verbose) {
+--
+2.37.3.windows.1
+
=====================================
contrib/src/fxc2/0002-accept-windows-style-flags-and-splitted-argument-val.patch deleted
=====================================
@@ -1,261 +0,0 @@
-From 7c502bc09182958fa7268bfa792a338891c3df7b Mon Sep 17 00:00:00 2001
-From: Pierre Lamot <pierre.lamot at yahoo.fr>
-Date: Mon, 14 Jan 2019 15:09:36 +0100
-Subject: [PATCH 2/4] accept windows style flags and splitted argument value
-
- - accept windows style flags: /opt or -opt
- - accept split arguments : -FhFilename.h or -Fh Filename
----
- fxc2.cpp | 194 +++++++++++++++++++++++++++----------------------------
- 1 file changed, 95 insertions(+), 99 deletions(-)
-
-diff --git a/fxc2.cpp b/fxc2.cpp
-index 066608c..01a8d07 100755
---- a/fxc2.cpp
-+++ b/fxc2.cpp
-@@ -2,7 +2,7 @@
- #include <d3dcommon.h>
- #include <direct.h>
- #include <stdio.h>
--#include <getopt.h>
-+#include <assert.h>
- #include <string>
- #include <wchar.h>
-
-@@ -59,7 +58,41 @@ void print_usage_toomany() {
- exit(1);
- }
-
--int main(int argc, char* argv[])
-+bool parseOpt( const char* option, int argc, const char** argv, int* index, char** argumentOption )
-+{
-+ assert(option != NULL);
-+ if (!index || *index >= argc) {
-+ return false;
-+ }
-+ const char* argument = argv[*index];
-+ if (argument[0] == '-' || argument[0] == '/')
-+ argument++;
-+ else
-+ return false;
-+
-+ size_t optionSize = strlen(option);
-+ if (strncmp(argument, option, optionSize) != 0) {
-+ return false;
-+ }
-+
-+ if (argumentOption) {
-+ argument += optionSize;
-+ if (*argument == '\0') {
-+ *index += 1;
-+ if (*index >= argc) {
-+ printf("Error: missing required argument for option %s\n", option);
-+ return false;
-+ }
-+ *argumentOption = strdup(argv[*index]);
-+ } else {
-+ *argumentOption = strdup(argument);
-+ }
-+ }
-+ *index += 1;
-+ return true;
-+}
-+
-+int main(int argc, const char* argv[])
- {
- // ====================================================================================
- // Process Command Line Arguments
-@@ -71,114 +104,77 @@ int main(int argc, char* argv[])
- char* entryPoint = NULL;
- char* variableName = NULL;
- char* outputFile = NULL;
-+ char* defineOption = NULL;
- int numDefines = 1;
- D3D_SHADER_MACRO* defines = new D3D_SHADER_MACRO[numDefines];
- defines[numDefines-1].Name = NULL;
- defines[numDefines-1].Definition = NULL;
-
-- int i, c;
-- static struct option longOptions[] =
-- {
-- /* These options set a flag. */
-- {"nologo", no_argument, &verbose, 0},
-- {0, 0, 0, 0}
-- };
--
-+ int index = 1;
- while (1) {
- D3D_SHADER_MACRO* newDefines;
-
-- int optionIndex = 0;
-- c = getopt_long_only (argc, argv, "T:E:D:V:F:",
-- longOptions, &optionIndex);
--
- /* Detect the end of the options. */
-- if (c == -1)
-+ if (index >= argc)
- break;
-
-- switch (c)
-- {
-- case 0:
-- //printf ("option -nologo (quiet)\n");
-- //Technically, this is any flag we define in longOptions
-- break;
-- case 'T':
-- model = strdup(optarg);
-- if(verbose) {
-- printf ("option -T (Shader Model/Profile) with arg %s\n", optarg);
-- }
-- break;
-- case 'E':
-- entryPoint = strdup(optarg);
-- if(verbose) {
-- printf ("option -E (Entry Point) with arg %s\n", optarg);
-- }
-- break;
-- case 'D':
-- numDefines++;
-- //Copy the old array into the new array, but put the new definition at the beginning
-- newDefines = new D3D_SHADER_MACRO[numDefines];
-- for(i=1; i<numDefines; i++)
-- newDefines[i] = defines[i-1];
-- delete[] defines;
-- defines = newDefines;
-- defines[0].Name = strdup(optarg);
-- defines[0].Definition = "1";
-+ if (parseOpt("nologo", argc, argv, &index, NULL)) {
-+ continue;
-+ } else if (parseOpt("T", argc, argv, &index, &model)) {
-+ if(verbose) {
-+ printf ("option -T (Shader Model/Profile) with arg '%s'\n", model);
-+ }
-+ continue;
-+ } else if (parseOpt("E", argc, argv, &index, &entryPoint)) {
-+ if(verbose) {
-+ printf ("option -E (Entry Point) with arg '%s'\n", entryPoint);
-+ }
-+ continue;
-+ } else if (parseOpt("D", argc, argv, &index, &defineOption)) {
-+ numDefines++;
-+ //Copy the old array into the new array, but put the new definition at the beginning
-+ newDefines = new D3D_SHADER_MACRO[numDefines];
-+ for(int i=1; i<numDefines; i++)
-+ newDefines[i] = defines[i-1];
-+ delete[] defines;
-+ defines = newDefines;
-+ defines[0].Name = defineOption;
-+ defines[0].Definition = "1";
-+ if(verbose) {
-+ printf ("option -D with arg %s\n", defineOption);
-+ }
-+ continue;
-+ } else if (parseOpt("Vn", argc, argv, &index, &variableName)) {
-+ if(verbose) {
-+ printf ("option -Vn (Variable Name) with arg '%s'\n", variableName);
-+ }
-+ continue;
-+ } else if (parseOpt("Vi", argc, argv, &index, NULL)) {
-+ if(verbose) {
-+ printf("option -Vi (Output include process details) acknowledged but ignored.\n");
-+ }
-+ continue;
-+ } else if (parseOpt("Fh", argc, argv, &index, &outputFile)) {
-+ if(verbose) {
-+ printf ("option -Fh (Output File) with arg %s\n", outputFile);
-+ }
-+ continue;
-+ } else if (parseOpt("?", argc, argv, &index, NULL)) {
-+ print_usage_arg();
-+ continue;
-+ } else {
-+ if (!inputFile)
-+ {
-+ inputFile = new wchar_t[strlen(argv[index])+1];
-+ mbstowcs(inputFile, argv[index], strlen(argv[index])+1);
- if(verbose) {
-- printf ("option -D with arg %s\n", optarg);
-- }
-- break;
--
-- case 'V':
-- switch(optarg[0])
-- {
-- case 'n':
-- variableName = strdup(&optarg[1]);
-- if(verbose) {
-- printf ("option -Vn (Variable Name) with arg %s\n", &optarg[1]);
-- }
-- break;
-- case 'i':
-- if(verbose) {
-- printf("option -Vi (Output include process details) acknowledged but ignored.\n");
-- }
-- break;
-- default:
-- print_usage_arg();
-- break;
-+ wprintf(L"input file: %ls\n", inputFile);
- }
-- break;
-- case 'F':
-- switch(optarg[0])
-- {
-- case 'h':
-- outputFile = strdup(&optarg[1]);
-- if(verbose) {
-- printf ("option -Fh (Output File) with arg %s\n", &optarg[1]);
-- }
-- break;
-- default:
-- print_usage_arg();
-- break;
-- }
-- break;
--
-- case '?':
-- default:
-- print_usage_arg();
-- break;
-- }
-- }
--
-- if (optind < argc) {
-- inputFile = new wchar_t[strlen(argv[optind])+1];
-- mbstowcs(inputFile, argv[optind], strlen(argv[optind])+1);
-- if(verbose) {
-- wprintf(L"input file: %ls\n", inputFile);
-- }
--
-- optind++;
-- if(optind < argc) {
-- print_usage_toomany();
-+ index += 1;
-+ } else {
-+ print_usage_toomany();
-+ return 1;
-+ }
- }
- }
-
-@@ -243,7 +239,7 @@ int main(int argc, char* argv[])
- wprintf(L"\t %ls,\n", inputFile);
-
- printf("\t");
-- for(i=0; i<numDefines-1; i++)
-+ for(int i=0; i<numDefines-1; i++)
- printf(" %s=%s", defines[i].Name, defines[i].Definition);
- printf(",\n");
-
-@@ -315,7 +311,7 @@ int main(int argc, char* argv[])
- errno_t err = fopen_s(&f, outputFile, "w");
-
- fprintf(f, "const signed char %s[] =\n{\n", variableName);
-- for (i = 0; i < len; i++) {
-+ for (int i = 0; i < len; i++) {
- fprintf(f, "%4i", outString[i]);
- if (i != len - 1)
- fprintf(f, ",");
---
-2.19.1
-
=====================================
contrib/src/fxc2/0002-fix-redefinition-warning.patch
=====================================
@@ -0,0 +1,26 @@
+From 39629169b7c8c2cc7c2fe7fdd057132352482fec Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Fri, 19 Apr 2024 11:43:08 +0200
+Subject: [PATCH 2/3] fix redefinition warning
+
+---
+ fxc2.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/fxc2.cpp b/fxc2.cpp
+index 2b3f587..17b0ccb 100755
+--- a/fxc2.cpp
++++ b/fxc2.cpp
+@@ -11,7 +11,9 @@
+ #include <wchar.h>
+
+
++#ifndef D3D_COMPILE_STANDARD_FILE_INCLUDE
+ #define D3D_COMPILE_STANDARD_FILE_INCLUDE ((ID3DInclude*)(UINT_PTR)1)
++#endif
+ typedef HRESULT(__stdcall *pCompileFromFileg)(LPCWSTR,
+ const D3D_SHADER_MACRO[],
+ ID3DInclude*,
+--
+2.37.3.windows.1
+
=====================================
contrib/src/fxc2/0003-improve-error-messages-after-compilation.patch
=====================================
@@ -0,0 +1,29 @@
+From b21a639c2c79cf7543d57ef14fe79911ed6be7ae Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Fri, 19 Apr 2024 15:09:41 +0200
+Subject: [PATCH 3/3] improve error messages after compilation
+
+---
+ fxc2.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fxc2.cpp b/fxc2.cpp
+index 17b0ccb..dbc5728 100755
+--- a/fxc2.cpp
++++ b/fxc2.cpp
+@@ -306,10 +306,10 @@ int main(int argc, char* argv[])
+ if (FAILED(hr)) {
+ if (errors) {
+ char* error = (char*)errors->GetBufferPointer();
+- printf("Got an error (%i) while compiling:\n%s\n", hr, error);
++ printf("Got an error (0x%lX) while compiling: '%s'\n%s\n", hr, inputFile, error);
+ errors->Release();
+ } else {
+- printf("Got an error (%i) while compiling, but no error message from the function.\n", hr);
++ printf("Got an error (0x%lX) while compiling '%s', but no error message from the function.\n", hr, inputFile);
+
+ LPSTR messageBuffer = nullptr;
+ size_t size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+--
+2.37.3.windows.1
+
=====================================
contrib/src/fxc2/0004-Revert-Fix-narrowing-conversion-from-int-to-BYTE.patch
=====================================
@@ -1,4 +1,4 @@
-From 24359310304ceee121489fd785fb31484cf36c0d Mon Sep 17 00:00:00 2001
+From cff056e74403c99b8d672cce5b289615a4d7338f Mon Sep 17 00:00:00 2001
From: Pierre Lamot <pierre.lamot at yahoo.fr>
Date: Mon, 14 Jan 2019 15:37:02 +0100
Subject: [PATCH 4/4] Revert "Fix: narrowing conversion from 'int' to 'BYTE'"
@@ -9,19 +9,19 @@ This reverts commit 82527b81104e5e21390d3ddcd328700c67ce73d4.
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fxc2.cpp b/fxc2.cpp
-index 01a8d07..ac17328 100755
+index 5b8c86c..205fa16 100755
--- a/fxc2.cpp
+++ b/fxc2.cpp
-@@ -310,7 +310,7 @@ int main(int argc, const char* argv[])
+@@ -317,7 +317,7 @@ int main(int argc, char* argv[])
FILE* f;
errno_t err = fopen_s(&f, outputFile, "w");
- fprintf(f, "const signed char %s[] =\n{\n", variableName);
+ fprintf(f, "const BYTE %s[] =\n{\n", variableName);
- for (int i = 0; i < len; i++) {
+ for (i = 0; i < len; i++) {
fprintf(f, "%4i", outString[i]);
if (i != len - 1)
-@@ -319,7 +319,7 @@ int main(int argc, const char* argv[])
+@@ -326,7 +326,7 @@ int main(int argc, char* argv[])
fprintf(f, "\n");
}
@@ -31,5 +31,5 @@ index 01a8d07..ac17328 100755
if(verbose) {
--
-2.19.1
+2.37.3.windows.1
=====================================
contrib/src/fxc2/fxc
=====================================
@@ -0,0 +1,156 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import sys
+import os
+import platform
+import subprocess
+import shutil
+
+def log_error(msg: str):
+ sys.stderr.write(msg + os.linesep)
+
+def toSystemPath(path: str):
+ absPath = os.path.abspath(path)
+ if platform.system() == 'Windows':
+ return absPath
+
+ if platform.system() == 'Linux':
+ pathCmd = None
+ if shutil.which('cygpath'):
+ pathCmd = 'cygpath'
+ elif shutil.which('wslpath'):
+ pathCmd = 'wslpath'
+ else:
+ pathCmd = 'wine winepath'
+ # convert to hybrid mode to avoid forward slashes in shell
+ sub = subprocess.Popen([pathCmd, '-m', absPath], shell=False, stderr=subprocess.DEVNULL, stdout=subprocess.PIPE)
+ errcode = sub.wait()
+ if errcode != 0:
+ log_error('failed to find Windows path using {} for "{}"'.format(pathCmd, absPath))
+ exit(1)
+ p, err = sub.communicate()
+ return p.decode('utf-8').strip()
+
+def main():
+ this_path = os.path.dirname(os.path.abspath(sys.argv[0]))
+ if (os.path.exists( os.path.join( this_path, 'fxc2.exe'))):
+ fxc2 = os.path.join( this_path, 'fxc2.exe')
+ elif (os.path.exists( os.path.join( this_path, 'fxc2'))):
+ fxc2 = os.path.join( this_path, 'fxc2')
+ else:
+ log_error('fxc2 not found in {}'.format(this_path))
+ exit(1)
+
+ nologo = False
+ optimized = True
+ entry_point = None
+ model = None
+ output_file = None
+ input_files = []
+ argi = 0
+ while argi < len(sys.argv)-1:
+ argi = argi+1
+ option = sys.argv[argi]
+
+ # --version
+ if option == '--version':
+ print('fxc wrapper 0.0.1')
+ exit(0)
+
+ # /nologo
+ if option == '/nologo' or option == '-nologo':
+ nologo = True
+
+ # /E
+ elif option == '/E' or option == '-E':
+ if argi+1 >= len(sys.argv):
+ log_error('missing /E parameter')
+ exit(1)
+ argi = argi+1
+ entry_point = sys.argv[argi]
+
+ # /T
+ elif option == '/T' or option == '-T':
+ if argi+1 >= len(sys.argv):
+ log_error('missing /T parameter')
+ exit(1)
+ argi = argi+1
+ model = sys.argv[argi]
+
+ # /Fo
+ elif option == '/Fo' or option == '-Fo':
+ if argi+1 >= len(sys.argv):
+ log_error('missing /Fo parameter')
+ exit(1)
+ argi = argi+1
+ output_file = sys.argv[argi]
+ output_mode = '-O'
+
+ # /Fh
+ elif option == '/Fh' or option == '-Fh':
+ if argi+1 >= len(sys.argv):
+ log_error('missing /Fo parameter')
+ exit(1)
+ argi = argi+1
+ output_file = sys.argv[argi]
+ output_mode = '-Fh'
+
+ # /Od
+ elif option == '/Od' or option == '-Od':
+ optimized = False
+
+ elif option.startswith('-'):
+ log_error('unknown option {}'.format(option))
+ exit(1)
+
+ elif option.startswith('/') and not os.path.exists(option):
+ log_error('unknown option {}'.format(option))
+ exit(1)
+
+ else:
+ input_files.append(option)
+
+ if len(input_files) == 0:
+ log_error('missing input file(s)')
+ exit(1)
+
+ fxc2_call = [ fxc2 ]
+ if nologo:
+ fxc2_call.append( '-nologo' )
+ if entry_point:
+ fxc2_call.append( '-E' )
+ fxc2_call.append( entry_point )
+ if model:
+ fxc2_call.append( '-T' )
+ fxc2_call.append( model )
+ if output_file:
+ fxc2_call.append( output_mode )
+ fxc2_call.append( toSystemPath(output_file) )
+ for input in input_files:
+ fxc2_call.append( toSystemPath(input) )
+
+ # disabling optimizations not supported by fxc2
+ # qsb used this to disable debugging(!)
+ # if not optimized:
+ # fxc2_call.append( '-Od' )
+
+ if platform.system() == 'Windows':
+ call = subprocess.Popen(fxc2_call, shell=False, stderr=subprocess.DEVNULL, stdout=subprocess.PIPE)
+ else:
+ if not nologo:
+ print('calling fxc2 through wine')
+ call = subprocess.Popen(['bash', '-c', 'wine ' +' '.join(fxc2_call)], shell=False, stderr=subprocess.DEVNULL, stdout=subprocess.PIPE)
+ errcode = call.wait()
+ p, err = call.communicate()
+ if not nologo:
+ print('fxc calling ' + ' '.join(fxc2_call))
+
+ if not nologo or errcode != 0:
+ lines = p.decode('utf-8')
+ print(lines)
+
+ exit(errcode)
+
+if __name__ == "__main__":
+ main()
=====================================
contrib/src/fxc2/rules.mak
=====================================
@@ -2,14 +2,7 @@ FXC2_HASH := 654c29d62a02714ea0bacfb118c3e05127f846e0
FXC2_VERSION := git-$(FXC2_HASH)
FXC2_GITURL := $(GITHUB)/mozilla/fxc2.git
-ifeq ($(findstring qt,$(PKGS)),)
-# match with Qt targets
-ifdef HAVE_WIN32
-PKGS_TOOLS += fxc2
-endif
-endif
-
-ifeq ($(call need_pkg,"fxc2"),)
+ifneq ($(shell fxc --version >/dev/null 2>&1 || echo FAIL),)
PKGS_FOUND += fxc2
endif
@@ -22,9 +15,12 @@ $(TARBALLS)/fxc2-$(FXC2_VERSION).tar.xz:
fxc2: fxc2-$(FXC2_VERSION).tar.xz .sum-fxc2
$(UNPACK)
+ cp $(SRC)/fxc2/fxc $(UNPACK_DIR)
$(APPLY) $(SRC)/fxc2/0001-make-Vn-argument-as-optional-and-provide-default-var.patch
- $(APPLY) $(SRC)/fxc2/0002-accept-windows-style-flags-and-splitted-argument-val.patch
$(APPLY) $(SRC)/fxc2/0004-Revert-Fix-narrowing-conversion-from-int-to-BYTE.patch
+ $(APPLY) $(SRC)/fxc2/0001-handle-O-option-to-write-to-a-binary-file-rather-tha.patch
+ $(APPLY) $(SRC)/fxc2/0002-fix-redefinition-warning.patch
+ $(APPLY) $(SRC)/fxc2/0003-improve-error-messages-after-compilation.patch
$(MOVE)
ifeq ($(shell uname -m),aarch64)
@@ -49,5 +45,8 @@ endif
.fxc2: fxc2
cd $< && $(FXC2_CXX) -static fxc2.cpp -o fxc2.exe
- cd $< && mkdir -p $(PREFIX)/bin && cp fxc2.exe $(PREFIX)/bin && cp $(FXC2_DLL) $(PREFIX)/bin/d3dcompiler_47.dll
+ install -d "$(PREFIX)/bin" && \
+ install $</fxc2.exe "$(PREFIX)/bin" && \
+ install $</fxc "$(PREFIX)/bin" && \
+ install $</$(FXC2_DLL) "$(PREFIX)/bin/d3dcompiler_47.dll"
touch $@
=====================================
contrib/src/qtshadertools/0001-Use-fxc2-through-wine-instead-of-fxc.patch deleted
=====================================
@@ -1,43 +0,0 @@
-From c596f3a817a22856e36db9df10615a8e722a33f7 Mon Sep 17 00:00:00 2001
-From: Fatih Uzunoglu <fuzun54 at outlook.com>
-Date: Wed, 21 Feb 2024 20:27:36 +0200
-Subject: [PATCH] Use fxc2 through wine instead of fxc
-
----
- tools/qsb/qsb.cpp | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/tools/qsb/qsb.cpp b/tools/qsb/qsb.cpp
-index bc38e14..d1a96fe 100644
---- a/tools/qsb/qsb.cpp
-+++ b/tools/qsb/qsb.cpp
-@@ -81,6 +81,7 @@ static bool runProcess(const QString &binary, const QStringList &arguments,
- {
- #if QT_CONFIG(process)
- QProcess p;
-+ p.setWorkingDirectory(QCoreApplication::applicationDirPath());
- p.start(binary, arguments);
- const QString cmd = binary + QLatin1Char(' ') + arguments.join(QLatin1Char(' '));
- if (!silent)
-@@ -820,14 +821,15 @@ int main(int argc, char **argv)
- QLatin1String("/nologo"),
- QLatin1String("/E"), QString::fromLocal8Bit(s.entryPoint()),
- QLatin1String("/T"), QString::fromLocal8Bit(typeArg),
-- QLatin1String("/Fo"), QDir::toNativeSeparators(tmpOut)
-+ QLatin1String("/Fo"), "Z:" + QDir::toNativeSeparators(tmpOut)
- });
- if (cmdLineParser.isSet(debugInfoOption))
- arguments << QLatin1String("/Od") << QLatin1String("/Zi");
-- arguments.append(QDir::toNativeSeparators(tmpIn));
-+ arguments.append("Z:" + QDir::toNativeSeparators(tmpIn));
- QByteArray output;
- QByteArray errorOutput;
-- bool success = runProcess(QLatin1String("fxc"), arguments, &output, &errorOutput);
-+ arguments.prepend(QStringLiteral("fxc2"));
-+ bool success = runProcess(QLatin1String("wine"), arguments, &output, &errorOutput);
- if (success) {
- const QByteArray bytecode = readFile(tmpOut, FileType::Binary);
- if (!bytecode.isEmpty())
---
-2.43.1
-
=====================================
contrib/src/qtshadertools/rules.mak
=====================================
@@ -51,7 +51,6 @@ QT_SHADETOOLS_NATIVE_CONFIG := -DCMAKE_TOOLCHAIN_FILE=$(BUILDPREFIX)/lib/cmake/Q
qtshadertools: qtshadertools-everywhere-src-$(QTSHADERTOOLS_VERSION).tar.xz .sum-qtshadertools
$(UNPACK)
- $(APPLY) $(SRC)/qtshadertools/0001-Use-fxc2-through-wine-instead-of-fxc.patch
$(APPLY) $(SRC)/qtshadertools/0001-Backport-a-change-to-SPIRV-Cross-to-add-a-missing-in.patch
$(MOVE)
=====================================
modules/gui/qt/Makefile.am
=====================================
@@ -1130,11 +1130,16 @@ if HAVE_DARWIN
QSB_PARAMS += --msl=12
endif
+QSB_EXTRA_PATH =
+if HAVE_FXC
+QSB_EXTRA_PATH += $(FXC_PATH):
+endif
+
%.frag.qsb: %.frag
- $(AM_V_GEN) $(QSB) $(QSB_PARAMS) -o $@ $<
+ $(AM_V_GEN) PATH="$(QSB_EXTRA_PATH)$$PATH" $(QSB) $(QSB_PARAMS) -o $@ $<
%.vert.qsb: %.vert
- $(AM_V_GEN) $(QSB) $(QSB_PARAMS) -o $@ $<
+ $(AM_V_GEN) PATH="$(QSB_EXTRA_PATH)$$PATH" $(QSB) $(QSB_PARAMS) -o $@ $<
shaders/shaders.cpp: $(srcdir)/shaders/shaders.qrc $(libqt_plugin_la_SHADER:.frag=.frag.qsb) $(libqt_plugin_la_SHADER:.vert=.vert.qsb)
$(AM_V_GEN) cp -f $(filter %.qrc, $^) $(builddir)/shaders/shaders.qrc || true
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/223fdb125a7eb9fd63c781f668e3b5a6141b9574...738b974777638cae4631e65dc4f0e475cb734a93
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/223fdb125a7eb9fd63c781f668e3b5a6141b9574...738b974777638cae4631e65dc4f0e475cb734a93
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list