| 2970 | } |
| 2971 | |
| 2972 | QString ShaderViewer::stringRep(const ShaderVariable &var, uint32_t row) |
| 2973 | { |
| 2974 | VarType type = var.type; |
| 2975 | |
| 2976 | if(type == VarType::Unknown) |
| 2977 | type = ui->intView->isChecked() ? VarType::SInt : VarType::Float; |
| 2978 | |
| 2979 | if(type == VarType::ReadOnlyResource || type == VarType::ReadWriteResource || |
| 2980 | type == VarType::Sampler) |
| 2981 | { |
| 2982 | rdcarray<UsedDescriptor> resList; |
| 2983 | |
| 2984 | if(type == VarType::ReadOnlyResource) |
| 2985 | resList = m_ReadOnlyResources; |
| 2986 | else if(type == VarType::ReadWriteResource) |
| 2987 | resList = m_ReadWriteResources; |
| 2988 | else if(type == VarType::Sampler) |
| 2989 | resList = m_Ctx.CurPipelineState().GetSamplers(m_Stage); |
| 2990 | |
| 2991 | ShaderBindIndex varBind; |
| 2992 | int32_t bindIdx = -1; |
| 2993 | if(var.IsDirectAccess()) |
| 2994 | { |
| 2995 | ShaderDirectAccess access = var.GetDirectAccess(); |
| 2996 | bindIdx = resList.indexOf(access); |
| 2997 | } |
| 2998 | else |
| 2999 | { |
| 3000 | varBind = var.GetBindIndex(); |
| 3001 | bindIdx = resList.indexOf(varBind); |
| 3002 | } |
| 3003 | |
| 3004 | if(bindIdx < 0) |
| 3005 | return ToQStr(ResourceId()); |
| 3006 | |
| 3007 | const UsedDescriptor &res = resList[bindIdx]; |
| 3008 | |
| 3009 | if(type == VarType::Sampler) |
| 3010 | { |
| 3011 | if(!var.IsDirectAccess()) |
| 3012 | { |
| 3013 | return samplerRep(m_ShaderDetails->samplers[varBind.index], varBind.arrayElement, |
| 3014 | res.descriptor.resource); |
| 3015 | } |
| 3016 | else |
| 3017 | { |
| 3018 | ShaderDirectAccess access = res.access; |
| 3019 | if(access.descriptorStore != ResourceId()) |
| 3020 | { |
| 3021 | auto it = m_LogicalBindNames.find(access); |
| 3022 | if(it == m_LogicalBindNames.end()) |
| 3023 | { |
| 3024 | m_Ctx.Replay().AsyncInvoke([access, this](IReplayController *r) { |
| 3025 | rdcarray<DescriptorRange> ranges; |
| 3026 | ranges.resize(1); |
| 3027 | ranges[0].count = 1; |
| 3028 | ranges[0].descriptorSize = access.byteSize; |
| 3029 | ranges[0].offset = access.byteOffset; |
nothing calls this directly
no test coverage detected