Skip to content

Column-major matrices -Zpc #1702

@cpt-max

Description

@cpt-max

I would find it really useful to compile with -Zpc, as it removes the need to transpose matrices in the framework (platform independent OpenGL and DX), or even worse, in user code.

The restriction that this only works with square matrices is a bit of a show stopper though.
The corresponding comment in spirv_glsl.cpp indicates that this restriction could potentially be lifted:

	// Only square row-major matrices can be converted at this time.
	// Converting non-square matrices will require defining custom GLSL function that
	// swaps matrix elements while retaining the original dimensional form of the matrix.
	const auto mbr_type = get<SPIRType>(type.member_types[index]);
	if (mbr_type.columns != mbr_type.vecsize)
		SPIRV_CROSS_THROW("Row-major matrices must be square on this platform.");

Would this have a negative impact on performance, or would you expect this extra function to get optimized out in the end anyway?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature to SPIRV-Cross is desired.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions