| 320 | } |
| 321 | |
| 322 | bool Shader::LoadFromBinary(const void* buffer, unsigned int size) |
| 323 | { |
| 324 | #if NAZARA_RENDERER_SAFE |
| 325 | if (!glProgramBinary) |
| 326 | { |
| 327 | NazaraError("GL_ARB_get_program_binary not supported"); |
| 328 | return false; |
| 329 | } |
| 330 | |
| 331 | if (!buffer || size < sizeof(UInt64)) |
| 332 | { |
| 333 | NazaraError("Invalid buffer"); |
| 334 | return false; |
| 335 | } |
| 336 | #endif |
| 337 | |
| 338 | Context::EnsureContext(); |
| 339 | |
| 340 | const UInt8* ptr = reinterpret_cast<const UInt8*>(buffer); |
| 341 | |
| 342 | // On récupère le format au début du binaire |
| 343 | ///TODO: ByteStream ? |
| 344 | GLenum binaryFormat = static_cast<GLenum>(*reinterpret_cast<const UInt64*>(&ptr[0])); |
| 345 | ptr += sizeof(UInt64); |
| 346 | |
| 347 | glProgramBinary(m_program, binaryFormat, ptr, size - sizeof(UInt64)); |
| 348 | |
| 349 | return PostLinkage(); |
| 350 | } |
| 351 | |
| 352 | bool Shader::LoadFromBinary(const ByteArray& byteArray) |
| 353 | { |
nothing calls this directly
no test coverage detected