MCPcopy Create free account
hub / github.com/baldurk/renderdoc / GetVariants

Function GetVariants

qrenderdoc/Code/BufferFormatter.cpp:3389–3822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3387}
3388
3389QVariantList GetVariants(ResourceFormat format, const ShaderConstant &var, const byte *&data,
3390 const byte *end)
3391{
3392 const ShaderConstantType &varType = var.type;
3393
3394 QVariantList ret;
3395
3396 bool ok = true;
3397
3398 if(format.type == ResourceFormatType::R5G5B5A1)
3399 {
3400 uint16_t packed = readObj<uint16_t>(data, end, ok);
3401
3402 ret.push_back((float)((packed >> 0) & 0x1f) / 31.0f);
3403 ret.push_back((float)((packed >> 5) & 0x1f) / 31.0f);
3404 ret.push_back((float)((packed >> 10) & 0x1f) / 31.0f);
3405 ret.push_back(((packed & 0x8000) > 0) ? 1.0f : 0.0f);
3406
3407 if(format.BGRAOrder())
3408 {
3409 QVariant tmp = ret[2];
3410 ret[2] = ret[0];
3411 ret[0] = tmp;
3412 }
3413 }
3414 else if(format.type == ResourceFormatType::R5G6B5)
3415 {
3416 uint16_t packed = readObj<uint16_t>(data, end, ok);
3417
3418 ret.push_back((float)((packed >> 0) & 0x1f) / 31.0f);
3419 ret.push_back((float)((packed >> 5) & 0x3f) / 63.0f);
3420 ret.push_back((float)((packed >> 11) & 0x1f) / 31.0f);
3421
3422 if(format.BGRAOrder())
3423 {
3424 QVariant tmp = ret[2];
3425 ret[2] = ret[0];
3426 ret[0] = tmp;
3427 }
3428 }
3429 else if(format.type == ResourceFormatType::R4G4B4A4)
3430 {
3431 uint16_t packed = readObj<uint16_t>(data, end, ok);
3432
3433 ret.push_back((float)((packed >> 0) & 0xf) / 15.0f);
3434 ret.push_back((float)((packed >> 4) & 0xf) / 15.0f);
3435 ret.push_back((float)((packed >> 8) & 0xf) / 15.0f);
3436 ret.push_back((float)((packed >> 12) & 0xf) / 15.0f);
3437
3438 if(format.BGRAOrder())
3439 {
3440 QVariant tmp = ret[2];
3441 ret[2] = ret[0];
3442 ret[0] = tmp;
3443 }
3444 }
3445 else if(format.type == ResourceFormatType::R10G10B10A2)
3446 {

Callers 4

FillShaderVarDataFunction · 0.85
dataMethod · 0.85
calcBoundingDataMethod · 0.85
exportDataMethod · 0.85

Calls 13

qPowFunction · 0.85
fromValueFunction · 0.85
interpretFunction · 0.85
memcpyFunction · 0.50
translateFunction · 0.50
QStringFunction · 0.50
push_backMethod · 0.45
emptyMethod · 0.45
backMethod · 0.45
sizeMethod · 0.45
isEmptyMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected