Metal: Resolve zero initialization in failing math shader tests

Math tests failing in Metal due to non-zero-initialized values
and shader compilation error caused by mutli-component
boolean being implicitly evaluated.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108758
This commit is contained in:
Jason Fielder
2023-06-12 08:39:11 +02:00
committed by Jeroen Bakker
parent 91e15ca2fa
commit 6504ba980e
2 changed files with 8 additions and 8 deletions

View File

@@ -650,11 +650,11 @@ mat4x4 normalize_and_get_size(mat4x4 mat, out vec4 r_size)
mat2x2 adjoint(mat2x2 mat)
{
mat2x2 adj;
mat2x2 adj = mat2x2(0.0);
for (int c = 0; c < 2; c++) {
for (int r = 0; r < 2; r++) {
/* Copy other cells except the "cross" to compute the determinant. */
float tmp;
float tmp = 0.0;
for (int m_c = 0; m_c < 2; m_c++) {
for (int m_r = 0; m_r < 2; m_r++) {
if (m_c != c && m_r != r) {
@@ -671,11 +671,11 @@ mat2x2 adjoint(mat2x2 mat)
}
mat3x3 adjoint(mat3x3 mat)
{
mat3x3 adj;
mat3x3 adj = mat3x3(0.0);
for (int c = 0; c < 3; c++) {
for (int r = 0; r < 3; r++) {
/* Copy other cells except the "cross" to compute the determinant. */
mat2x2 tmp;
mat2x2 tmp = mat2x2(0.0);
for (int m_c = 0; m_c < 3; m_c++) {
for (int m_r = 0; m_r < 3; m_r++) {
if (m_c != c && m_r != r) {
@@ -694,11 +694,11 @@ mat3x3 adjoint(mat3x3 mat)
}
mat4x4 adjoint(mat4x4 mat)
{
mat4x4 adj;
mat4x4 adj = mat4x4(0.0);
for (int c = 0; c < 4; c++) {
for (int r = 0; r < 4; r++) {
/* Copy other cells except the "cross" to compute the determinant. */
mat3x3 tmp;
mat3x3 tmp = mat3x3(0.0);
for (int m_c = 0; m_c < 4; m_c++) {
for (int m_r = 0; m_r < 4; m_r++) {
if (m_c != c && m_r != r) {

View File

@@ -146,7 +146,7 @@ int g_test_id = 0;
# define EXPECT_OP(OP, val1, val2) \
out_test[g_test_id++] = test_output( \
as_raw_data(val1), as_raw_data(val2), bool(OP), int(__LINE__), to_type(val1))
as_raw_data(val1), as_raw_data(val2), bool(all(OP)), int(__LINE__), to_type(val1))
#else
/** WORKAROUND: Fragment shader variant for older platform. */
@@ -158,7 +158,7 @@ int g_test_id = 0;
} \
if (int(gl_FragCoord.y) == g_test_id - 1) { \
TestOutput to = test_output( \
as_raw_data(val1), as_raw_data(val2), bool(OP), int(__LINE__), to_type(val1)); \
as_raw_data(val1), as_raw_data(val2), bool(all(OP)), int(__LINE__), to_type(val1)); \
switch (int(gl_FragCoord.x)) { \
case 0: \
out_test = uvec4( \