|
32 | 32 |
|
33 | 33 | #include "core/io/compression.h"
|
34 | 34 |
|
35 |
| -const uint32_t RenderingShaderContainer::MAGIC_NUMBER = 0x43535247; |
36 |
| -const uint32_t RenderingShaderContainer::VERSION = 2; |
37 |
| - |
38 | 35 | static inline uint32_t aligned_to(uint32_t p_size, uint32_t p_alignment) {
|
39 | 36 | if (p_size % p_alignment) {
|
40 | 37 | return p_size + (p_alignment - (p_size % p_alignment));
|
@@ -228,8 +225,8 @@ bool RenderingShaderContainer::from_bytes(const PackedByteArray &p_bytes) {
|
228 | 225 | bytes_offset += sizeof(ContainerHeader);
|
229 | 226 | bytes_offset += _from_bytes_header_extra_data(&bytes_ptr[bytes_offset]);
|
230 | 227 |
|
231 |
| - ERR_FAIL_COND_V_MSG(container_header.magic_number != MAGIC_NUMBER, false, "Incorrect magic number in shader container."); |
232 |
| - ERR_FAIL_COND_V_MSG(container_header.version > VERSION, false, "Unsupported version in shader container."); |
| 228 | + ERR_FAIL_COND_V_MSG(container_header.magic_number != CONTAINER_MAGIC_NUMBER, false, "Incorrect magic number in shader container."); |
| 229 | + ERR_FAIL_COND_V_MSG(container_header.version > CONTAINER_VERSION, false, "Unsupported version in shader container."); |
233 | 230 | ERR_FAIL_COND_V_MSG(container_header.format != _format(), false, "Incorrect format in shader container.");
|
234 | 231 | ERR_FAIL_COND_V_MSG(container_header.format_version > _format_version(), false, "Unsupported format version in shader container.");
|
235 | 232 |
|
@@ -354,8 +351,8 @@ PackedByteArray RenderingShaderContainer::to_bytes() const {
|
354 | 351 | uint64_t bytes_offset = 0;
|
355 | 352 | uint8_t *bytes_ptr = bytes.ptrw();
|
356 | 353 | ContainerHeader &container_header = *(ContainerHeader *)(&bytes_ptr[bytes_offset]);
|
357 |
| - container_header.magic_number = MAGIC_NUMBER; |
358 |
| - container_header.version = VERSION; |
| 354 | + container_header.magic_number = CONTAINER_MAGIC_NUMBER; |
| 355 | + container_header.version = CONTAINER_VERSION; |
359 | 356 | container_header.format = _format();
|
360 | 357 | container_header.format_version = _format_version();
|
361 | 358 | container_header.shader_count = shaders.size();
|
|
0 commit comments