| 1 |
/** |
| 2 |
BSD 2-Clause License |
| 3 |
|
| 4 |
Copyright (c) 2020, Travis Fort |
| 5 |
All rights reserved. |
| 6 |
|
| 7 |
Redistribution and use in source and binary forms, with or without |
| 8 |
modification, are permitted provided that the following conditions are met: |
| 9 |
|
| 10 |
1. Redistributions of source code must retain the above copyright notice, this |
| 11 |
list of conditions and the following disclaimer. |
| 12 |
|
| 13 |
2. Redistributions in binary form must reproduce the above copyright notice, |
| 14 |
this list of conditions and the following disclaimer in the documentation |
| 15 |
and/or other materials provided with the distribution. |
| 16 |
|
| 17 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 |
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 |
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 |
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 21 |
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 |
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 23 |
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 24 |
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 |
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 |
**/ |
| 28 |
|
| 29 |
#include "resource_limits_c.h" |
| 30 |
#include "ResourceLimits.h" |
| 31 |
#include <stdlib.h> |
| 32 |
#include <string.h> |
| 33 |
#include <string> |
| 34 |
|
| 35 |
const glslang_resource_t* glslang_default_resource(void) |
| 36 |
{ |
| 37 |
return reinterpret_cast<const glslang_resource_t*>(&glslang::DefaultTBuiltInResource); |
| 38 |
} |
| 39 |
|
| 40 |
#if defined(__clang__) || defined(__GNUC__) |
| 41 |
#pragma GCC diagnostic push |
| 42 |
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 43 |
#elif defined(_MSC_VER) |
| 44 |
#pragma warning(push) |
| 45 |
#pragma warning(disable : 4996) |
| 46 |
#endif |
| 47 |
|
| 48 |
const char* glslang_default_resource_string() |
| 49 |
{ |
| 50 |
std::string cpp_str = glslang::GetDefaultTBuiltInResourceString(); |
| 51 |
char* c_str = (char*)malloc(cpp_str.length() + 1); |
| 52 |
strcpy(c_str, cpp_str.c_str()); |
| 53 |
return c_str; |
| 54 |
} |
| 55 |
|
| 56 |
#if defined(__clang__) || defined(__GNUC__) |
| 57 |
#pragma GCC diagnostic pop |
| 58 |
#elif defined(_MSC_VER) |
| 59 |
#pragma warning(pop) |
| 60 |
#endif |
| 61 |
|
| 62 |
void glslang_decode_resource_limits(glslang_resource_t* resources, char* config) |
| 63 |
{ |
| 64 |
glslang::DecodeResourceLimits(reinterpret_cast<TBuiltInResource*>(resources), config); |
| 65 |
} |