-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swapping the shaders around to support row major hsMatrices and eliminating the swap function. This change hasn’t filtered down to the dynamic effects which get their uniforms through a giant buffer provided by the engine itself.
- Loading branch information
1 parent
53bdefb
commit 614e2b1
Showing
5 changed files
with
49 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,39 +62,15 @@ You can contact Cyan Worlds, Inc. by email [email protected] | |
|
||
#include "plMetalPipelineState.h" | ||
|
||
matrix_float4x4* hsMatrix2SIMD(const hsMatrix44& src, matrix_float4x4* dst, bool swapOrder) | ||
matrix_float4x4* hsMatrix2SIMD(const hsMatrix44& src, matrix_float4x4* dst) | ||
{ | ||
if (src.fFlags & hsMatrix44::kIsIdent) | ||
{ | ||
memcpy(dst, &matrix_identity_float4x4, sizeof(float) * 16); | ||
} | ||
else | ||
{ | ||
//SIMD is column major, hsMatrix44 is row major. | ||
//We need to flip. | ||
if(swapOrder) { | ||
dst->columns[0][0] = src.fMap[0][0]; | ||
dst->columns[1][0] = src.fMap[0][1]; | ||
dst->columns[2][0] = src.fMap[0][2]; | ||
dst->columns[3][0] = src.fMap[0][3]; | ||
|
||
dst->columns[0][1] = src.fMap[1][0]; | ||
dst->columns[1][1] = src.fMap[1][1]; | ||
dst->columns[2][1] = src.fMap[1][2]; | ||
dst->columns[3][1] = src.fMap[1][3]; | ||
|
||
dst->columns[0][2] = src.fMap[2][0]; | ||
dst->columns[1][2] = src.fMap[2][1]; | ||
dst->columns[2][2] = src.fMap[2][2]; | ||
dst->columns[3][2] = src.fMap[2][3]; | ||
|
||
dst->columns[0][3] = src.fMap[3][0]; | ||
dst->columns[1][3] = src.fMap[3][1]; | ||
dst->columns[2][3] = src.fMap[3][2]; | ||
dst->columns[3][3] = src.fMap[3][3]; | ||
} else { | ||
memcpy(dst, &src.fMap, sizeof(matrix_float4x4)); | ||
} | ||
memcpy(dst, &src.fMap, sizeof(matrix_float4x4)); | ||
} | ||
|
||
return dst; | ||
|
@@ -957,13 +933,13 @@ void plMetalDevice::SetWorldToCameraMatrix(const hsMatrix44& src) | |
hsMatrix2SIMD(inv, &fMatrixC2W); | ||
} | ||
|
||
void plMetalDevice::SetLocalToWorldMatrix(const hsMatrix44& src, bool swapOrder) | ||
void plMetalDevice::SetLocalToWorldMatrix(const hsMatrix44& src) | ||
{ | ||
hsMatrix44 inv; | ||
src.GetInverse(&inv); | ||
|
||
hsMatrix2SIMD(src, &fMatrixL2W, swapOrder); | ||
hsMatrix2SIMD(inv, &fMatrixW2L, swapOrder); | ||
hsMatrix2SIMD(src, &fMatrixL2W); | ||
hsMatrix2SIMD(inv, &fMatrixW2L); | ||
} | ||
|
||
void plMetalDevice::CreateNewCommandBuffer(CA::MetalDrawable* drawable) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters