Browse Source

lolfx: names such as "x" or "bgra" are field selectors, but we must also

accept them as variable names.
legacy
Sam Hocevar sam 12 years ago
parent
commit
ca5238b145
7 changed files with 1687 additions and 1672 deletions
  1. +2
    -2
      build/autotools/common.am
  2. +767
    -767
      src/generated/lolfx-parser.cpp
  3. +892
    -898
      src/generated/lolfx-scanner.cpp
  4. +1
    -1
      src/gpu/lolfx-parser.y
  5. +6
    -4
      src/gpu/lolfx-scanner.l
  6. +6
    -0
      src/gpu/lolfx.cpp
  7. +13
    -0
      src/gpu/lolfx.h

+ 2
- 2
build/autotools/common.am View File

@@ -27,8 +27,8 @@ generated-recursive:
rm -f generated/[a-zA-Z]*; \
for scanner in $(patsubst %-scanner.l, %, $(filter %-scanner.l, $(EXTRA_DIST))); do \
b="`basename $$scanner`"; \
echo flex -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l"; \
flex -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l" || exit 1; \
echo flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l"; \
flex -v -o "generated/$$b-scanner.cpp" "$$scanner-scanner.l" || exit 1; \
done; \
for parser in $(patsubst %-parser.y, %, $(filter %-parser.y, $(EXTRA_DIST))); do \
b="`basename $$parser`"; \


+ 767
- 767
src/generated/lolfx-parser.cpp
File diff suppressed because it is too large
View File


+ 892
- 898
src/generated/lolfx-scanner.cpp
File diff suppressed because it is too large
View File


+ 1
- 1
src/gpu/lolfx-parser.y View File

@@ -800,7 +800,7 @@ lolfx_shader_name:
*/

glsl_variable_identifier:
IDENTIFIER
lolfx_identifier
;

glsl_primary_expression:


+ 6
- 4
src/gpu/lolfx-scanner.l View File

@@ -167,10 +167,6 @@ typedef lol::LolFxParser::token_type token_type;
"true" { yylval->ival = 1; return token::BOOLCONSTANT; }
"false" { yylval->ival = 0; return token::BOOLCONSTANT; }

[xyzw]{1,4} { return token::FIELDSELECTION; }
[rgba]{1,4} { return token::FIELDSELECTION; }
[stpq]{1,4} { return token::FIELDSELECTION; }

/*
* GLSL keywords that are also valid or reserved in HLSL
* and HLSL keywords that are also valid or reserved in GLSL.
@@ -567,6 +563,12 @@ typedef lol::LolFxParser::token_type token_type;
return token::INTCONSTANT;
}

([xyzw]{1,4}|[rgba]{1,4}|[stpq]{1,4}) {
/* Copy token for now */
yylval->sval = strdup(yytext);
return token::FIELDSELECTION;
}

[a-zA-Z_][a-zA-Z0-9_]* {
/* Copy token for now */
yylval->sval = strdup(yytext);


+ 6
- 0
src/gpu/lolfx.cpp View File

@@ -37,6 +37,12 @@ namespace lol
{

LolFx::LolFx()
: m_blend(false),
m_alphatest(false),
m_cullface(false),
m_depthtest(false),
m_depthmask(false),
m_shader(0)
{
;
}


+ 13
- 0
src/gpu/lolfx.h View File

@@ -16,6 +16,8 @@
#if !defined __GPU_LOLFX_H__
#define __GPU_LOLFX_H__

#include "gpu/shader.h"

namespace lol
{

@@ -27,6 +29,17 @@ public:
LolFx();

bool Compile(char const *command);

private:
/* Simple GL / DX render states */
bool m_blend;
bool m_alphatest;
bool m_cullface;
bool m_depthtest;
bool m_depthmask;

/* Our shaders -- FIXME: should be split if possible */
Shader *m_shader;
};

} /* namespace lol */


Loading…
Cancel
Save