diff options
| -rwxr-xr-x | .travis-upload.sh | 228 | ||||
| -rw-r--r-- | .travis.yml | 2 | ||||
| -rw-r--r-- | appveyor.yml | 12 | ||||
| m--------- | externals/cryptopp/cryptopp | 0 | ||||
| -rw-r--r-- | src/common/quaternion.h | 5 | ||||
| -rw-r--r-- | src/common/vector_math.h | 7 | ||||
| -rw-r--r-- | src/core/hle/service/cfg/cfg.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/dlp/dlp_clnt.cpp | 21 | ||||
| -rw-r--r-- | src/core/hle/service/dlp/dlp_fkcl.cpp | 18 | ||||
| -rw-r--r-- | src/core/hle/service/dlp/dlp_srvr.cpp | 9 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/video_core/command_processor.cpp | 62 | ||||
| -rw-r--r-- | src/video_core/pica_state.h | 2 | ||||
| -rw-r--r-- | src/video_core/regs_pipeline.h | 9 | ||||
| -rw-r--r-- | src/video_core/swrasterizer/clipper.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/swrasterizer/lighting.cpp | 250 | ||||
| -rw-r--r-- | src/video_core/swrasterizer/lighting.h | 18 | ||||
| -rw-r--r-- | src/video_core/swrasterizer/rasterizer.cpp | 29 |
18 files changed, 521 insertions, 166 deletions
diff --git a/.travis-upload.sh b/.travis-upload.sh index 8cfab31cb..17959b0e1 100755 --- a/.travis-upload.sh +++ b/.travis-upload.sh | |||
| @@ -1,134 +1,132 @@ | |||
| 1 | if [ "$TRAVIS_EVENT_TYPE" = "push" ]&&[ "$TRAVIS_BRANCH" = "master" ]; then | 1 | GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" |
| 2 | GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`" | 2 | GITREV="`git show -s --format='%h'`" |
| 3 | GITREV="`git show -s --format='%h'`" | 3 | mkdir -p artifacts |
| 4 | mkdir -p artifacts | 4 | |
| 5 | 5 | if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then | |
| 6 | if [ "$TRAVIS_OS_NAME" = "linux" -o -z "$TRAVIS_OS_NAME" ]; then | 6 | REV_NAME="citra-linux-${GITDATE}-${GITREV}" |
| 7 | REV_NAME="citra-linux-${GITDATE}-${GITREV}" | 7 | ARCHIVE_NAME="${REV_NAME}.tar.xz" |
| 8 | ARCHIVE_NAME="${REV_NAME}.tar.xz" | 8 | COMPRESSION_FLAGS="-cJvf" |
| 9 | COMPRESSION_FLAGS="-cJvf" | 9 | mkdir "$REV_NAME" |
| 10 | mkdir "$REV_NAME" | 10 | |
| 11 | 11 | cp build/src/citra/citra "$REV_NAME" | |
| 12 | cp build/src/citra/citra "$REV_NAME" | 12 | cp build/src/citra_qt/citra-qt "$REV_NAME" |
| 13 | cp build/src/citra_qt/citra-qt "$REV_NAME" | 13 | elif [ "$TRAVIS_OS_NAME" = "osx" ]; then |
| 14 | elif [ "$TRAVIS_OS_NAME" = "osx" ]; then | 14 | REV_NAME="citra-osx-${GITDATE}-${GITREV}" |
| 15 | REV_NAME="citra-osx-${GITDATE}-${GITREV}" | 15 | ARCHIVE_NAME="${REV_NAME}.tar.gz" |
| 16 | ARCHIVE_NAME="${REV_NAME}.tar.gz" | 16 | COMPRESSION_FLAGS="-czvf" |
| 17 | COMPRESSION_FLAGS="-czvf" | 17 | mkdir "$REV_NAME" |
| 18 | mkdir "$REV_NAME" | 18 | |
| 19 | 19 | cp build/src/citra/Release/citra "$REV_NAME" | |
| 20 | cp build/src/citra/Release/citra "$REV_NAME" | 20 | cp -r build/src/citra_qt/Release/citra-qt.app "$REV_NAME" |
| 21 | cp -r build/src/citra_qt/Release/citra-qt.app "$REV_NAME" | 21 | |
| 22 | 22 | # move qt libs into app bundle for deployment | |
| 23 | # move qt libs into app bundle for deployment | 23 | $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app" |
| 24 | $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app" | 24 | |
| 25 | 25 | # move SDL2 libs into folder for deployment | |
| 26 | # move SDL2 libs into folder for deployment | 26 | dylibbundler -b -x "${REV_NAME}/citra" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/" |
| 27 | dylibbundler -b -x "${REV_NAME}/citra" -cd -d "${REV_NAME}/libs" -p "@executable_path/libs/" | 27 | |
| 28 | 28 | # Make the changes to make the citra-qt app standalone (i.e. not dependent on the current brew installation). | |
| 29 | # Make the changes to make the citra-qt app standalone (i.e. not dependent on the current brew installation). | 29 | # To do this, the absolute references to each and every QT framework must be re-written to point to the local frameworks |
| 30 | # To do this, the absolute references to each and every QT framework must be re-written to point to the local frameworks | 30 | # (in the Contents/Frameworks folder). |
| 31 | # (in the Contents/Frameworks folder). | 31 | # The "install_name_tool" is used to do so. |
| 32 | # The "install_name_tool" is used to do so. | 32 | |
| 33 | 33 | # Coreutils is a hack to coerce Homebrew to point to the absolute Cellar path (symlink dereferenced). i.e: | |
| 34 | # Coreutils is a hack to coerce Homebrew to point to the absolute Cellar path (symlink dereferenced). i.e: | 34 | # ls -l /usr/local/opt/qt5:: /usr/local/opt/qt5 -> ../Cellar/qt5/5.6.1-1 |
| 35 | # ls -l /usr/local/opt/qt5:: /usr/local/opt/qt5 -> ../Cellar/qt5/5.6.1-1 | 35 | # grealpath ../Cellar/qt5/5.6.1-1:: /usr/local/Cellar/qt5/5.6.1-1 |
| 36 | # grealpath ../Cellar/qt5/5.6.1-1:: /usr/local/Cellar/qt5/5.6.1-1 | 36 | brew install coreutils |
| 37 | brew install coreutils | 37 | |
| 38 | 38 | REV_NAME_ALT=$REV_NAME/ | |
| 39 | REV_NAME_ALT=$REV_NAME/ | 39 | # grealpath is located in coreutils, there is no "realpath" for OS X :( |
| 40 | # grealpath is located in coreutils, there is no "realpath" for OS X :( | 40 | QT_BREWS_PATH=$(grealpath "$(brew --prefix qt5)") |
| 41 | QT_BREWS_PATH=$(grealpath "$(brew --prefix qt5)") | 41 | BREW_PATH=$(brew --prefix) |
| 42 | BREW_PATH=$(brew --prefix) | 42 | QT_VERSION_NUM=5 |
| 43 | QT_VERSION_NUM=5 | 43 | |
| 44 | 44 | $BREW_PATH/opt/qt5/bin/macdeployqt "${REV_NAME_ALT}citra-qt.app" \ | |
| 45 | $BREW_PATH/opt/qt5/bin/macdeployqt "${REV_NAME_ALT}citra-qt.app" \ | 45 | -executable="${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt" |
| 46 | -executable="${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt" | 46 | |
| 47 | 47 | # These are the files that macdeployqt packed into Contents/Frameworks/ - we don't want those, so we replace them. | |
| 48 | # These are the files that macdeployqt packed into Contents/Frameworks/ - we don't want those, so we replace them. | 48 | declare -a macos_libs=("QtCore" "QtWidgets" "QtGui" "QtOpenGL" "QtPrintSupport") |
| 49 | declare -a macos_libs=("QtCore" "QtWidgets" "QtGui" "QtOpenGL" "QtPrintSupport") | 49 | |
| 50 | 50 | for macos_lib in "${macos_libs[@]}" | |
| 51 | for macos_lib in "${macos_libs[@]}" | 51 | do |
| 52 | SC_FRAMEWORK_PART=$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib | ||
| 53 | # Replace macdeployqt versions of the Frameworks with our own (from /usr/local/opt/qt5/lib/) | ||
| 54 | cp "$BREW_PATH/opt/qt5/lib/$SC_FRAMEWORK_PART" "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 55 | |||
| 56 | # Replace references within the embedded Framework files with "internal" versions. | ||
| 57 | for macos_lib2 in "${macos_libs[@]}" | ||
| 52 | do | 58 | do |
| 53 | SC_FRAMEWORK_PART=$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib | 59 | # Since brew references both the non-symlinked and symlink paths of QT5, it needs to be duplicated. |
| 54 | # Replace macdeployqt versions of the Frameworks with our own (from /usr/local/opt/qt5/lib/) | 60 | # /usr/local/Cellar/qt5/5.6.1-1/lib and /usr/local/opt/qt5/lib both resolve to the same files. |
| 55 | cp "$BREW_PATH/opt/qt5/lib/$SC_FRAMEWORK_PART" "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | 61 | # So the two lines below are effectively duplicates when resolved as a path, but as strings, they aren't. |
| 56 | 62 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 | |
| 57 | # Replace references within the embedded Framework files with "internal" versions. | 63 | install_name_tool -change \ |
| 58 | for macos_lib2 in "${macos_libs[@]}" | 64 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ |
| 59 | do | 65 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ |
| 60 | # Since brew references both the non-symlinked and symlink paths of QT5, it needs to be duplicated. | 66 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" |
| 61 | # /usr/local/Cellar/qt5/5.6.1-1/lib and /usr/local/opt/qt5/lib both resolve to the same files. | 67 | install_name_tool -change \ |
| 62 | # So the two lines below are effectively duplicates when resolved as a path, but as strings, they aren't. | 68 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ |
| 63 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 | 69 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ |
| 64 | install_name_tool -change \ | 70 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" |
| 65 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ | ||
| 66 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 67 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 68 | install_name_tool -change \ | ||
| 69 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ | ||
| 70 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 71 | "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$SC_FRAMEWORK_PART" | ||
| 72 | done | ||
| 73 | done | 71 | done |
| 74 | 72 | done | |
| 75 | # Handles `This application failed to start because it could not find or load the Qt platform plugin "cocoa"` | 73 | |
| 76 | # Which manifests itself as: | 74 | # Handles `This application failed to start because it could not find or load the Qt platform plugin "cocoa"` |
| 77 | # "Exception Type: EXC_CRASH (SIGABRT) | Exception Codes: 0x0000000000000000, 0x0000000000000000 | Exception Note: EXC_CORPSE_NOTIFY" | 75 | # Which manifests itself as: |
| 78 | # There may be more dylibs needed to be fixed... | 76 | # "Exception Type: EXC_CRASH (SIGABRT) | Exception Codes: 0x0000000000000000, 0x0000000000000000 | Exception Note: EXC_CORPSE_NOTIFY" |
| 79 | declare -a macos_plugins=("Plugins/platforms/libqcocoa.dylib") | 77 | # There may be more dylibs needed to be fixed... |
| 80 | 78 | declare -a macos_plugins=("Plugins/platforms/libqcocoa.dylib") | |
| 81 | for macos_lib in "${macos_plugins[@]}" | 79 | |
| 80 | for macos_lib in "${macos_plugins[@]}" | ||
| 81 | do | ||
| 82 | install_name_tool -id @executable_path/../$macos_lib "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 83 | for macos_lib2 in "${macos_libs[@]}" | ||
| 82 | do | 84 | do |
| 83 | install_name_tool -id @executable_path/../$macos_lib "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | 85 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 |
| 84 | for macos_lib2 in "${macos_libs[@]}" | 86 | install_name_tool -change \ |
| 85 | do | 87 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ |
| 86 | RM_FRAMEWORK_PART=$macos_lib2.framework/Versions/$QT_VERSION_NUM/$macos_lib2 | 88 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ |
| 87 | install_name_tool -change \ | 89 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" |
| 88 | $QT_BREWS_PATH/lib/$RM_FRAMEWORK_PART \ | 90 | install_name_tool -change \ |
| 89 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | 91 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ |
| 90 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | 92 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ |
| 91 | install_name_tool -change \ | 93 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" |
| 92 | "$BREW_PATH/opt/qt5/lib/$RM_FRAMEWORK_PART" \ | ||
| 93 | @executable_path/../Frameworks/$RM_FRAMEWORK_PART \ | ||
| 94 | "${REV_NAME_ALT}citra-qt.app/Contents/$macos_lib" | ||
| 95 | done | ||
| 96 | done | 94 | done |
| 95 | done | ||
| 97 | 96 | ||
| 98 | for macos_lib in "${macos_libs[@]}" | 97 | for macos_lib in "${macos_libs[@]}" |
| 99 | do | 98 | do |
| 100 | # Debugging info for Travis-CI | 99 | # Debugging info for Travis-CI |
| 101 | otool -L "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib" | 100 | otool -L "${REV_NAME_ALT}citra-qt.app/Contents/Frameworks/$macos_lib.framework/Versions/$QT_VERSION_NUM/$macos_lib" |
| 102 | done | 101 | done |
| 103 | 102 | ||
| 104 | # Make the citra-qt.app application launch a debugging terminal. | 103 | # Make the citra-qt.app application launch a debugging terminal. |
| 105 | # Store away the actual binary | 104 | # Store away the actual binary |
| 106 | mv ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt-bin | 105 | mv ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt-bin |
| 107 | 106 | ||
| 108 | cat > ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt <<EOL | 107 | cat > ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt <<EOL |
| 109 | #!/usr/bin/env bash | 108 | #!/usr/bin/env bash |
| 110 | cd "\`dirname "\$0"\`" | 109 | cd "\`dirname "\$0"\`" |
| 111 | chmod +x citra-qt-bin | 110 | chmod +x citra-qt-bin |
| 112 | open citra-qt-bin --args "\$@" | 111 | open citra-qt-bin --args "\$@" |
| 113 | EOL | 112 | EOL |
| 114 | # Content that will serve as the launching script for citra (within the .app folder) | 113 | # Content that will serve as the launching script for citra (within the .app folder) |
| 115 | 114 | ||
| 116 | # Make the launching script executable | 115 | # Make the launching script executable |
| 117 | chmod +x ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt | 116 | chmod +x ${REV_NAME_ALT}citra-qt.app/Contents/MacOS/citra-qt |
| 118 | 117 | ||
| 119 | fi | 118 | fi |
| 120 | 119 | ||
| 121 | # Copy documentation | 120 | # Copy documentation |
| 122 | cp license.txt "$REV_NAME" | 121 | cp license.txt "$REV_NAME" |
| 123 | cp README.md "$REV_NAME" | 122 | cp README.md "$REV_NAME" |
| 124 | 123 | ||
| 125 | tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME" | 124 | tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME" |
| 126 | 125 | ||
| 127 | mv "$REV_NAME" nightly | 126 | mv "$REV_NAME" nightly |
| 128 | 127 | ||
| 129 | 7z a "$REV_NAME.7z" nightly | 128 | 7z a "$REV_NAME.7z" nightly |
| 130 | 129 | ||
| 131 | # move the compiled archive into the artifacts directory to be uploaded by travis releases | 130 | # move the compiled archive into the artifacts directory to be uploaded by travis releases |
| 132 | mv "$ARCHIVE_NAME" artifacts/ | 131 | mv "$ARCHIVE_NAME" artifacts/ |
| 133 | mv "$REV_NAME.7z" artifacts/ | 132 | mv "$REV_NAME.7z" artifacts/ |
| 134 | fi | ||
diff --git a/.travis.yml b/.travis.yml index 846758881..3da22eb5d 100644 --- a/.travis.yml +++ b/.travis.yml | |||
| @@ -37,4 +37,4 @@ deploy: | |||
| 37 | file: "artifacts/*" | 37 | file: "artifacts/*" |
| 38 | skip_cleanup: true | 38 | skip_cleanup: true |
| 39 | on: | 39 | on: |
| 40 | repo: citra-emu/citra-nightly | 40 | tags: true |
diff --git a/appveyor.yml b/appveyor.yml index d062a1f3e..eb4e7df87 100644 --- a/appveyor.yml +++ b/appveyor.yml | |||
| @@ -1,9 +1,6 @@ | |||
| 1 | # shallow clone | 1 | # shallow clone |
| 2 | clone_depth: 10 | 2 | clone_depth: 10 |
| 3 | 3 | ||
| 4 | # don't build on tag | ||
| 5 | skip_tags: true | ||
| 6 | |||
| 7 | cache: | 4 | cache: |
| 8 | - C:\ProgramData\chocolatey\bin -> appveyor.yml | 5 | - C:\ProgramData\chocolatey\bin -> appveyor.yml |
| 9 | - C:\ProgramData\chocolatey\lib -> appveyor.yml | 6 | - C:\ProgramData\chocolatey\lib -> appveyor.yml |
| @@ -72,16 +69,11 @@ artifacts: | |||
| 72 | 69 | ||
| 73 | deploy: | 70 | deploy: |
| 74 | provider: GitHub | 71 | provider: GitHub |
| 75 | release: nightly-$(appveyor_build_number) | 72 | release: $(appveyor_repo_tag_name) |
| 76 | description: | | ||
| 77 | Citra nightly releases. Please choose the correct download for your operating system from the list below. | ||
| 78 | |||
| 79 | Short Commit Hash $(GITREV) | ||
| 80 | auth_token: | 73 | auth_token: |
| 81 | secure: "dbpsMC/MgPKWFNJCXpQl4cR8FYhepkPLjgNp/pRMktZ8oLKTqPYErfreaIxb/4P1" | 74 | secure: "dbpsMC/MgPKWFNJCXpQl4cR8FYhepkPLjgNp/pRMktZ8oLKTqPYErfreaIxb/4P1" |
| 82 | artifact: msvcupdate,msvcbuild | 75 | artifact: msvcupdate,msvcbuild |
| 83 | draft: false | 76 | draft: false |
| 84 | prerelease: false | 77 | prerelease: false |
| 85 | on: | 78 | on: |
| 86 | branch: master | 79 | appveyor_repo_tag: true |
| 87 | appveyor_repo_name: citra-emu/citra-nightly | ||
diff --git a/externals/cryptopp/cryptopp b/externals/cryptopp/cryptopp | |||
| Subproject 841c37e34765487a2968357369ab74db8b10a62 | Subproject 24bc2b85674254fb294e717eb5b47d9f53e786b | ||
diff --git a/src/common/quaternion.h b/src/common/quaternion.h index 84ac82ed3..77f626bcb 100644 --- a/src/common/quaternion.h +++ b/src/common/quaternion.h | |||
| @@ -30,6 +30,11 @@ public: | |||
| 30 | return {xyz * other.w + other.xyz * w + Cross(xyz, other.xyz), | 30 | return {xyz * other.w + other.xyz * w + Cross(xyz, other.xyz), |
| 31 | w * other.w - Dot(xyz, other.xyz)}; | 31 | w * other.w - Dot(xyz, other.xyz)}; |
| 32 | } | 32 | } |
| 33 | |||
| 34 | Quaternion<T> Normalized() const { | ||
| 35 | T length = std::sqrt(xyz.Length2() + w * w); | ||
| 36 | return {xyz / length, w / length}; | ||
| 37 | } | ||
| 33 | }; | 38 | }; |
| 34 | 39 | ||
| 35 | template <typename T> | 40 | template <typename T> |
diff --git a/src/common/vector_math.h b/src/common/vector_math.h index c7a461a1e..6e2a5ad60 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h | |||
| @@ -31,7 +31,6 @@ | |||
| 31 | #pragma once | 31 | #pragma once |
| 32 | 32 | ||
| 33 | #include <cmath> | 33 | #include <cmath> |
| 34 | #include <type_traits> | ||
| 35 | 34 | ||
| 36 | namespace Math { | 35 | namespace Math { |
| 37 | 36 | ||
| @@ -90,7 +89,7 @@ public: | |||
| 90 | x -= other.x; | 89 | x -= other.x; |
| 91 | y -= other.y; | 90 | y -= other.y; |
| 92 | } | 91 | } |
| 93 | template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> | 92 | |
| 94 | Vec2<decltype(-T{})> operator-() const { | 93 | Vec2<decltype(-T{})> operator-() const { |
| 95 | return MakeVec(-x, -y); | 94 | return MakeVec(-x, -y); |
| 96 | } | 95 | } |
| @@ -247,7 +246,7 @@ public: | |||
| 247 | y -= other.y; | 246 | y -= other.y; |
| 248 | z -= other.z; | 247 | z -= other.z; |
| 249 | } | 248 | } |
| 250 | template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> | 249 | |
| 251 | Vec3<decltype(-T{})> operator-() const { | 250 | Vec3<decltype(-T{})> operator-() const { |
| 252 | return MakeVec(-x, -y, -z); | 251 | return MakeVec(-x, -y, -z); |
| 253 | } | 252 | } |
| @@ -462,7 +461,7 @@ public: | |||
| 462 | z -= other.z; | 461 | z -= other.z; |
| 463 | w -= other.w; | 462 | w -= other.w; |
| 464 | } | 463 | } |
| 465 | template <typename Q = T, class = typename std::enable_if<std::is_signed<Q>::value>::type> | 464 | |
| 466 | Vec4<decltype(-T{})> operator-() const { | 465 | Vec4<decltype(-T{})> operator-() const { |
| 467 | return MakeVec(-x, -y, -z, -w); | 466 | return MakeVec(-x, -y, -z, -w); |
| 468 | } | 467 | } |
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 6624f1711..3dbeb27cc 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp | |||
| @@ -681,7 +681,7 @@ void GenerateConsoleUniqueId(u32& random_number, u64& console_id) { | |||
| 681 | CryptoPP::AutoSeededRandomPool rng; | 681 | CryptoPP::AutoSeededRandomPool rng; |
| 682 | random_number = rng.GenerateWord32(0, 0xFFFF); | 682 | random_number = rng.GenerateWord32(0, 0xFFFF); |
| 683 | u64_le local_friend_code_seed; | 683 | u64_le local_friend_code_seed; |
| 684 | rng.GenerateBlock(reinterpret_cast<byte*>(&local_friend_code_seed), | 684 | rng.GenerateBlock(reinterpret_cast<CryptoPP::byte*>(&local_friend_code_seed), |
| 685 | sizeof(local_friend_code_seed)); | 685 | sizeof(local_friend_code_seed)); |
| 686 | console_id = (local_friend_code_seed & 0x3FFFFFFFF) | (static_cast<u64>(random_number) << 48); | 686 | console_id = (local_friend_code_seed & 0x3FFFFFFFF) | (static_cast<u64>(random_number) << 48); |
| 687 | } | 687 | } |
diff --git a/src/core/hle/service/dlp/dlp_clnt.cpp b/src/core/hle/service/dlp/dlp_clnt.cpp index 56f934b3f..6f2bf2061 100644 --- a/src/core/hle/service/dlp/dlp_clnt.cpp +++ b/src/core/hle/service/dlp/dlp_clnt.cpp | |||
| @@ -8,7 +8,26 @@ namespace Service { | |||
| 8 | namespace DLP { | 8 | namespace DLP { |
| 9 | 9 | ||
| 10 | const Interface::FunctionInfo FunctionTable[] = { | 10 | const Interface::FunctionInfo FunctionTable[] = { |
| 11 | {0x000100C3, nullptr, "Initialize"}, {0x00110000, nullptr, "GetWirelessRebootPassphrase"}, | 11 | {0x000100C3, nullptr, "Initialize"}, |
| 12 | {0x00020000, nullptr, "Finalize"}, | ||
| 13 | {0x00030000, nullptr, "GetEventDesc"}, | ||
| 14 | {0x00040000, nullptr, "GetChannel"}, | ||
| 15 | {0x00050180, nullptr, "StartScan"}, | ||
| 16 | {0x00060000, nullptr, "StopScan"}, | ||
| 17 | {0x00070080, nullptr, "GetServerInfo"}, | ||
| 18 | {0x00080100, nullptr, "GetTitleInfo"}, | ||
| 19 | {0x00090040, nullptr, "GetTitleInfoInOrder"}, | ||
| 20 | {0x000A0080, nullptr, "DeleteScanInfo"}, | ||
| 21 | {0x000B0100, nullptr, "PrepareForSystemDownload"}, | ||
| 22 | {0x000C0000, nullptr, "StartSystemDownload"}, | ||
| 23 | {0x000D0100, nullptr, "StartTitleDownload"}, | ||
| 24 | {0x000E0000, nullptr, "GetMyStatus"}, | ||
| 25 | {0x000F0040, nullptr, "GetConnectingNodes"}, | ||
| 26 | {0x00100040, nullptr, "GetNodeInfo"}, | ||
| 27 | {0x00110000, nullptr, "GetWirelessRebootPassphrase"}, | ||
| 28 | {0x00120000, nullptr, "StopSession"}, | ||
| 29 | {0x00130100, nullptr, "GetCupVersion"}, | ||
| 30 | {0x00140100, nullptr, "GetDupAvailability"}, | ||
| 12 | }; | 31 | }; |
| 13 | 32 | ||
| 14 | DLP_CLNT_Interface::DLP_CLNT_Interface() { | 33 | DLP_CLNT_Interface::DLP_CLNT_Interface() { |
diff --git a/src/core/hle/service/dlp/dlp_fkcl.cpp b/src/core/hle/service/dlp/dlp_fkcl.cpp index 29b9d52e0..fe6be7d32 100644 --- a/src/core/hle/service/dlp/dlp_fkcl.cpp +++ b/src/core/hle/service/dlp/dlp_fkcl.cpp | |||
| @@ -8,7 +8,23 @@ namespace Service { | |||
| 8 | namespace DLP { | 8 | namespace DLP { |
| 9 | 9 | ||
| 10 | const Interface::FunctionInfo FunctionTable[] = { | 10 | const Interface::FunctionInfo FunctionTable[] = { |
| 11 | {0x00010083, nullptr, "Initialize"}, {0x000F0000, nullptr, "GetWirelessRebootPassphrase"}, | 11 | {0x00010083, nullptr, "Initialize"}, |
| 12 | {0x00020000, nullptr, "Finalize"}, | ||
| 13 | {0x00030000, nullptr, "GetEventDesc"}, | ||
| 14 | {0x00040000, nullptr, "GetChannels"}, | ||
| 15 | {0x00050180, nullptr, "StartScan"}, | ||
| 16 | {0x00060000, nullptr, "StopScan"}, | ||
| 17 | {0x00070080, nullptr, "GetServerInfo"}, | ||
| 18 | {0x00080100, nullptr, "GetTitleInfo"}, | ||
| 19 | {0x00090040, nullptr, "GetTitleInfoInOrder"}, | ||
| 20 | {0x000A0080, nullptr, "DeleteScanInfo"}, | ||
| 21 | {0x000B0100, nullptr, "StartFakeSession"}, | ||
| 22 | {0x000C0000, nullptr, "GetMyStatus"}, | ||
| 23 | {0x000D0040, nullptr, "GetConnectingNodes"}, | ||
| 24 | {0x000E0040, nullptr, "GetNodeInfo"}, | ||
| 25 | {0x000F0000, nullptr, "GetWirelessRebootPassphrase"}, | ||
| 26 | {0x00100000, nullptr, "StopSession"}, | ||
| 27 | {0x00110203, nullptr, "Initialize2"}, | ||
| 12 | }; | 28 | }; |
| 13 | 29 | ||
| 14 | DLP_FKCL_Interface::DLP_FKCL_Interface() { | 30 | DLP_FKCL_Interface::DLP_FKCL_Interface() { |
diff --git a/src/core/hle/service/dlp/dlp_srvr.cpp b/src/core/hle/service/dlp/dlp_srvr.cpp index 32cfa2c44..1bcea43d3 100644 --- a/src/core/hle/service/dlp/dlp_srvr.cpp +++ b/src/core/hle/service/dlp/dlp_srvr.cpp | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | namespace Service { | 11 | namespace Service { |
| 12 | namespace DLP { | 12 | namespace DLP { |
| 13 | 13 | ||
| 14 | static void unk_0x000E0040(Interface* self) { | 14 | static void IsChild(Interface* self) { |
| 15 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 15 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 16 | 16 | ||
| 17 | cmd_buff[1] = RESULT_SUCCESS.raw; | 17 | cmd_buff[1] = RESULT_SUCCESS.raw; |
| @@ -24,14 +24,19 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 24 | {0x00010183, nullptr, "Initialize"}, | 24 | {0x00010183, nullptr, "Initialize"}, |
| 25 | {0x00020000, nullptr, "Finalize"}, | 25 | {0x00020000, nullptr, "Finalize"}, |
| 26 | {0x00030000, nullptr, "GetServerState"}, | 26 | {0x00030000, nullptr, "GetServerState"}, |
| 27 | {0x00040000, nullptr, "GetEventDescription"}, | ||
| 27 | {0x00050080, nullptr, "StartAccepting"}, | 28 | {0x00050080, nullptr, "StartAccepting"}, |
| 29 | {0x00060000, nullptr, "EndAccepting"}, | ||
| 28 | {0x00070000, nullptr, "StartDistribution"}, | 30 | {0x00070000, nullptr, "StartDistribution"}, |
| 29 | {0x000800C0, nullptr, "SendWirelessRebootPassphrase"}, | 31 | {0x000800C0, nullptr, "SendWirelessRebootPassphrase"}, |
| 30 | {0x00090040, nullptr, "AcceptClient"}, | 32 | {0x00090040, nullptr, "AcceptClient"}, |
| 33 | {0x000A0040, nullptr, "DisconnectClient"}, | ||
| 31 | {0x000B0042, nullptr, "GetConnectingClients"}, | 34 | {0x000B0042, nullptr, "GetConnectingClients"}, |
| 32 | {0x000C0040, nullptr, "GetClientInfo"}, | 35 | {0x000C0040, nullptr, "GetClientInfo"}, |
| 33 | {0x000D0040, nullptr, "GetClientState"}, | 36 | {0x000D0040, nullptr, "GetClientState"}, |
| 34 | {0x000E0040, unk_0x000E0040, "unk_0x000E0040"}, | 37 | {0x000E0040, IsChild, "IsChild"}, |
| 38 | {0x000F0303, nullptr, "InitializeWithName"}, | ||
| 39 | {0x00100000, nullptr, "GetDupNoticeNeed"}, | ||
| 35 | }; | 40 | }; |
| 36 | 41 | ||
| 37 | DLP_SRVR_Interface::DLP_SRVR_Interface() { | 42 | DLP_SRVR_Interface::DLP_SRVR_Interface() { |
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 0961a3251..cffa4c952 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -15,6 +15,7 @@ set(SRCS | |||
| 15 | shader/shader_interpreter.cpp | 15 | shader/shader_interpreter.cpp |
| 16 | swrasterizer/clipper.cpp | 16 | swrasterizer/clipper.cpp |
| 17 | swrasterizer/framebuffer.cpp | 17 | swrasterizer/framebuffer.cpp |
| 18 | swrasterizer/lighting.cpp | ||
| 18 | swrasterizer/proctex.cpp | 19 | swrasterizer/proctex.cpp |
| 19 | swrasterizer/rasterizer.cpp | 20 | swrasterizer/rasterizer.cpp |
| 20 | swrasterizer/swrasterizer.cpp | 21 | swrasterizer/swrasterizer.cpp |
| @@ -55,6 +56,7 @@ set(HEADERS | |||
| 55 | shader/shader_interpreter.h | 56 | shader/shader_interpreter.h |
| 56 | swrasterizer/clipper.h | 57 | swrasterizer/clipper.h |
| 57 | swrasterizer/framebuffer.h | 58 | swrasterizer/framebuffer.h |
| 59 | swrasterizer/lighting.h | ||
| 58 | swrasterizer/proctex.h | 60 | swrasterizer/proctex.h |
| 59 | swrasterizer/rasterizer.h | 61 | swrasterizer/rasterizer.h |
| 60 | swrasterizer/swrasterizer.h | 62 | swrasterizer/swrasterizer.h |
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 4633a1df1..f98ca3302 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -119,27 +119,6 @@ static void WriteUniformFloatReg(ShaderRegs& config, Shader::ShaderSetup& setup, | |||
| 119 | } | 119 | } |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | static void WriteProgramCode(ShaderRegs& config, Shader::ShaderSetup& setup, | ||
| 123 | unsigned max_program_code_length, u32 value) { | ||
| 124 | if (config.program.offset >= max_program_code_length) { | ||
| 125 | LOG_ERROR(HW_GPU, "Invalid %s program offset %d", GetShaderSetupTypeName(setup), | ||
| 126 | (int)config.program.offset); | ||
| 127 | } else { | ||
| 128 | setup.program_code[config.program.offset] = value; | ||
| 129 | config.program.offset++; | ||
| 130 | } | ||
| 131 | } | ||
| 132 | |||
| 133 | static void WriteSwizzlePatterns(ShaderRegs& config, Shader::ShaderSetup& setup, u32 value) { | ||
| 134 | if (config.swizzle_patterns.offset >= setup.swizzle_data.size()) { | ||
| 135 | LOG_ERROR(HW_GPU, "Invalid %s swizzle pattern offset %d", GetShaderSetupTypeName(setup), | ||
| 136 | (int)config.swizzle_patterns.offset); | ||
| 137 | } else { | ||
| 138 | setup.swizzle_data[config.swizzle_patterns.offset] = value; | ||
| 139 | config.swizzle_patterns.offset++; | ||
| 140 | } | ||
| 141 | } | ||
| 142 | |||
| 143 | static void WritePicaReg(u32 id, u32 value, u32 mask) { | 122 | static void WritePicaReg(u32 id, u32 value, u32 mask) { |
| 144 | auto& regs = g_state.regs; | 123 | auto& regs = g_state.regs; |
| 145 | 124 | ||
| @@ -458,7 +437,13 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 458 | case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[5], 0x2a1): | 437 | case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[5], 0x2a1): |
| 459 | case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[6], 0x2a2): | 438 | case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[6], 0x2a2): |
| 460 | case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[7], 0x2a3): { | 439 | case PICA_REG_INDEX_WORKAROUND(gs.program.set_word[7], 0x2a3): { |
| 461 | WriteProgramCode(g_state.regs.gs, g_state.gs, 4096, value); | 440 | u32& offset = g_state.regs.gs.program.offset; |
| 441 | if (offset >= 4096) { | ||
| 442 | LOG_ERROR(HW_GPU, "Invalid GS program offset %u", offset); | ||
| 443 | } else { | ||
| 444 | g_state.gs.program_code[offset] = value; | ||
| 445 | offset++; | ||
| 446 | } | ||
| 462 | break; | 447 | break; |
| 463 | } | 448 | } |
| 464 | 449 | ||
| @@ -470,11 +455,18 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 470 | case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[5], 0x2ab): | 455 | case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[5], 0x2ab): |
| 471 | case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[6], 0x2ac): | 456 | case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[6], 0x2ac): |
| 472 | case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[7], 0x2ad): { | 457 | case PICA_REG_INDEX_WORKAROUND(gs.swizzle_patterns.set_word[7], 0x2ad): { |
| 473 | WriteSwizzlePatterns(g_state.regs.gs, g_state.gs, value); | 458 | u32& offset = g_state.regs.gs.swizzle_patterns.offset; |
| 459 | if (offset >= g_state.gs.swizzle_data.size()) { | ||
| 460 | LOG_ERROR(HW_GPU, "Invalid GS swizzle pattern offset %u", offset); | ||
| 461 | } else { | ||
| 462 | g_state.gs.swizzle_data[offset] = value; | ||
| 463 | offset++; | ||
| 464 | } | ||
| 474 | break; | 465 | break; |
| 475 | } | 466 | } |
| 476 | 467 | ||
| 477 | case PICA_REG_INDEX(vs.bool_uniforms): | 468 | case PICA_REG_INDEX(vs.bool_uniforms): |
| 469 | // TODO (wwylele): does regs.pipeline.gs_unit_exclusive_configuration affect this? | ||
| 478 | WriteUniformBoolReg(g_state.vs, g_state.regs.vs.bool_uniforms.Value()); | 470 | WriteUniformBoolReg(g_state.vs, g_state.regs.vs.bool_uniforms.Value()); |
| 479 | break; | 471 | break; |
| 480 | 472 | ||
| @@ -482,6 +474,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 482 | case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[1], 0x2b2): | 474 | case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[1], 0x2b2): |
| 483 | case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[2], 0x2b3): | 475 | case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[2], 0x2b3): |
| 484 | case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[3], 0x2b4): { | 476 | case PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[3], 0x2b4): { |
| 477 | // TODO (wwylele): does regs.pipeline.gs_unit_exclusive_configuration affect this? | ||
| 485 | unsigned index = (id - PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[0], 0x2b1)); | 478 | unsigned index = (id - PICA_REG_INDEX_WORKAROUND(vs.int_uniforms[0], 0x2b1)); |
| 486 | auto values = regs.vs.int_uniforms[index]; | 479 | auto values = regs.vs.int_uniforms[index]; |
| 487 | WriteUniformIntReg(g_state.vs, index, | 480 | WriteUniformIntReg(g_state.vs, index, |
| @@ -497,6 +490,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 497 | case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[5], 0x2c6): | 490 | case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[5], 0x2c6): |
| 498 | case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[6], 0x2c7): | 491 | case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[6], 0x2c7): |
| 499 | case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[7], 0x2c8): { | 492 | case PICA_REG_INDEX_WORKAROUND(vs.uniform_setup.set_value[7], 0x2c8): { |
| 493 | // TODO (wwylele): does regs.pipeline.gs_unit_exclusive_configuration affect this? | ||
| 500 | WriteUniformFloatReg(g_state.regs.vs, g_state.vs, vs_float_regs_counter, | 494 | WriteUniformFloatReg(g_state.regs.vs, g_state.vs, vs_float_regs_counter, |
| 501 | vs_uniform_write_buffer, value); | 495 | vs_uniform_write_buffer, value); |
| 502 | break; | 496 | break; |
| @@ -510,7 +504,16 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 510 | case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[5], 0x2d1): | 504 | case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[5], 0x2d1): |
| 511 | case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[6], 0x2d2): | 505 | case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[6], 0x2d2): |
| 512 | case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[7], 0x2d3): { | 506 | case PICA_REG_INDEX_WORKAROUND(vs.program.set_word[7], 0x2d3): { |
| 513 | WriteProgramCode(g_state.regs.vs, g_state.vs, 512, value); | 507 | u32& offset = g_state.regs.vs.program.offset; |
| 508 | if (offset >= 512) { | ||
| 509 | LOG_ERROR(HW_GPU, "Invalid VS program offset %u", offset); | ||
| 510 | } else { | ||
| 511 | g_state.vs.program_code[offset] = value; | ||
| 512 | if (!g_state.regs.pipeline.gs_unit_exclusive_configuration) { | ||
| 513 | g_state.gs.program_code[offset] = value; | ||
| 514 | } | ||
| 515 | offset++; | ||
| 516 | } | ||
| 514 | break; | 517 | break; |
| 515 | } | 518 | } |
| 516 | 519 | ||
| @@ -522,7 +525,16 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 522 | case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[5], 0x2db): | 525 | case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[5], 0x2db): |
| 523 | case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[6], 0x2dc): | 526 | case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[6], 0x2dc): |
| 524 | case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[7], 0x2dd): { | 527 | case PICA_REG_INDEX_WORKAROUND(vs.swizzle_patterns.set_word[7], 0x2dd): { |
| 525 | WriteSwizzlePatterns(g_state.regs.vs, g_state.vs, value); | 528 | u32& offset = g_state.regs.vs.swizzle_patterns.offset; |
| 529 | if (offset >= g_state.vs.swizzle_data.size()) { | ||
| 530 | LOG_ERROR(HW_GPU, "Invalid VS swizzle pattern offset %u", offset); | ||
| 531 | } else { | ||
| 532 | g_state.vs.swizzle_data[offset] = value; | ||
| 533 | if (!g_state.regs.pipeline.gs_unit_exclusive_configuration) { | ||
| 534 | g_state.gs.swizzle_data[offset] = value; | ||
| 535 | } | ||
| 536 | offset++; | ||
| 537 | } | ||
| 526 | break; | 538 | break; |
| 527 | } | 539 | } |
| 528 | 540 | ||
diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h index 2d23d34e6..864a2c9e6 100644 --- a/src/video_core/pica_state.h +++ b/src/video_core/pica_state.h | |||
| @@ -79,7 +79,7 @@ struct State { | |||
| 79 | std::array<ColorDifferenceEntry, 256> color_diff_table; | 79 | std::array<ColorDifferenceEntry, 256> color_diff_table; |
| 80 | } proctex; | 80 | } proctex; |
| 81 | 81 | ||
| 82 | struct { | 82 | struct Lighting { |
| 83 | union LutEntry { | 83 | union LutEntry { |
| 84 | // Used for raw access | 84 | // Used for raw access |
| 85 | u32 raw; | 85 | u32 raw; |
diff --git a/src/video_core/regs_pipeline.h b/src/video_core/regs_pipeline.h index 31c747d77..8b6369297 100644 --- a/src/video_core/regs_pipeline.h +++ b/src/video_core/regs_pipeline.h | |||
| @@ -202,7 +202,14 @@ struct PipelineRegs { | |||
| 202 | /// Number of input attributes to the vertex shader minus 1 | 202 | /// Number of input attributes to the vertex shader minus 1 |
| 203 | BitField<0, 4, u32> max_input_attrib_index; | 203 | BitField<0, 4, u32> max_input_attrib_index; |
| 204 | 204 | ||
| 205 | INSERT_PADDING_WORDS(2); | 205 | INSERT_PADDING_WORDS(1); |
| 206 | |||
| 207 | // The shader unit 3, which can be used for both vertex and geometry shader, gets its | ||
| 208 | // configuration depending on this register. If this is not set, unit 3 will share some | ||
| 209 | // configuration with other units. It is known that program code and swizzle pattern uploaded | ||
| 210 | // via regs.vs will be also uploaded to unit 3 if this is not set. Although very likely, it is | ||
| 211 | // still unclear whether uniforms and other configuration can be also shared. | ||
| 212 | BitField<0, 1, u32> gs_unit_exclusive_configuration; | ||
| 206 | 213 | ||
| 207 | enum class GPUMode : u32 { | 214 | enum class GPUMode : u32 { |
| 208 | Drawing = 0, | 215 | Drawing = 0, |
diff --git a/src/video_core/swrasterizer/clipper.cpp b/src/video_core/swrasterizer/clipper.cpp index 6fb923756..7537689b7 100644 --- a/src/video_core/swrasterizer/clipper.cpp +++ b/src/video_core/swrasterizer/clipper.cpp | |||
| @@ -95,6 +95,17 @@ void ProcessTriangle(const OutputVertex& v0, const OutputVertex& v1, const Outpu | |||
| 95 | static const size_t MAX_VERTICES = 9; | 95 | static const size_t MAX_VERTICES = 9; |
| 96 | static_vector<Vertex, MAX_VERTICES> buffer_a = {v0, v1, v2}; | 96 | static_vector<Vertex, MAX_VERTICES> buffer_a = {v0, v1, v2}; |
| 97 | static_vector<Vertex, MAX_VERTICES> buffer_b; | 97 | static_vector<Vertex, MAX_VERTICES> buffer_b; |
| 98 | |||
| 99 | auto FlipQuaternionIfOpposite = [](auto& a, const auto& b) { | ||
| 100 | if (Math::Dot(a, b) < float24::Zero()) | ||
| 101 | a = -a; | ||
| 102 | }; | ||
| 103 | |||
| 104 | // Flip the quaternions if they are opposite to prevent interpolating them over the wrong | ||
| 105 | // direction. | ||
| 106 | FlipQuaternionIfOpposite(buffer_a[1].quat, buffer_a[0].quat); | ||
| 107 | FlipQuaternionIfOpposite(buffer_a[2].quat, buffer_a[0].quat); | ||
| 108 | |||
| 98 | auto* output_list = &buffer_a; | 109 | auto* output_list = &buffer_a; |
| 99 | auto* input_list = &buffer_b; | 110 | auto* input_list = &buffer_b; |
| 100 | 111 | ||
diff --git a/src/video_core/swrasterizer/lighting.cpp b/src/video_core/swrasterizer/lighting.cpp new file mode 100644 index 000000000..d61e6d572 --- /dev/null +++ b/src/video_core/swrasterizer/lighting.cpp | |||
| @@ -0,0 +1,250 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/math_util.h" | ||
| 6 | #include "video_core/swrasterizer/lighting.h" | ||
| 7 | |||
| 8 | namespace Pica { | ||
| 9 | |||
| 10 | static float LookupLightingLut(const Pica::State::Lighting& lighting, size_t lut_index, u8 index, | ||
| 11 | float delta) { | ||
| 12 | ASSERT_MSG(lut_index < lighting.luts.size(), "Out of range lut"); | ||
| 13 | ASSERT_MSG(index < lighting.luts[lut_index].size(), "Out of range index"); | ||
| 14 | |||
| 15 | const auto& lut = lighting.luts[lut_index][index]; | ||
| 16 | |||
| 17 | float lut_value = lut.ToFloat(); | ||
| 18 | float lut_diff = lut.DiffToFloat(); | ||
| 19 | |||
| 20 | return lut_value + lut_diff * delta; | ||
| 21 | } | ||
| 22 | |||
| 23 | std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors( | ||
| 24 | const Pica::LightingRegs& lighting, const Pica::State::Lighting& lighting_state, | ||
| 25 | const Math::Quaternion<float>& normquat, const Math::Vec3<float>& view) { | ||
| 26 | |||
| 27 | // TODO(Subv): Bump mapping | ||
| 28 | Math::Vec3<float> surface_normal = {0.0f, 0.0f, 1.0f}; | ||
| 29 | |||
| 30 | if (lighting.config0.bump_mode != LightingRegs::LightingBumpMode::None) { | ||
| 31 | LOG_CRITICAL(HW_GPU, "unimplemented bump mapping"); | ||
| 32 | UNIMPLEMENTED(); | ||
| 33 | } | ||
| 34 | |||
| 35 | // Use the normalized the quaternion when performing the rotation | ||
| 36 | auto normal = Math::QuaternionRotate(normquat, surface_normal); | ||
| 37 | |||
| 38 | Math::Vec4<float> diffuse_sum = {0.0f, 0.0f, 0.0f, 1.0f}; | ||
| 39 | Math::Vec4<float> specular_sum = {0.0f, 0.0f, 0.0f, 1.0f}; | ||
| 40 | |||
| 41 | for (unsigned light_index = 0; light_index <= lighting.max_light_index; ++light_index) { | ||
| 42 | unsigned num = lighting.light_enable.GetNum(light_index); | ||
| 43 | const auto& light_config = lighting.light[num]; | ||
| 44 | |||
| 45 | Math::Vec3<float> refl_value = {}; | ||
| 46 | Math::Vec3<float> position = {float16::FromRaw(light_config.x).ToFloat32(), | ||
| 47 | float16::FromRaw(light_config.y).ToFloat32(), | ||
| 48 | float16::FromRaw(light_config.z).ToFloat32()}; | ||
| 49 | Math::Vec3<float> light_vector; | ||
| 50 | |||
| 51 | if (light_config.config.directional) | ||
| 52 | light_vector = position; | ||
| 53 | else | ||
| 54 | light_vector = position + view; | ||
| 55 | |||
| 56 | light_vector.Normalize(); | ||
| 57 | |||
| 58 | float dist_atten = 1.0f; | ||
| 59 | if (!lighting.IsDistAttenDisabled(num)) { | ||
| 60 | auto distance = (-view - position).Length(); | ||
| 61 | float scale = Pica::float20::FromRaw(light_config.dist_atten_scale).ToFloat32(); | ||
| 62 | float bias = Pica::float20::FromRaw(light_config.dist_atten_bias).ToFloat32(); | ||
| 63 | size_t lut = | ||
| 64 | static_cast<size_t>(LightingRegs::LightingSampler::DistanceAttenuation) + num; | ||
| 65 | |||
| 66 | float sample_loc = MathUtil::Clamp(scale * distance + bias, 0.0f, 1.0f); | ||
| 67 | |||
| 68 | u8 lutindex = | ||
| 69 | static_cast<u8>(MathUtil::Clamp(std::floor(sample_loc * 256.0f), 0.0f, 255.0f)); | ||
| 70 | float delta = sample_loc * 256 - lutindex; | ||
| 71 | dist_atten = LookupLightingLut(lighting_state, lut, lutindex, delta); | ||
| 72 | } | ||
| 73 | |||
| 74 | auto GetLutValue = [&](LightingRegs::LightingLutInput input, bool abs, | ||
| 75 | LightingRegs::LightingScale scale_enum, | ||
| 76 | LightingRegs::LightingSampler sampler) { | ||
| 77 | Math::Vec3<float> norm_view = view.Normalized(); | ||
| 78 | Math::Vec3<float> half_angle = (norm_view + light_vector).Normalized(); | ||
| 79 | float result = 0.0f; | ||
| 80 | |||
| 81 | switch (input) { | ||
| 82 | case LightingRegs::LightingLutInput::NH: | ||
| 83 | result = Math::Dot(normal, half_angle); | ||
| 84 | break; | ||
| 85 | |||
| 86 | case LightingRegs::LightingLutInput::VH: | ||
| 87 | result = Math::Dot(norm_view, half_angle); | ||
| 88 | break; | ||
| 89 | |||
| 90 | case LightingRegs::LightingLutInput::NV: | ||
| 91 | result = Math::Dot(normal, norm_view); | ||
| 92 | break; | ||
| 93 | |||
| 94 | case LightingRegs::LightingLutInput::LN: | ||
| 95 | result = Math::Dot(light_vector, normal); | ||
| 96 | break; | ||
| 97 | |||
| 98 | default: | ||
| 99 | LOG_CRITICAL(HW_GPU, "Unknown lighting LUT input %u\n", static_cast<u32>(input)); | ||
| 100 | UNIMPLEMENTED(); | ||
| 101 | result = 0.0f; | ||
| 102 | } | ||
| 103 | |||
| 104 | u8 index; | ||
| 105 | float delta; | ||
| 106 | |||
| 107 | if (abs) { | ||
| 108 | if (light_config.config.two_sided_diffuse) | ||
| 109 | result = std::abs(result); | ||
| 110 | else | ||
| 111 | result = std::max(result, 0.0f); | ||
| 112 | |||
| 113 | float flr = std::floor(result * 256.0f); | ||
| 114 | index = static_cast<u8>(MathUtil::Clamp(flr, 0.0f, 255.0f)); | ||
| 115 | delta = result * 256 - index; | ||
| 116 | } else { | ||
| 117 | float flr = std::floor(result * 128.0f); | ||
| 118 | s8 signed_index = static_cast<s8>(MathUtil::Clamp(flr, -128.0f, 127.0f)); | ||
| 119 | delta = result * 128.0f - signed_index; | ||
| 120 | index = static_cast<u8>(signed_index); | ||
| 121 | } | ||
| 122 | |||
| 123 | float scale = lighting.lut_scale.GetScale(scale_enum); | ||
| 124 | return scale * | ||
| 125 | LookupLightingLut(lighting_state, static_cast<size_t>(sampler), index, delta); | ||
| 126 | }; | ||
| 127 | |||
| 128 | // Specular 0 component | ||
| 129 | float d0_lut_value = 1.0f; | ||
| 130 | if (lighting.config1.disable_lut_d0 == 0 && | ||
| 131 | LightingRegs::IsLightingSamplerSupported( | ||
| 132 | lighting.config0.config, LightingRegs::LightingSampler::Distribution0)) { | ||
| 133 | d0_lut_value = | ||
| 134 | GetLutValue(lighting.lut_input.d0, lighting.abs_lut_input.disable_d0 == 0, | ||
| 135 | lighting.lut_scale.d0, LightingRegs::LightingSampler::Distribution0); | ||
| 136 | } | ||
| 137 | |||
| 138 | Math::Vec3<float> specular_0 = d0_lut_value * light_config.specular_0.ToVec3f(); | ||
| 139 | |||
| 140 | // If enabled, lookup ReflectRed value, otherwise, 1.0 is used | ||
| 141 | if (lighting.config1.disable_lut_rr == 0 && | ||
| 142 | LightingRegs::IsLightingSamplerSupported(lighting.config0.config, | ||
| 143 | LightingRegs::LightingSampler::ReflectRed)) { | ||
| 144 | refl_value.x = | ||
| 145 | GetLutValue(lighting.lut_input.rr, lighting.abs_lut_input.disable_rr == 0, | ||
| 146 | lighting.lut_scale.rr, LightingRegs::LightingSampler::ReflectRed); | ||
| 147 | } else { | ||
| 148 | refl_value.x = 1.0f; | ||
| 149 | } | ||
| 150 | |||
| 151 | // If enabled, lookup ReflectGreen value, otherwise, ReflectRed value is used | ||
| 152 | if (lighting.config1.disable_lut_rg == 0 && | ||
| 153 | LightingRegs::IsLightingSamplerSupported(lighting.config0.config, | ||
| 154 | LightingRegs::LightingSampler::ReflectGreen)) { | ||
| 155 | refl_value.y = | ||
| 156 | GetLutValue(lighting.lut_input.rg, lighting.abs_lut_input.disable_rg == 0, | ||
| 157 | lighting.lut_scale.rg, LightingRegs::LightingSampler::ReflectGreen); | ||
| 158 | } else { | ||
| 159 | refl_value.y = refl_value.x; | ||
| 160 | } | ||
| 161 | |||
| 162 | // If enabled, lookup ReflectBlue value, otherwise, ReflectRed value is used | ||
| 163 | if (lighting.config1.disable_lut_rb == 0 && | ||
| 164 | LightingRegs::IsLightingSamplerSupported(lighting.config0.config, | ||
| 165 | LightingRegs::LightingSampler::ReflectBlue)) { | ||
| 166 | refl_value.z = | ||
| 167 | GetLutValue(lighting.lut_input.rb, lighting.abs_lut_input.disable_rb == 0, | ||
| 168 | lighting.lut_scale.rb, LightingRegs::LightingSampler::ReflectBlue); | ||
| 169 | } else { | ||
| 170 | refl_value.z = refl_value.x; | ||
| 171 | } | ||
| 172 | |||
| 173 | // Specular 1 component | ||
| 174 | float d1_lut_value = 1.0f; | ||
| 175 | if (lighting.config1.disable_lut_d1 == 0 && | ||
| 176 | LightingRegs::IsLightingSamplerSupported( | ||
| 177 | lighting.config0.config, LightingRegs::LightingSampler::Distribution1)) { | ||
| 178 | d1_lut_value = | ||
| 179 | GetLutValue(lighting.lut_input.d1, lighting.abs_lut_input.disable_d1 == 0, | ||
| 180 | lighting.lut_scale.d1, LightingRegs::LightingSampler::Distribution1); | ||
| 181 | } | ||
| 182 | |||
| 183 | Math::Vec3<float> specular_1 = | ||
| 184 | d1_lut_value * refl_value * light_config.specular_1.ToVec3f(); | ||
| 185 | |||
| 186 | // Fresnel | ||
| 187 | if (lighting.config1.disable_lut_fr == 0 && | ||
| 188 | LightingRegs::IsLightingSamplerSupported(lighting.config0.config, | ||
| 189 | LightingRegs::LightingSampler::Fresnel)) { | ||
| 190 | |||
| 191 | float lut_value = | ||
| 192 | GetLutValue(lighting.lut_input.fr, lighting.abs_lut_input.disable_fr == 0, | ||
| 193 | lighting.lut_scale.fr, LightingRegs::LightingSampler::Fresnel); | ||
| 194 | |||
| 195 | // Enabled for diffuse lighting alpha component | ||
| 196 | if (lighting.config0.fresnel_selector == | ||
| 197 | LightingRegs::LightingFresnelSelector::PrimaryAlpha || | ||
| 198 | lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) { | ||
| 199 | diffuse_sum.a() *= lut_value; | ||
| 200 | } | ||
| 201 | |||
| 202 | // Enabled for the specular lighting alpha component | ||
| 203 | if (lighting.config0.fresnel_selector == | ||
| 204 | LightingRegs::LightingFresnelSelector::SecondaryAlpha || | ||
| 205 | lighting.config0.fresnel_selector == LightingRegs::LightingFresnelSelector::Both) { | ||
| 206 | specular_sum.a() *= lut_value; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | |||
| 210 | auto dot_product = Math::Dot(light_vector, normal); | ||
| 211 | |||
| 212 | // Calculate clamp highlights before applying the two-sided diffuse configuration to the dot | ||
| 213 | // product. | ||
| 214 | float clamp_highlights = 1.0f; | ||
| 215 | if (lighting.config0.clamp_highlights) { | ||
| 216 | if (dot_product <= 0.0f) | ||
| 217 | clamp_highlights = 0.0f; | ||
| 218 | else | ||
| 219 | clamp_highlights = 1.0f; | ||
| 220 | } | ||
| 221 | |||
| 222 | if (light_config.config.two_sided_diffuse) | ||
| 223 | dot_product = std::abs(dot_product); | ||
| 224 | else | ||
| 225 | dot_product = std::max(dot_product, 0.0f); | ||
| 226 | |||
| 227 | auto diffuse = | ||
| 228 | light_config.diffuse.ToVec3f() * dot_product + light_config.ambient.ToVec3f(); | ||
| 229 | diffuse_sum += Math::MakeVec(diffuse * dist_atten, 0.0f); | ||
| 230 | |||
| 231 | specular_sum += | ||
| 232 | Math::MakeVec((specular_0 + specular_1) * clamp_highlights * dist_atten, 0.0f); | ||
| 233 | } | ||
| 234 | |||
| 235 | diffuse_sum += Math::MakeVec(lighting.global_ambient.ToVec3f(), 0.0f); | ||
| 236 | |||
| 237 | auto diffuse = Math::MakeVec<float>(MathUtil::Clamp(diffuse_sum.x, 0.0f, 1.0f) * 255, | ||
| 238 | MathUtil::Clamp(diffuse_sum.y, 0.0f, 1.0f) * 255, | ||
| 239 | MathUtil::Clamp(diffuse_sum.z, 0.0f, 1.0f) * 255, | ||
| 240 | MathUtil::Clamp(diffuse_sum.w, 0.0f, 1.0f) * 255) | ||
| 241 | .Cast<u8>(); | ||
| 242 | auto specular = Math::MakeVec<float>(MathUtil::Clamp(specular_sum.x, 0.0f, 1.0f) * 255, | ||
| 243 | MathUtil::Clamp(specular_sum.y, 0.0f, 1.0f) * 255, | ||
| 244 | MathUtil::Clamp(specular_sum.z, 0.0f, 1.0f) * 255, | ||
| 245 | MathUtil::Clamp(specular_sum.w, 0.0f, 1.0f) * 255) | ||
| 246 | .Cast<u8>(); | ||
| 247 | return std::make_tuple(diffuse, specular); | ||
| 248 | } | ||
| 249 | |||
| 250 | } // namespace Pica | ||
diff --git a/src/video_core/swrasterizer/lighting.h b/src/video_core/swrasterizer/lighting.h new file mode 100644 index 000000000..438dca926 --- /dev/null +++ b/src/video_core/swrasterizer/lighting.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <tuple> | ||
| 8 | #include "common/quaternion.h" | ||
| 9 | #include "common/vector_math.h" | ||
| 10 | #include "video_core/pica_state.h" | ||
| 11 | |||
| 12 | namespace Pica { | ||
| 13 | |||
| 14 | std::tuple<Math::Vec4<u8>, Math::Vec4<u8>> ComputeFragmentsColors( | ||
| 15 | const Pica::LightingRegs& lighting, const Pica::State::Lighting& lighting_state, | ||
| 16 | const Math::Quaternion<float>& normquat, const Math::Vec3<float>& view); | ||
| 17 | |||
| 18 | } // namespace Pica | ||
diff --git a/src/video_core/swrasterizer/rasterizer.cpp b/src/video_core/swrasterizer/rasterizer.cpp index 512e81c08..fdc1df199 100644 --- a/src/video_core/swrasterizer/rasterizer.cpp +++ b/src/video_core/swrasterizer/rasterizer.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 14 | #include "common/math_util.h" | 14 | #include "common/math_util.h" |
| 15 | #include "common/microprofile.h" | 15 | #include "common/microprofile.h" |
| 16 | #include "common/quaternion.h" | ||
| 16 | #include "common/vector_math.h" | 17 | #include "common/vector_math.h" |
| 17 | #include "core/hw/gpu.h" | 18 | #include "core/hw/gpu.h" |
| 18 | #include "core/memory.h" | 19 | #include "core/memory.h" |
| @@ -24,6 +25,7 @@ | |||
| 24 | #include "video_core/regs_texturing.h" | 25 | #include "video_core/regs_texturing.h" |
| 25 | #include "video_core/shader/shader.h" | 26 | #include "video_core/shader/shader.h" |
| 26 | #include "video_core/swrasterizer/framebuffer.h" | 27 | #include "video_core/swrasterizer/framebuffer.h" |
| 28 | #include "video_core/swrasterizer/lighting.h" | ||
| 27 | #include "video_core/swrasterizer/proctex.h" | 29 | #include "video_core/swrasterizer/proctex.h" |
| 28 | #include "video_core/swrasterizer/rasterizer.h" | 30 | #include "video_core/swrasterizer/rasterizer.h" |
| 29 | #include "video_core/swrasterizer/texturing.h" | 31 | #include "video_core/swrasterizer/texturing.h" |
| @@ -419,6 +421,26 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
| 419 | regs.texturing.tev_combiner_buffer_color.a, | 421 | regs.texturing.tev_combiner_buffer_color.a, |
| 420 | }; | 422 | }; |
| 421 | 423 | ||
| 424 | Math::Vec4<u8> primary_fragment_color = {0, 0, 0, 0}; | ||
| 425 | Math::Vec4<u8> secondary_fragment_color = {0, 0, 0, 0}; | ||
| 426 | |||
| 427 | if (!g_state.regs.lighting.disable) { | ||
| 428 | Math::Quaternion<float> normquat = Math::Quaternion<float>{ | ||
| 429 | {GetInterpolatedAttribute(v0.quat.x, v1.quat.x, v2.quat.x).ToFloat32(), | ||
| 430 | GetInterpolatedAttribute(v0.quat.y, v1.quat.y, v2.quat.y).ToFloat32(), | ||
| 431 | GetInterpolatedAttribute(v0.quat.z, v1.quat.z, v2.quat.z).ToFloat32()}, | ||
| 432 | GetInterpolatedAttribute(v0.quat.w, v1.quat.w, v2.quat.w).ToFloat32(), | ||
| 433 | }.Normalized(); | ||
| 434 | |||
| 435 | Math::Vec3<float> view{ | ||
| 436 | GetInterpolatedAttribute(v0.view.x, v1.view.x, v2.view.x).ToFloat32(), | ||
| 437 | GetInterpolatedAttribute(v0.view.y, v1.view.y, v2.view.y).ToFloat32(), | ||
| 438 | GetInterpolatedAttribute(v0.view.z, v1.view.z, v2.view.z).ToFloat32(), | ||
| 439 | }; | ||
| 440 | std::tie(primary_fragment_color, secondary_fragment_color) = | ||
| 441 | ComputeFragmentsColors(g_state.regs.lighting, g_state.lighting, normquat, view); | ||
| 442 | } | ||
| 443 | |||
| 422 | for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); | 444 | for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size(); |
| 423 | ++tev_stage_index) { | 445 | ++tev_stage_index) { |
| 424 | const auto& tev_stage = tev_stages[tev_stage_index]; | 446 | const auto& tev_stage = tev_stages[tev_stage_index]; |
| @@ -427,14 +449,13 @@ static void ProcessTriangleInternal(const Vertex& v0, const Vertex& v1, const Ve | |||
| 427 | auto GetSource = [&](Source source) -> Math::Vec4<u8> { | 449 | auto GetSource = [&](Source source) -> Math::Vec4<u8> { |
| 428 | switch (source) { | 450 | switch (source) { |
| 429 | case Source::PrimaryColor: | 451 | case Source::PrimaryColor: |
| 452 | return primary_color; | ||
| 430 | 453 | ||
| 431 | // HACK: Until we implement fragment lighting, use primary_color | ||
| 432 | case Source::PrimaryFragmentColor: | 454 | case Source::PrimaryFragmentColor: |
| 433 | return primary_color; | 455 | return primary_fragment_color; |
| 434 | 456 | ||
| 435 | // HACK: Until we implement fragment lighting, use zero | ||
| 436 | case Source::SecondaryFragmentColor: | 457 | case Source::SecondaryFragmentColor: |
| 437 | return {0, 0, 0, 0}; | 458 | return secondary_fragment_color; |
| 438 | 459 | ||
| 439 | case Source::Texture0: | 460 | case Source::Texture0: |
| 440 | return texture_color[0]; | 461 | return texture_color[0]; |