| 3099 | } |
| 3100 | |
| 3101 | ResourceFormat GetInterpretedResourceFormat(const ShaderConstant &elem) |
| 3102 | { |
| 3103 | ResourceFormat format; |
| 3104 | format.type = ResourceFormatType::Regular; |
| 3105 | |
| 3106 | if(elem.type.flags & ShaderVariableFlags::R10G10B10A2) |
| 3107 | format.type = ResourceFormatType::R10G10B10A2; |
| 3108 | else if(elem.type.flags & ShaderVariableFlags::R11G11B10) |
| 3109 | format.type = ResourceFormatType::R11G11B10; |
| 3110 | |
| 3111 | format.compType = VarTypeCompType(elem.type.baseType); |
| 3112 | |
| 3113 | if(elem.type.flags & ShaderVariableFlags::UNorm) |
| 3114 | format.compType = CompType::UNorm; |
| 3115 | else if(elem.type.flags & ShaderVariableFlags::SNorm) |
| 3116 | format.compType = CompType::SNorm; |
| 3117 | |
| 3118 | format.compByteWidth = VarTypeByteSize(elem.type.baseType); |
| 3119 | |
| 3120 | if(elem.type.baseType == VarType::Enum) |
| 3121 | format.compByteWidth = elem.type.matrixByteStride; |
| 3122 | |
| 3123 | if(elem.type.RowMajor() || elem.type.rows == 1) |
| 3124 | format.compCount = elem.type.columns; |
| 3125 | else |
| 3126 | format.compCount = elem.type.rows; |
| 3127 | |
| 3128 | if(elem.type.baseType == VarType::GPUPointer) |
| 3129 | { |
| 3130 | format.compCount = 1; |
| 3131 | format.compType = CompType::UInt; |
| 3132 | format.compByteWidth = 8; |
| 3133 | } |
| 3134 | |
| 3135 | return format; |
| 3136 | } |
| 3137 | |
| 3138 | static void FillShaderVarData(ShaderVariable &var, const ShaderConstant &elem, const byte *data, |
| 3139 | const byte *end) |
no test coverage detected