| 179 | } |
| 180 | |
| 181 | bool Shader::LoadFromMemory(const char* shaderName, Introspection introspection, const char* vertex, const char* fragment, std::int32_t batchSize, ArrayView<const StringView> defines) |
| 182 | { |
| 183 | ZoneScopedC(0x81A861); |
| 184 | if (shaderName != nullptr) { |
| 185 | // When Tracy is disabled the statement body is empty and braces are needed |
| 186 | ZoneText(shaderName, std::strlen(shaderName)); |
| 187 | } |
| 188 | |
| 189 | glShaderProgram_->Reset(); // reset before attaching new shaders |
| 190 | glShaderProgram_->SetBatchSize(batchSize); |
| 191 | glShaderProgram_->SetObjectLabel(shaderName); |
| 192 | |
| 193 | StringView strings[MaxShaderStrings]; std::size_t stringsCount; char backingStore[256]; |
| 194 | |
| 195 | stringsCount = populateShaderStrings(strings, backingStore, vertex, batchSize, defines); |
| 196 | glShaderProgram_->AttachShaderFromStringsAndFile(GL_VERTEX_SHADER, arrayView(strings, stringsCount), {}); |
| 197 | |
| 198 | stringsCount = populateShaderStrings(strings, backingStore, fragment, -1, defines); |
| 199 | glShaderProgram_->AttachShaderFromStringsAndFile(GL_FRAGMENT_SHADER, arrayView(strings, stringsCount), {}); |
| 200 | |
| 201 | glShaderProgram_->Link(shaderToShaderProgramIntrospection(introspection)); |
| 202 | |
| 203 | return IsLinked(); |
| 204 | } |
| 205 | |
| 206 | bool Shader::LoadFromMemory(const char* shaderName, const char* vertex, const char* fragment, std::int32_t batchSize) |
| 207 | { |
no test coverage detected