mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-11 20:40:47 +00:00
Add support for mixed line endings to the shader preprocessor
Fixes CurveV3.pk3
This commit is contained in:
parent
0894547d1a
commit
0c70ca9068
1 changed files with 7 additions and 4 deletions
|
@ -426,15 +426,18 @@ static char *HWR_PreprocessShader(char *original)
|
||||||
if (strstr(original, "\r\n"))
|
if (strstr(original, "\r\n"))
|
||||||
{
|
{
|
||||||
line_ending = "\r\n";
|
line_ending = "\r\n";
|
||||||
// check that all line endings are same,
|
// check if all line endings are same
|
||||||
// otherwise the parsing code won't function correctly
|
|
||||||
while ((read_pos = strchr(read_pos, '\n')))
|
while ((read_pos = strchr(read_pos, '\n')))
|
||||||
{
|
{
|
||||||
read_pos--;
|
read_pos--;
|
||||||
if (*read_pos != '\r')
|
if (*read_pos != '\r')
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "HWR_PreprocessShader: Shader contains mixed line ending types. Please use either only LF (Unix) or only CRLF (Windows) line endings.\n");
|
// this file contains mixed CRLF and LF line endings.
|
||||||
return NULL;
|
// treating it as a LF file during parsing should keep
|
||||||
|
// the results sane enough as long as the gpu driver is fine
|
||||||
|
// with these kinds of weirdly formatted shader sources.
|
||||||
|
line_ending = "\n";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
read_pos += 2;
|
read_pos += 2;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue