mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
Parse techniques
This commit is contained in:
parent
7c9805b4ba
commit
b770360ee1
@ -0,0 +1,44 @@
|
||||
#include "TechniqueNoScopeSequences.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
|
||||
using namespace techset;
|
||||
|
||||
namespace techset
|
||||
{
|
||||
class SequencePass final : public TechniqueParser::sequence_t
|
||||
{
|
||||
public:
|
||||
SequencePass()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Char('{')
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessMatch(TechniqueParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
assert(state->m_in_pass == false);
|
||||
state->m_in_pass = true;
|
||||
|
||||
if (state->m_before_first_pass)
|
||||
state->m_before_first_pass = false;
|
||||
else
|
||||
state->m_acceptor->AcceptNextPass();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniqueNoScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequencePass()
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "Techset/Parsing/TechniqueFileParser.h"
|
||||
|
||||
namespace techset
|
||||
{
|
||||
class TechniqueNoScopeSequences
|
||||
{
|
||||
TechniqueNoScopeSequences() = default;
|
||||
|
||||
public:
|
||||
static const std::vector<TechniqueParser::sequence_t*>& GetSequences();
|
||||
};
|
||||
}
|
@ -0,0 +1,200 @@
|
||||
#include "TechniquePassScopeSequences.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <sstream>
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
|
||||
using namespace techset;
|
||||
|
||||
namespace techset
|
||||
{
|
||||
class SequenceEndPass final : public TechniqueParser::sequence_t
|
||||
{
|
||||
public:
|
||||
SequenceEndPass()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Char('}')
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessMatch(TechniqueParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
assert(state->m_in_pass == true);
|
||||
state->m_in_pass = false;
|
||||
}
|
||||
};
|
||||
|
||||
class SequenceStateMap final : public TechniqueParser::sequence_t
|
||||
{
|
||||
static constexpr auto CAPTURE_STATE_MAP_NAME = 1;
|
||||
|
||||
public:
|
||||
SequenceStateMap()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Keyword("stateMap"),
|
||||
create.String().Capture(CAPTURE_STATE_MAP_NAME),
|
||||
create.Char(';')
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessMatch(TechniqueParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
state->m_acceptor->AcceptStateMap(result.NextCapture(CAPTURE_STATE_MAP_NAME).StringValue());
|
||||
}
|
||||
};
|
||||
|
||||
class SequenceShader final : public TechniqueParser::sequence_t
|
||||
{
|
||||
static constexpr auto TAG_VERTEX_SHADER = 1;
|
||||
static constexpr auto TAG_PIXEL_SHADER = 2;
|
||||
|
||||
static constexpr auto CAPTURE_START = 1;
|
||||
static constexpr auto CAPTURE_VERSION_MAJOR = 2;
|
||||
static constexpr auto CAPTURE_VERSION_MINOR = 3;
|
||||
static constexpr auto CAPTURE_SHADER_NAME = 4;
|
||||
|
||||
public:
|
||||
SequenceShader()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Or({
|
||||
create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER),
|
||||
create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER),
|
||||
}).Capture(CAPTURE_START),
|
||||
create.Integer().Capture(CAPTURE_VERSION_MAJOR),
|
||||
create.Char('.'),
|
||||
create.Integer().Capture(CAPTURE_VERSION_MINOR),
|
||||
create.String().Capture(CAPTURE_SHADER_NAME),
|
||||
create.Char('{')
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessMatch(TechniqueParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
const auto& firstToken = result.NextCapture(CAPTURE_START);
|
||||
|
||||
const auto& versionMajorToken = result.NextCapture(CAPTURE_VERSION_MAJOR);
|
||||
if (versionMajorToken.IntegerValue() < 0)
|
||||
throw ParsingException(versionMajorToken.GetPos(), "Major version must be positive");
|
||||
const auto versionMajor = static_cast<size_t>(versionMajorToken.IntegerValue());
|
||||
|
||||
const auto& versionMinorToken = result.NextCapture(CAPTURE_VERSION_MINOR);
|
||||
if (versionMinorToken.IntegerValue() < 0)
|
||||
throw ParsingException(versionMinorToken.GetPos(), "Minor version must be positive");
|
||||
const auto versionMinor = static_cast<size_t>(versionMajorToken.IntegerValue());
|
||||
|
||||
const auto& shaderNameToken = result.NextCapture(CAPTURE_SHADER_NAME);
|
||||
|
||||
bool acceptorResult;
|
||||
std::string errorMessage;
|
||||
const auto shaderTag = result.NextTag();
|
||||
assert(shaderTag == TAG_VERTEX_SHADER || shaderTag == TAG_PIXEL_SHADER);
|
||||
if (shaderTag == TAG_VERTEX_SHADER)
|
||||
{
|
||||
acceptorResult = state->m_acceptor->AcceptVertexShader(versionMajor, versionMinor, shaderNameToken.StringValue(), errorMessage);
|
||||
state->m_current_shader = ShaderSelector::VERTEX_SHADER;
|
||||
}
|
||||
else
|
||||
{
|
||||
acceptorResult = state->m_acceptor->AcceptPixelShader(versionMajor, versionMinor, shaderNameToken.StringValue(), errorMessage);
|
||||
state->m_current_shader = ShaderSelector::PIXEL_SHADER;
|
||||
}
|
||||
|
||||
state->m_in_shader = true;
|
||||
|
||||
if (!acceptorResult)
|
||||
throw ParsingException(firstToken.GetPos(), std::move(errorMessage));
|
||||
}
|
||||
};
|
||||
|
||||
class SequenceVertexStreamRouting final : public TechniqueParser::sequence_t
|
||||
{
|
||||
static constexpr auto CAPTURE_FIRST_TOKEN = 1;
|
||||
static constexpr auto CAPTURE_STREAM_DESTINATION_NAME = 2;
|
||||
static constexpr auto CAPTURE_STREAM_DESTINATION_INDEX = 3;
|
||||
static constexpr auto CAPTURE_STREAM_SOURCE_NAME = 4;
|
||||
static constexpr auto CAPTURE_STREAM_SOURCE_INDEX = 5;
|
||||
|
||||
public:
|
||||
SequenceVertexStreamRouting()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX),
|
||||
create.Char(']')
|
||||
})),
|
||||
|
||||
create.Char('='),
|
||||
|
||||
create.Keyword("code"),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX),
|
||||
create.Char(']')
|
||||
})),
|
||||
|
||||
create.Char(';')
|
||||
});
|
||||
}
|
||||
|
||||
static std::string CreateRoutingString(SequenceResult<SimpleParserValue>& result, const int nameCapture, const int indexCapture)
|
||||
{
|
||||
if (result.HasNextCapture(indexCapture))
|
||||
{
|
||||
const auto& indexToken = result.NextCapture(indexCapture);
|
||||
if (indexToken.IntegerValue() < 0)
|
||||
throw ParsingException(indexToken.GetPos(), "Index cannot be negative");
|
||||
|
||||
std::ostringstream ss;
|
||||
ss << result.NextCapture(nameCapture).IdentifierValue() << '[' << indexToken.IntegerValue() << ']';
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
return result.NextCapture(nameCapture).IdentifierValue();
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessMatch(TechniqueParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
const auto& firstToken = result.NextCapture(CAPTURE_FIRST_TOKEN);
|
||||
const std::string destinationString = CreateRoutingString(result, CAPTURE_STREAM_DESTINATION_NAME, CAPTURE_STREAM_DESTINATION_INDEX);
|
||||
const std::string sourceString = CreateRoutingString(result, CAPTURE_STREAM_SOURCE_NAME, CAPTURE_STREAM_SOURCE_INDEX);
|
||||
|
||||
std::string errorMessage;
|
||||
if (!state->m_acceptor->AcceptVertexStreamRouting(destinationString, sourceString, errorMessage))
|
||||
throw ParsingException(firstToken.GetPos(), std::move(errorMessage));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniquePassScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequenceEndPass(),
|
||||
new SequenceStateMap(),
|
||||
new SequenceShader(),
|
||||
new SequenceVertexStreamRouting()
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "Techset/Parsing/TechniqueFileParser.h"
|
||||
|
||||
namespace techset
|
||||
{
|
||||
class TechniquePassScopeSequences
|
||||
{
|
||||
TechniquePassScopeSequences() = default;
|
||||
|
||||
public:
|
||||
static const std::vector<TechniqueParser::sequence_t*>& GetSequences();
|
||||
};
|
||||
}
|
@ -0,0 +1,207 @@
|
||||
#include "TechniqueShaderScopeSequences.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
|
||||
using namespace techset;
|
||||
|
||||
namespace techset
|
||||
{
|
||||
class SequenceEndShader final : public TechniqueParser::sequence_t
|
||||
{
|
||||
public:
|
||||
SequenceEndShader()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Char('}')
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessMatch(TechniqueParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
assert(state->m_in_shader == true);
|
||||
state->m_in_shader = false;
|
||||
}
|
||||
};
|
||||
|
||||
class SequenceShaderArgument final : public TechniqueParser::sequence_t
|
||||
{
|
||||
static constexpr auto TAG_CODE = 1;
|
||||
static constexpr auto TAG_LITERAL = 2;
|
||||
static constexpr auto TAG_MATERIAL = 3;
|
||||
|
||||
static constexpr auto CAPTURE_FIRST_TOKEN = 1;
|
||||
static constexpr auto CAPTURE_SHADER_ARGUMENT = 2;
|
||||
static constexpr auto CAPTURE_SHADER_INDEX = 3;
|
||||
static constexpr auto CAPTURE_CODE_ACCESSOR = 4;
|
||||
static constexpr auto CAPTURE_CODE_INDEX = 5;
|
||||
static constexpr auto CAPTURE_LITERAL_VALUE = 6;
|
||||
static constexpr auto CAPTURE_MATERIAL_HASH = 7;
|
||||
static constexpr auto CAPTURE_MATERIAL_NAME = 8;
|
||||
|
||||
static std::unique_ptr<matcher_t> CodeMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.And({
|
||||
create.Keyword("code"),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR)
|
||||
})),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_CODE_INDEX),
|
||||
create.Char(']')
|
||||
}))
|
||||
}).Tag(TAG_CODE);
|
||||
}
|
||||
|
||||
static std::unique_ptr<matcher_t> LiteralMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.And({
|
||||
create.Keyword("float4"),
|
||||
create.Char('('),
|
||||
create.FloatingPoint().Capture(CAPTURE_LITERAL_VALUE),
|
||||
create.Char(','),
|
||||
create.FloatingPoint().Capture(CAPTURE_LITERAL_VALUE),
|
||||
create.Char(','),
|
||||
create.FloatingPoint().Capture(CAPTURE_LITERAL_VALUE),
|
||||
create.Char(','),
|
||||
create.FloatingPoint().Capture(CAPTURE_LITERAL_VALUE),
|
||||
create.Char(')'),
|
||||
}).Tag(TAG_LITERAL);
|
||||
}
|
||||
|
||||
static std::unique_ptr<matcher_t> MaterialMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.And({
|
||||
create.Keyword("material"),
|
||||
create.Char('.'),
|
||||
|
||||
create.Or({
|
||||
create.And({
|
||||
create.Char('#'),
|
||||
create.Integer().Capture(CAPTURE_MATERIAL_HASH)
|
||||
}),
|
||||
create.Identifier().Capture(CAPTURE_MATERIAL_NAME)
|
||||
})
|
||||
}).Tag(TAG_MATERIAL);
|
||||
}
|
||||
|
||||
public:
|
||||
SequenceShaderArgument()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_SHADER_INDEX),
|
||||
create.Char(']')
|
||||
})),
|
||||
create.Char('='),
|
||||
create.Or({
|
||||
CodeMatchers(create),
|
||||
LiteralMatchers(create),
|
||||
MaterialMatchers(create)
|
||||
}),
|
||||
create.Char(';')
|
||||
});
|
||||
}
|
||||
|
||||
static void ProcessCodeArgument(const TechniqueParserState* state, SequenceResult<SimpleParserValue>& result, ShaderArgument arg)
|
||||
{
|
||||
std::vector<std::string> accessors;
|
||||
while (result.HasNextCapture(CAPTURE_CODE_ACCESSOR))
|
||||
accessors.emplace_back(result.NextCapture(CAPTURE_CODE_ACCESSOR).IdentifierValue());
|
||||
|
||||
ShaderArgumentCodeSource source;
|
||||
if (result.HasNextCapture(CAPTURE_CODE_INDEX))
|
||||
{
|
||||
const auto& codeIndexToken = result.NextCapture(CAPTURE_CODE_INDEX);
|
||||
if (codeIndexToken.IntegerValue() < 0)
|
||||
throw ParsingException(codeIndexToken.GetPos(), "Index cannot be negative");
|
||||
source = ShaderArgumentCodeSource(std::move(accessors), static_cast<size_t>(codeIndexToken.IntegerValue()));
|
||||
}
|
||||
else
|
||||
source = ShaderArgumentCodeSource(std::move(accessors));
|
||||
|
||||
std::string errorMessage;
|
||||
if (!state->m_acceptor->AcceptShaderCodeArgument(state->m_current_shader, std::move(arg), std::move(source), errorMessage))
|
||||
throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), std::move(errorMessage));
|
||||
}
|
||||
|
||||
static void ProcessLiteralArgument(const TechniqueParserState* state, SequenceResult<SimpleParserValue>& result, ShaderArgument arg)
|
||||
{
|
||||
float value[4];
|
||||
for (float& i : value)
|
||||
i = static_cast<float>(result.NextCapture(CAPTURE_LITERAL_VALUE).FloatingPointValue());
|
||||
|
||||
const ShaderArgumentLiteralSource source(value);
|
||||
std::string errorMessage;
|
||||
if (!state->m_acceptor->AcceptShaderLiteralArgument(state->m_current_shader, std::move(arg), source, errorMessage))
|
||||
throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), std::move(errorMessage));
|
||||
}
|
||||
|
||||
static void ProcessMaterialArgument(const TechniqueParserState* state, SequenceResult<SimpleParserValue>& result, ShaderArgument arg)
|
||||
{
|
||||
std::string errorMessage;
|
||||
if (result.HasNextCapture(CAPTURE_MATERIAL_HASH))
|
||||
{
|
||||
ShaderArgumentMaterialSource source(static_cast<size_t>(result.NextCapture(CAPTURE_MATERIAL_HASH).IntegerValue()));
|
||||
if (!state->m_acceptor->AcceptShaderMaterialArgument(state->m_current_shader, std::move(arg), std::move(source), errorMessage))
|
||||
throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), std::move(errorMessage));
|
||||
}
|
||||
else
|
||||
{
|
||||
ShaderArgumentMaterialSource source(result.NextCapture(CAPTURE_MATERIAL_NAME).IdentifierValue());
|
||||
if (!state->m_acceptor->AcceptShaderMaterialArgument(state->m_current_shader, std::move(arg), std::move(source), errorMessage))
|
||||
throw ParsingException(result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), std::move(errorMessage));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessMatch(TechniqueParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
assert(state->m_in_shader == true);
|
||||
state->m_in_shader = false;
|
||||
|
||||
const auto& shaderArgumentNameToken = result.NextCapture(CAPTURE_SHADER_ARGUMENT);
|
||||
|
||||
size_t index = 0u;
|
||||
if (result.HasNextCapture(CAPTURE_SHADER_INDEX))
|
||||
{
|
||||
const auto& shaderArgumentIndexToken = result.NextCapture(CAPTURE_SHADER_INDEX);
|
||||
if (shaderArgumentIndexToken.IntegerValue() < 0)
|
||||
throw ParsingException(shaderArgumentIndexToken.GetPos(), "Index cannot be negative");
|
||||
index = static_cast<size_t>(shaderArgumentIndexToken.IntegerValue());
|
||||
}
|
||||
|
||||
ShaderArgument arg(shaderArgumentNameToken.IdentifierValue(), index);
|
||||
|
||||
const auto typeTag = result.NextTag();
|
||||
assert(typeTag == TAG_CODE || typeTag == TAG_LITERAL || typeTag == TAG_MATERIAL);
|
||||
if (typeTag == TAG_CODE)
|
||||
ProcessCodeArgument(state, result, std::move(arg));
|
||||
else if (typeTag == TAG_LITERAL)
|
||||
ProcessLiteralArgument(state, result, std::move(arg));
|
||||
else
|
||||
ProcessMaterialArgument(state, result, std::move(arg));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniqueShaderScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequenceEndShader()
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
#include "Techset/Parsing/TechniqueFileParser.h"
|
||||
|
||||
namespace techset
|
||||
{
|
||||
class TechniqueShaderScopeSequences
|
||||
{
|
||||
TechniqueShaderScopeSequences() = default;
|
||||
|
||||
public:
|
||||
static const std::vector<TechniqueParser::sequence_t*>& GetSequences();
|
||||
};
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
#include "TechniqueFileParser.h"
|
||||
|
||||
#include "Sequence/TechniqueNoScopeSequences.h"
|
||||
#include "Sequence/TechniquePassScopeSequences.h"
|
||||
#include "Sequence/TechniqueShaderScopeSequences.h"
|
||||
|
||||
using namespace techset;
|
||||
|
||||
TechniqueParser::TechniqueParser(SimpleLexer* lexer, ITechniqueDefinitionAcceptor* acceptor)
|
||||
@ -7,11 +11,13 @@ TechniqueParser::TechniqueParser(SimpleLexer* lexer, ITechniqueDefinitionAccepto
|
||||
{
|
||||
}
|
||||
|
||||
const std::vector<AbstractParser<SimpleParserValue, TechniqueParserState>::sequence_t*>& TechniqueParser::GetTestsForState()
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniqueParser::GetTestsForState()
|
||||
{
|
||||
// TODO: Tests
|
||||
static std::vector<sequence_t*> tests({
|
||||
});
|
||||
if (m_state->m_in_shader)
|
||||
return TechniqueShaderScopeSequences::GetSequences();
|
||||
|
||||
return tests;
|
||||
if (m_state->m_in_pass)
|
||||
return TechniquePassScopeSequences::GetSequences();
|
||||
|
||||
return TechniqueNoScopeSequences::GetSequences();
|
||||
}
|
||||
|
@ -5,7 +5,11 @@
|
||||
using namespace techset;
|
||||
|
||||
TechniqueParserState::TechniqueParserState(ITechniqueDefinitionAcceptor* acceptor)
|
||||
: m_acceptor(acceptor)
|
||||
: m_acceptor(acceptor),
|
||||
m_before_first_pass(true),
|
||||
m_in_pass(false),
|
||||
m_in_shader(false),
|
||||
m_current_shader(ShaderSelector::VERTEX_SHADER)
|
||||
{
|
||||
assert(acceptor);
|
||||
}
|
||||
|
@ -9,6 +9,11 @@ namespace techset
|
||||
public:
|
||||
ITechniqueDefinitionAcceptor* const m_acceptor;
|
||||
|
||||
bool m_before_first_pass;
|
||||
bool m_in_pass;
|
||||
bool m_in_shader;
|
||||
ShaderSelector m_current_shader;
|
||||
|
||||
explicit TechniqueParserState(ITechniqueDefinitionAcceptor* acceptor);
|
||||
};
|
||||
}
|
||||
|
@ -71,6 +71,8 @@ namespace techset
|
||||
ITechniqueDefinitionAcceptor& operator=(const ITechniqueDefinitionAcceptor& other) = default;
|
||||
ITechniqueDefinitionAcceptor& operator=(ITechniqueDefinitionAcceptor&& other) noexcept = default;
|
||||
|
||||
virtual void AcceptNextPass() = 0;
|
||||
|
||||
virtual void AcceptStateMap(const std::string& stateMapName) = 0;
|
||||
|
||||
virtual bool AcceptVertexShader(size_t shaderVersionMajor, size_t shaderVersionMinor, const std::string& vertexShaderName, std::string& errorMessage) = 0;
|
||||
|
@ -209,7 +209,7 @@ namespace IW4
|
||||
else if (arg.type == MTL_ARG_MATERIAL_PIXEL_CONST || arg.type == MTL_ARG_MATERIAL_VERTEX_CONST || arg.type == MTL_ARG_MATERIAL_PIXEL_SAMPLER)
|
||||
{
|
||||
Indent();
|
||||
m_stream << codeDestAccessor << " = material.#" << std::hex << arg.u.nameHash << ";\n";
|
||||
m_stream << codeDestAccessor << " = material.#0x" << std::hex << arg.u.nameHash << ";\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user