MCPcopy Create free account
hub / github.com/dfranx/ShaderDebugger / lib_common_transpose

Function lib_common_transpose

src/CommonLibrary.cpp:2505–2535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2503 return ret;
2504 }
2505 bv_variable lib_common_transpose(bv_program* prog, u8 count, bv_variable* args)
2506 {
2507 bv_variable ret = bv_variable_create_void();
2508
2509 if (count >= 1) {
2510 if (args[0].type == bv_type_object) { // floor(vec3), ...
2511 bv_object* mat = bv_variable_get_object(args[0]);
2512 sd::Matrix* matData = (sd::Matrix*)mat->user_data;
2513
2514 sd::Matrix* copyData = CopyMatrixData(matData);
2515
2516 copyData->Columns = matData->Rows;
2517 copyData->Rows = matData->Columns;
2518
2519 copyData->Data = glm::transpose(matData->Data);
2520
2521 bool isDouble = mat->type->name[0] == 'd';
2522 bool is_glsl = isGLSL(prog);
2523
2524 std::string newName = (is_glsl ? "mat" : "float") + std::to_string(is_glsl ? copyData->Columns : copyData->Rows);
2525 if (copyData->Rows != copyData->Columns || !is_glsl)
2526 newName += "x" + std::to_string(is_glsl ? copyData->Rows : copyData->Columns);
2527 if (isDouble && is_glsl)
2528 newName = "d" + newName;
2529
2530 return Common::create_mat(prog, newName.c_str(), copyData);
2531 }
2532 }
2533
2534 return ret;
2535 }
2536
2537 /* integer */
2538 bv_variable lib_common_bitfieldReverse(bv_program* prog, u8 count, bv_variable* args)

Callers

nothing calls this directly

Calls 3

CopyMatrixDataFunction · 0.85
isGLSLFunction · 0.85
create_matFunction · 0.85

Tested by

no test coverage detected