| 1348 | } |
| 1349 | |
| 1350 | GLuint GLReplay::MakeShaderDebugSampleProg(const SamplingProgramConfig &config) |
| 1351 | { |
| 1352 | uint32_t hash = config.hashKey(); |
| 1353 | |
| 1354 | if(m_ShaderDebugSampleProg[hash]) |
| 1355 | return m_ShaderDebugSampleProg[hash]; |
| 1356 | |
| 1357 | rdcstr defines; |
| 1358 | |
| 1359 | defines += rdcstr("#define SHADER_BASETYPE ") + ToStr((uint32_t)config.resType) + "\n"; |
| 1360 | |
| 1361 | defines += StringFormat::Fmt("#define FETCH_OFFSET ivec3(%u, %u, %u)\n", config.fetchOffset.x, |
| 1362 | config.fetchOffset.y, config.fetchOffset.z); |
| 1363 | |
| 1364 | defines += StringFormat::Fmt( |
| 1365 | "#define GATHER_OFFSETS ivec2[4](ivec2(%u, %u), ivec2(%u, %u), ivec2(%u, %u), ivec2(%u, " |
| 1366 | "%u))\n", |
| 1367 | config.gatherOffsets[0], config.gatherOffsets[1], config.gatherOffsets[2], |
| 1368 | config.gatherOffsets[3], config.gatherOffsets[4], config.gatherOffsets[5], |
| 1369 | config.gatherOffsets[6], config.gatherOffsets[7]); |
| 1370 | |
| 1371 | defines += StringFormat::Fmt("#define USE_GRAD %u\n", config.useGrad); |
| 1372 | defines += StringFormat::Fmt("#define USE_GATHER_OFFS %u\n", config.useGatherOffs); |
| 1373 | defines += StringFormat::Fmt("#define GATHER_CHANNEL %u\n", config.gatherChannel); |
| 1374 | |
| 1375 | rdcstr operation = "Do"; |
| 1376 | switch(config.op) |
| 1377 | { |
| 1378 | case SamplingProgramConfig::Fetch: operation += "Fetch"; break; |
| 1379 | case SamplingProgramConfig::QueryLod: operation += "QueryLod"; break; |
| 1380 | case SamplingProgramConfig::Sample: operation += "Sample"; break; |
| 1381 | case SamplingProgramConfig::SampleDref: operation += "SampleDref"; break; |
| 1382 | case SamplingProgramConfig::Gather: operation += "Gather"; break; |
| 1383 | case SamplingProgramConfig::GatherDref: operation += "GatherDref"; break; |
| 1384 | } |
| 1385 | |
| 1386 | rdcstr dim; |
| 1387 | switch(config.dim) |
| 1388 | { |
| 1389 | case SamplingProgramConfig::TexBuffer: dim = "Buffer"; break; |
| 1390 | case SamplingProgramConfig::Tex1D: dim = "1D"; break; |
| 1391 | case SamplingProgramConfig::Tex2D: dim = "2D"; break; |
| 1392 | case SamplingProgramConfig::Tex3D: dim = "3D"; break; |
| 1393 | case SamplingProgramConfig::TexCube: dim = "Cube"; break; |
| 1394 | case SamplingProgramConfig::Tex1DArray: dim = "1DArray"; break; |
| 1395 | case SamplingProgramConfig::Tex2DArray: dim = "2DArray"; break; |
| 1396 | case SamplingProgramConfig::Tex3DArray: dim = "3DArray"; break; |
| 1397 | case SamplingProgramConfig::TexCubeArray: dim = "CubeArray"; break; |
| 1398 | case SamplingProgramConfig::Tex2DRect: dim = "2DRect"; break; |
| 1399 | case SamplingProgramConfig::Tex2DMS: dim = "2DMS"; break; |
| 1400 | case SamplingProgramConfig::Tex2DMSArray: dim = "2DMSArray"; break; |
| 1401 | } |
| 1402 | |
| 1403 | rdcstr manualBias = config.manualBias ? "Bias" : ""; |
| 1404 | |
| 1405 | if(config.manualBias) |
| 1406 | { |
| 1407 | if(config.op == SamplingProgramConfig::Sample) |
no test coverage detected