mirror of
https://github.com/godotengine/godot-nir-static.git
synced 2025-12-31 13:48:20 +03:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff659277fb | ||
|
|
c2b257ae7c | ||
|
|
a46efbb83c | ||
|
|
4fa39a02b0 | ||
|
|
232dda2a37 | ||
|
|
e72737a1a8 | ||
|
|
27a49f8601 | ||
|
|
1e66fa02bf | ||
|
|
e101346d1e | ||
|
|
b6ed19e648 | ||
|
|
360d88bb7e | ||
|
|
d3d7cc7a5a | ||
|
|
97b2e3580c | ||
|
|
7546e0b405 | ||
|
|
c4211d1652 | ||
|
|
d61034bda2 | ||
|
|
0af9607ba4 | ||
|
|
ea21cea768 | ||
|
|
b3565f5cb4 | ||
|
|
8d78553b4f |
182
.github/workflows/ci.yaml
vendored
Normal file
182
.github/workflows/ci.yaml
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
name: Godot Mesa/NIR static libs
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.name }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# MinGW/LLVM libs using UCRT
|
||||
- name: 🏁 Windows - MinGW/LLVM (UCRT) x86_64
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-x86_64-llvm-release
|
||||
artifact-path: bin/libNIR.windows.x86_64.a
|
||||
flags: use_mingw=yes arch=x86_64 use_llvm=yes mingw_prefix=$HOME/llvm-mingw
|
||||
llvm: yes
|
||||
|
||||
- name: 🏁 Windows - MinGW/LLVM (UCRT) x86_32
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-x86_32-llvm-release
|
||||
artifact-path: bin/libNIR.windows.x86_32.a
|
||||
flags: use_mingw=yes arch=x86_32 use_llvm=yes mingw_prefix=$HOME/llvm-mingw
|
||||
llvm: yes
|
||||
|
||||
- name: 🏁 Windows - MinGW/LLVM (UCRT) arm64
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-arm64-llvm-release
|
||||
artifact-path: bin/libNIR.windows.arm64.a
|
||||
flags: use_mingw=yes arch=arm64 use_llvm=yes mingw_prefix=$HOME/llvm-mingw
|
||||
llvm: yes
|
||||
|
||||
# MSVC libs
|
||||
- name: 🏁 Windows - MSVC x86_64
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-x86_64-msvc-release
|
||||
artifact-path: bin/libNIR.windows.x86_64.lib
|
||||
flags: use_mingw=no arch=x86_64
|
||||
|
||||
- name: 🏁 Windows - MSVC x86_32
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-x86_32-msvc-release
|
||||
artifact-path: bin/libNIR.windows.x86_32.lib
|
||||
flags: use_mingw=no arch=x86_32
|
||||
|
||||
- name: 🏁 Windows - MSVC arm64
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-arm64-msvc-release
|
||||
artifact-path: bin/libNIR.windows.arm64.lib
|
||||
flags: use_mingw=no arch=arm64
|
||||
|
||||
- name: 🏁 Windows - MSVC arm32
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-arm32-msvc-release
|
||||
artifact-path: bin/libNIR.windows.arm32.lib
|
||||
flags: use_mingw=no arch=arm32
|
||||
|
||||
# MinGW/GCC libs using MSVCRT
|
||||
- name: 🏁 Windows - MinGW/GCC (MSVCRT) x86_64
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-x86_64-gcc-release
|
||||
artifact-path: bin/libNIR.windows.x86_64.a
|
||||
flags: use_mingw=yes arch=x86_64
|
||||
mingw: yes
|
||||
msys: mingw64
|
||||
msysenv: x86_64
|
||||
|
||||
- name: 🏁 Windows - MinGW/GCC (MSVCRT) x86_32
|
||||
platform: windows
|
||||
os: windows-2019
|
||||
artifact-name: godot-nir-static-x86_32-gcc-release
|
||||
artifact-path: bin/libNIR.windows.x86_32.a
|
||||
flags: use_mingw=yes arch=x86_32
|
||||
mingw: yes
|
||||
msys: mingw32
|
||||
msysenv: i686
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install SCons (Native env)
|
||||
if: ${{ matrix.mingw != 'yes' }}
|
||||
run: |
|
||||
python -m pip install scons==4.0.0
|
||||
|
||||
- name: Install mako
|
||||
run: |
|
||||
python -m pip install mako
|
||||
|
||||
- name: Setup MinGW/LLVM
|
||||
if: ${{ matrix.platform == 'windows' && matrix.llvm == 'yes' }}
|
||||
run: |
|
||||
curl -L -O https://github.com/mstorsjo/llvm-mingw/releases/download/20240619/llvm-mingw-20240619-ucrt-x86_64.zip
|
||||
unzip -q llvm-mingw-*.zip
|
||||
rm llvm-mingw-*.zip
|
||||
mv llvm-mingw-* "$HOME/llvm-mingw"
|
||||
echo "$HOME/llvm-mingw/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Setup MinGW/MSYS2
|
||||
if: ${{ matrix.mingw == 'yes' }}
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
msystem: ${{matrix.msys}}
|
||||
install: mingw-w64-${{matrix.msysenv}}-gcc mingw-w64-${{matrix.msysenv}}-scons
|
||||
|
||||
- name: Prepare Mesa source
|
||||
shell: bash
|
||||
run: |
|
||||
./update_mesa.sh
|
||||
|
||||
- name: Build Mesa (Native env)
|
||||
if: ${{ matrix.mingw != 'yes' }}
|
||||
run: |
|
||||
scons platform=${{ matrix.platform }} ${{ matrix.flags }} optimize=speed
|
||||
|
||||
- name: Build Mesa (MSYS2 env)
|
||||
if: ${{ matrix.mingw == 'yes' }}
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
scons platform=${{ matrix.platform }} ${{ matrix.flags }} optimize=speed
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact-name }}
|
||||
path: |
|
||||
${{ matrix.artifact-path }}
|
||||
godot-mesa/VERSION.info
|
||||
godot-mesa/**/*.h
|
||||
godot-mesa/**/*.hpp
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
name: 'Release'
|
||||
|
||||
needs: [build]
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: ZIP Artifacts
|
||||
run: |
|
||||
for i in */; do (cd "${i%/}"; zip -r "../${i%/}.zip" .; cd ..); done
|
||||
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
allowUpdates: true
|
||||
removeArtifacts: true
|
||||
omitNameDuringUpdate: true
|
||||
omitBodyDuringUpdate: true
|
||||
artifacts: "*.zip"
|
||||
artifactErrorsFailBuild: true
|
||||
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2017-present Godot Engine contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -3,9 +3,7 @@
|
||||
import os
|
||||
import platform
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from SCons.Errors import UserError
|
||||
|
||||
EnsureSConsVersion(4, 0)
|
||||
|
||||
@@ -119,6 +117,7 @@ opts.Add("cxxflags", "Custom flags for the C++ compiler")
|
||||
opts.Add("cflags", "Custom flags for the C compiler")
|
||||
opts.Add("linkflags", "Custom flags for the linker")
|
||||
opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files.", "")
|
||||
opts.Add(BoolVariable("use_asan", "Use address sanitizer (ASAN) in MSVC", False))
|
||||
|
||||
# Targets flags tool (optimizations, debug symbols)
|
||||
target_tool = Tool("targets", toolpath=["godot-tools"])
|
||||
@@ -191,6 +190,12 @@ if env["platform"] == "macos":
|
||||
elif env["platform"] == "windows":
|
||||
env.AppendUnique(CPPDEFINES=["WINVER=0x0603", "_WIN32_WINNT=0x0603"])
|
||||
|
||||
# Sanitizers.
|
||||
if env.get("use_asan", False) and env.get("is_msvc", False):
|
||||
env["extra_suffix"] += ".san"
|
||||
env.Append(LINKFLAGS=["/INFERASANLIBS"])
|
||||
env.Append(CCFLAGS=["/fsanitize=address"])
|
||||
|
||||
|
||||
scons_cache_path = os.environ.get("SCONS_CACHE")
|
||||
if scons_cache_path is not None:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
diff --git a/godot-mesa/src/compiler/nir/nir_intrinsics.py b/godot-mesa/src/compiler/nir/nir_intrinsics.py
|
||||
index fcb8a9885c..54e199cc43 100644
|
||||
index 7474afb..119b832 100644
|
||||
--- a/godot-mesa/src/compiler/nir/nir_intrinsics.py
|
||||
+++ b/godot-mesa/src/compiler/nir/nir_intrinsics.py
|
||||
@@ -1046,6 +1046,9 @@ load("push_constant", [1], [BASE, RANGE, ALIGN_MUL, ALIGN_OFFSET], [CAN_ELIMINAT
|
||||
@@ -13,7 +13,7 @@ index fcb8a9885c..54e199cc43 100644
|
||||
load("global", [1], [ACCESS, ALIGN_MUL, ALIGN_OFFSET], [CAN_ELIMINATE])
|
||||
# src[] = { address }.
|
||||
diff --git a/godot-mesa/src/compiler/spirv/spirv_to_nir.c b/godot-mesa/src/compiler/spirv/spirv_to_nir.c
|
||||
index 5cb7691506..7620fef9f5 100644
|
||||
index 6f87ff9..da61ec5 100644
|
||||
--- a/godot-mesa/src/compiler/spirv/spirv_to_nir.c
|
||||
+++ b/godot-mesa/src/compiler/spirv/spirv_to_nir.c
|
||||
@@ -39,6 +39,8 @@
|
||||
@@ -41,7 +41,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
case SpvDecorationAliased:
|
||||
case SpvDecorationConstant:
|
||||
case SpvDecorationIndex:
|
||||
@@ -1938,7 +1940,7 @@ vtn_null_constant(struct vtn_builder *b, struct vtn_type *type)
|
||||
@@ -1942,7 +1944,7 @@ vtn_null_constant(struct vtn_builder *b, struct vtn_type *type)
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -50,7 +50,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
ASSERTED int member,
|
||||
const struct vtn_decoration *dec, void *data)
|
||||
{
|
||||
@@ -1946,13 +1948,8 @@ spec_constant_decoration_cb(struct vtn_builder *b, UNUSED struct vtn_value *val,
|
||||
@@ -1950,13 +1952,8 @@ spec_constant_decoration_cb(struct vtn_builder *b, UNUSED struct vtn_value *val,
|
||||
if (dec->decoration != SpvDecorationSpecId)
|
||||
return;
|
||||
|
||||
@@ -66,7 +66,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1976,6 +1973,12 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
@@ -1980,6 +1977,12 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
const uint32_t *w, unsigned count)
|
||||
{
|
||||
struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_constant);
|
||||
@@ -79,7 +79,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
val->constant = rzalloc(b, nir_constant);
|
||||
switch (opcode) {
|
||||
case SpvOpConstantTrue:
|
||||
@@ -1993,7 +1996,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
@@ -1997,7 +2000,7 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
|
||||
if (opcode == SpvOpSpecConstantTrue ||
|
||||
opcode == SpvOpSpecConstantFalse)
|
||||
@@ -88,7 +88,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
|
||||
val->constant->values[0].b = u32val.u32 != 0;
|
||||
break;
|
||||
@@ -2024,11 +2027,10 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
@@ -2028,11 +2031,10 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
|
||||
if (opcode == SpvOpSpecConstant)
|
||||
vtn_foreach_decoration(b, val, spec_constant_decoration_cb,
|
||||
@@ -101,7 +101,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
case SpvOpConstantComposite: {
|
||||
unsigned elem_count = count - 3;
|
||||
vtn_fail_if(elem_count != val->type->length,
|
||||
@@ -2076,218 +2078,6 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
@@ -2080,218 +2082,6 @@ vtn_handle_constant(struct vtn_builder *b, SpvOp opcode,
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
case SpvOpConstantNull:
|
||||
val->constant = vtn_null_constant(b, val->type);
|
||||
val->is_null_constant = true;
|
||||
@@ -6370,6 +6160,96 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||
@@ -6393,6 +6183,106 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -388,9 +388,19 @@ index 5cb7691506..7620fef9f5 100644
|
||||
+ }
|
||||
+ } break;
|
||||
+
|
||||
+ case SpvOpSpecConstantComposite:
|
||||
+ abort(); // Unimplemented
|
||||
+ case SpvOpSpecConstantComposite: {
|
||||
+ unsigned elem_count = count - 3;
|
||||
+ vtn_fail_if(elem_count != val->type->length,
|
||||
+ "%s has %u constituents, expected %u",
|
||||
+ spirv_op_to_string(opcode), elem_count, val->type->length);
|
||||
+
|
||||
+ vtn_assert(b->values[w[2]].value_type == vtn_value_type_ssa);
|
||||
+ if (!b->values[w[2]].ssa) {
|
||||
+ b->values[w[2]].value_type = vtn_value_type_invalid; /* Pretend not yet set */
|
||||
+ vtn_handle_composite(b, SpvOpCompositeConstruct, w, count);
|
||||
+ }
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ case SpvOpSpecConstantOp: {
|
||||
+ vtn_assert(val->value_type == vtn_value_type_ssa);
|
||||
@@ -417,7 +427,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
static bool
|
||||
is_glslang(const struct vtn_builder *b)
|
||||
{
|
||||
@@ -6609,6 +6489,8 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
|
||||
@@ -6632,6 +6522,8 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
|
||||
/* Skip the SPIR-V header, handled at vtn_create_builder */
|
||||
words+= 5;
|
||||
|
||||
@@ -426,7 +436,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
/* Handle all the preamble instructions */
|
||||
words = vtn_foreach_instruction(b, words, word_end,
|
||||
vtn_handle_preamble_instruction);
|
||||
@@ -6690,7 +6572,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
|
||||
@@ -6713,7 +6605,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
|
||||
if ((options->create_library || func->referenced) && !func->emitted) {
|
||||
b->const_table = _mesa_pointer_hash_table_create(b);
|
||||
|
||||
@@ -436,7 +446,7 @@ index 5cb7691506..7620fef9f5 100644
|
||||
}
|
||||
}
|
||||
diff --git a/godot-mesa/src/compiler/spirv/vtn_cfg.c b/godot-mesa/src/compiler/spirv/vtn_cfg.c
|
||||
index b02c11b8d7..7d0c647f79 100644
|
||||
index b02c11b..7d0c647 100644
|
||||
--- a/godot-mesa/src/compiler/spirv/vtn_cfg.c
|
||||
+++ b/godot-mesa/src/compiler/spirv/vtn_cfg.c
|
||||
@@ -1425,6 +1425,8 @@ vtn_emit_cf_func_unstructured(struct vtn_builder *b, struct vtn_function *func,
|
||||
@@ -459,7 +469,7 @@ index b02c11b8d7..7d0c647f79 100644
|
||||
impl->structured = false;
|
||||
vtn_emit_cf_func_unstructured(b, func, instruction_handler);
|
||||
diff --git a/godot-mesa/src/compiler/spirv/vtn_private.h b/godot-mesa/src/compiler/spirv/vtn_private.h
|
||||
index bd65a60d9b..389f477681 100644
|
||||
index b1ec64d..1bdb3c8 100644
|
||||
--- a/godot-mesa/src/compiler/spirv/vtn_private.h
|
||||
+++ b/godot-mesa/src/compiler/spirv/vtn_private.h
|
||||
@@ -307,6 +307,8 @@ typedef bool (*vtn_instruction_handler)(struct vtn_builder *, SpvOp,
|
||||
@@ -491,7 +501,7 @@ index bd65a60d9b..389f477681 100644
|
||||
|
||||
#define VTN_DEC_DECORATION -1
|
||||
diff --git a/godot-mesa/src/compiler/spirv/vtn_variables.c b/godot-mesa/src/compiler/spirv/vtn_variables.c
|
||||
index 8db61c8e61..8545903165 100644
|
||||
index 8db61c8..8545903 100644
|
||||
--- a/godot-mesa/src/compiler/spirv/vtn_variables.c
|
||||
+++ b/godot-mesa/src/compiler/spirv/vtn_variables.c
|
||||
@@ -26,6 +26,8 @@
|
||||
@@ -526,7 +536,7 @@ index 8db61c8e61..8545903165 100644
|
||||
vtn_var->input_attachment_index = dec->operands[0];
|
||||
vtn_var->access |= ACCESS_NON_WRITEABLE;
|
||||
diff --git a/godot-mesa/src/microsoft/compiler/dxil_container.c b/godot-mesa/src/microsoft/compiler/dxil_container.c
|
||||
index 209973459d..487cda7a40 100644
|
||||
index 2099734..487cda7 100644
|
||||
--- a/godot-mesa/src/microsoft/compiler/dxil_container.c
|
||||
+++ b/godot-mesa/src/microsoft/compiler/dxil_container.c
|
||||
@@ -338,7 +338,8 @@ dxil_container_add_state_validation(struct dxil_container *c,
|
||||
@@ -582,7 +592,7 @@ index 209973459d..487cda7a40 100644
|
||||
|
||||
return true;
|
||||
diff --git a/godot-mesa/src/microsoft/compiler/dxil_container.h b/godot-mesa/src/microsoft/compiler/dxil_container.h
|
||||
index b3279ee108..08ab970cb8 100644
|
||||
index b3279ee..08ab970 100644
|
||||
--- a/godot-mesa/src/microsoft/compiler/dxil_container.h
|
||||
+++ b/godot-mesa/src/microsoft/compiler/dxil_container.h
|
||||
@@ -123,10 +123,11 @@ dxil_container_add_state_validation(struct dxil_container *c,
|
||||
@@ -600,7 +610,7 @@ index b3279ee108..08ab970cb8 100644
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
diff --git a/godot-mesa/src/microsoft/compiler/dxil_module.c b/godot-mesa/src/microsoft/compiler/dxil_module.c
|
||||
index 773e5640a6..57b6a62ffd 100644
|
||||
index 6b7f455..af322a7 100644
|
||||
--- a/godot-mesa/src/microsoft/compiler/dxil_module.c
|
||||
+++ b/godot-mesa/src/microsoft/compiler/dxil_module.c
|
||||
@@ -32,6 +32,8 @@
|
||||
@@ -626,7 +636,7 @@ index 773e5640a6..57b6a62ffd 100644
|
||||
case TYPE_INTEGER:
|
||||
if (!emit_int_value(m, c->int_value))
|
||||
diff --git a/godot-mesa/src/microsoft/compiler/dxil_module.h b/godot-mesa/src/microsoft/compiler/dxil_module.h
|
||||
index ca170c5d2f..7fab628a22 100644
|
||||
index ca170c5..7fab628 100644
|
||||
--- a/godot-mesa/src/microsoft/compiler/dxil_module.h
|
||||
+++ b/godot-mesa/src/microsoft/compiler/dxil_module.h
|
||||
@@ -29,6 +29,8 @@
|
||||
@@ -647,57 +657,8 @@ index ca170c5d2f..7fab628a22 100644
|
||||
};
|
||||
|
||||
struct dxil_instr;
|
||||
diff --git a/godot-mesa/src/microsoft/compiler/dxil_validator.cpp b/godot-mesa/src/microsoft/compiler/dxil_validator.cpp
|
||||
index 4b68957a7d..a926ec991b 100644
|
||||
--- a/godot-mesa/src/microsoft/compiler/dxil_validator.cpp
|
||||
+++ b/godot-mesa/src/microsoft/compiler/dxil_validator.cpp
|
||||
@@ -25,6 +25,7 @@ struct dxil_validator {
|
||||
|
||||
extern "C" {
|
||||
extern IMAGE_DOS_HEADER __ImageBase;
|
||||
+extern char godot_nir_arch_name[32];
|
||||
}
|
||||
|
||||
static HMODULE
|
||||
@@ -36,7 +37,10 @@ load_dxil_mod()
|
||||
#elif defined (_GAMING_XBOX)
|
||||
HMODULE mod = LoadLibraryA("dxcompiler_x.dll");
|
||||
#else
|
||||
- HMODULE mod = LoadLibraryA("DXIL.dll");
|
||||
+ HMODULE mod = NULL;
|
||||
+ if (!godot_nir_arch_name[0]) {
|
||||
+ mod = LoadLibraryA("DXIL.dll");
|
||||
+ }
|
||||
#endif
|
||||
if (mod)
|
||||
return mod;
|
||||
@@ -60,12 +64,23 @@ load_dxil_mod()
|
||||
}
|
||||
|
||||
*(last_slash + 1) = '\0';
|
||||
+
|
||||
+ if (godot_nir_arch_name[0]) {
|
||||
+ strcat_s(self_path, godot_nir_arch_name);
|
||||
+ strcat_s(self_path, "\\");
|
||||
+ }
|
||||
+
|
||||
if (strcat_s(self_path, "DXIL.dll") != 0) {
|
||||
debug_printf("DXIL: Unable to get path to DXIL.dll next to self");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- return LoadLibraryA(self_path);
|
||||
+ mod = LoadLibraryA(self_path);
|
||||
+ if (mod)
|
||||
+ return mod;
|
||||
+
|
||||
+ godot_nir_arch_name[0] = '\0';
|
||||
+ return load_dxil_mod();
|
||||
}
|
||||
|
||||
static IDxcValidator *
|
||||
diff --git a/godot-mesa/src/microsoft/compiler/nir_to_dxil.c b/godot-mesa/src/microsoft/compiler/nir_to_dxil.c
|
||||
index 245c5140f9..d6c9d06c30 100644
|
||||
index c4de9dd..3c0223f 100644
|
||||
--- a/godot-mesa/src/microsoft/compiler/nir_to_dxil.c
|
||||
+++ b/godot-mesa/src/microsoft/compiler/nir_to_dxil.c
|
||||
@@ -43,6 +43,8 @@
|
||||
@@ -718,7 +679,7 @@ index 245c5140f9..d6c9d06c30 100644
|
||||
}
|
||||
|
||||
static const struct dxil_value *
|
||||
@@ -5079,6 +5083,12 @@ emit_intrinsic(struct ntd_context *ctx, nir_intrinsic_instr *intr)
|
||||
@@ -5091,6 +5095,12 @@ emit_intrinsic(struct ntd_context *ctx, nir_intrinsic_instr *intr)
|
||||
case nir_intrinsic_exclusive_scan:
|
||||
return emit_reduce(ctx, intr);
|
||||
|
||||
@@ -731,7 +692,7 @@ index 245c5140f9..d6c9d06c30 100644
|
||||
case nir_intrinsic_load_num_workgroups:
|
||||
case nir_intrinsic_load_workgroup_size:
|
||||
default:
|
||||
@@ -6644,6 +6653,7 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||
@@ -6656,6 +6666,7 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||
MIN2(opts->shader_model_max & 0xffff, validator_version & 0xffff);
|
||||
ctx->mod.major_validator = validator_version >> 16;
|
||||
ctx->mod.minor_validator = validator_version & 0xffff;
|
||||
@@ -739,7 +700,7 @@ index 245c5140f9..d6c9d06c30 100644
|
||||
|
||||
if (s->info.stage <= MESA_SHADER_FRAGMENT) {
|
||||
uint64_t in_mask =
|
||||
@@ -6762,19 +6772,23 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||
@@ -6774,19 +6785,23 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -766,7 +727,7 @@ index 245c5140f9..d6c9d06c30 100644
|
||||
static int shader_id = 0;
|
||||
char buffer[64];
|
||||
diff --git a/godot-mesa/src/microsoft/compiler/nir_to_dxil.h b/godot-mesa/src/microsoft/compiler/nir_to_dxil.h
|
||||
index bdfbe23953..b95ca1d79f 100644
|
||||
index bdfbe23..b95ca1d 100644
|
||||
--- a/godot-mesa/src/microsoft/compiler/nir_to_dxil.h
|
||||
+++ b/godot-mesa/src/microsoft/compiler/nir_to_dxil.h
|
||||
@@ -29,6 +29,8 @@
|
||||
@@ -787,7 +748,7 @@ index bdfbe23953..b95ca1d79f 100644
|
||||
|
||||
typedef void (*dxil_msg_callback)(void *priv, const char *msg);
|
||||
diff --git a/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.c b/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
|
||||
index 76cf6b007e..819339adf5 100644
|
||||
index 76cf6b0..819339a 100644
|
||||
--- a/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
|
||||
+++ b/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.c
|
||||
@@ -32,6 +32,8 @@
|
||||
@@ -816,7 +777,7 @@ index 76cf6b007e..819339adf5 100644
|
||||
|
||||
const struct spirv_to_nir_options *spirv_opts = dxil_spirv_nir_get_spirv_options();
|
||||
diff --git a/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.h b/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
|
||||
index 40adf761ef..30efbd16dd 100644
|
||||
index 40adf76..30efbd1 100644
|
||||
--- a/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
|
||||
+++ b/godot-mesa/src/microsoft/spirv_to_dxil/spirv_to_dxil.h
|
||||
@@ -30,6 +30,8 @@
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
import sys
|
||||
import macos_osxcross
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import os
|
||||
import sys
|
||||
from SCons.Script import ARGUMENTS
|
||||
from SCons.Variables import *
|
||||
from SCons.Variables import BoolVariable, EnumVariable
|
||||
from SCons.Variables.BoolVariable import _text2bool
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import my_spawn
|
||||
|
||||
from SCons.Tool import msvc, mingw
|
||||
from SCons.Variables import *
|
||||
from SCons.Variables import BoolVariable
|
||||
|
||||
|
||||
def options(opts):
|
||||
mingw = os.getenv("MINGW_PREFIX", "")
|
||||
|
||||
opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False))
|
||||
opts.Add(BoolVariable("use_clang_cl", "Use the clang driver instead of MSVC - only effective on Windows", False))
|
||||
opts.Add(BoolVariable("use_static_cpp", "Link MinGW/MSVC C++ runtime libraries statically", True))
|
||||
opts.Add(BoolVariable("debug_crt", "Compile with MSVC's debug CRT (/MDd)", False))
|
||||
opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler", False))
|
||||
opts.Add("mingw_prefix", "MinGW prefix", mingw)
|
||||
|
||||
|
||||
def exists(env):
|
||||
@@ -30,10 +34,15 @@ def generate(env):
|
||||
elif env["arch"] == "x86_32":
|
||||
env["TARGET_ARCH"] = "x86"
|
||||
|
||||
env["MSVC_SETUP_RUN"] = False # Need to set this to re-run the tool
|
||||
env["MSVS_VERSION"] = None
|
||||
env["MSVC_VERSION"] = None
|
||||
|
||||
env["is_msvc"] = True
|
||||
|
||||
# MSVC, linker, and archiver.
|
||||
msvc.generate(env)
|
||||
env.Tool("msvc")
|
||||
env.Tool("mslib")
|
||||
env.Tool("mslink")
|
||||
|
||||
@@ -53,7 +62,7 @@ def generate(env):
|
||||
env["CC"] = "clang-cl"
|
||||
env["CXX"] = "clang-cl"
|
||||
|
||||
elif sys.platform == "win32" or sys.platform == "msys":
|
||||
elif (sys.platform == "win32" or sys.platform == "msys") and not env["mingw_prefix"]:
|
||||
env["use_mingw"] = True
|
||||
mingw.generate(env)
|
||||
env.Append(CPPDEFINES=["MINGW_ENABLED"])
|
||||
@@ -68,25 +77,29 @@ def generate(env):
|
||||
else:
|
||||
env["use_mingw"] = True
|
||||
# Cross-compilation using MinGW
|
||||
prefix = ""
|
||||
if env["mingw_prefix"]:
|
||||
prefix = env["mingw_prefix"] + "/bin/"
|
||||
|
||||
if env["arch"] == "x86_64":
|
||||
prefix = "x86_64"
|
||||
prefix += "x86_64"
|
||||
elif env["arch"] == "arm64":
|
||||
prefix = "aarch64"
|
||||
prefix += "aarch64"
|
||||
elif env["arch"] == "arm32":
|
||||
prefix = "armv7"
|
||||
prefix += "armv7"
|
||||
elif env["arch"] == "x86_32":
|
||||
prefix = "i686"
|
||||
prefix += "i686"
|
||||
|
||||
if env["use_llvm"]:
|
||||
env["CXX"] = prefix + "-w64-mingw32-clang"
|
||||
env["CC"] = prefix + "-w64-mingw32-clang++"
|
||||
env["CXX"] = prefix + "-w64-mingw32-clang++"
|
||||
env["CC"] = prefix + "-w64-mingw32-clang"
|
||||
env["AR"] = prefix + "-w64-mingw32-ar"
|
||||
env["RANLIB"] = prefix + "-w64-mingw32-ranlib"
|
||||
env["LINK"] = prefix + "-w64-mingw32-clang"
|
||||
else:
|
||||
env["CXX"] = prefix + "-w64-mingw32-g++"
|
||||
env["CC"] = prefix + "-w64-mingw32-gcc"
|
||||
env["AR"] = prefix + "-w64-mingw32-ar"
|
||||
env["AR"] = prefix + "-w64-mingw32-gcc-ar"
|
||||
env["RANLIB"] = prefix + "-w64-mingw32-ranlib"
|
||||
env["LINK"] = prefix + "-w64-mingw32-g++"
|
||||
|
||||
@@ -105,3 +118,6 @@ def generate(env):
|
||||
"-Wl,--no-undefined",
|
||||
]
|
||||
)
|
||||
|
||||
if (sys.platform == "win32" or sys.platform == "msys"):
|
||||
my_spawn.configure(env)
|
||||
|
||||
Reference in New Issue
Block a user