mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 08:05:45 +00:00
ZoneCodeGenerator: Make static operands able to have the value of an enum entry
This commit is contained in:
parent
31b279c1e6
commit
5f0f73838f
@ -329,8 +329,7 @@ set count GfxPixelShaderLoadDef::program programSize;
|
|||||||
|
|
||||||
// MaterialShaderArgument
|
// MaterialShaderArgument
|
||||||
use MaterialShaderArgument;
|
use MaterialShaderArgument;
|
||||||
//set condition u::literalConst type == MTL_ARG_LITERAL_VERTEX_CONST || type == MTL_ARG_LITERAL_PIXEL_CONST;
|
set condition u::literalConst type == MTL_ARG_LITERAL_VERTEX_CONST || type == MTL_ARG_LITERAL_PIXEL_CONST;
|
||||||
set condition u::literalConst type == 1 || type == 7;
|
|
||||||
set reusable u::literalConst;
|
set reusable u::literalConst;
|
||||||
set count u::literalConst 1;
|
set count u::literalConst 1;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ namespace ZoneCodeGenerator.Domain.Evaluation
|
|||||||
class OperandStatic : IEvaluation
|
class OperandStatic : IEvaluation
|
||||||
{
|
{
|
||||||
public int Value { get; }
|
public int Value { get; }
|
||||||
|
public EnumMember EnumMemberValue { get; }
|
||||||
|
|
||||||
public bool IsStatic => true;
|
public bool IsStatic => true;
|
||||||
public int EvaluateNumeric()
|
public int EvaluateNumeric()
|
||||||
@ -19,6 +20,13 @@ namespace ZoneCodeGenerator.Domain.Evaluation
|
|||||||
public OperandStatic(int value)
|
public OperandStatic(int value)
|
||||||
{
|
{
|
||||||
Value = value;
|
Value = value;
|
||||||
|
EnumMemberValue = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public OperandStatic(EnumMember enumMember)
|
||||||
|
{
|
||||||
|
Value = (int) enumMember.Value;
|
||||||
|
EnumMemberValue = enumMember;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using ZoneCodeGenerator.Domain;
|
||||||
using ZoneCodeGenerator.Domain.Evaluation;
|
using ZoneCodeGenerator.Domain.Evaluation;
|
||||||
using ZoneCodeGenerator.Domain.Information;
|
using ZoneCodeGenerator.Domain.Information;
|
||||||
using ZoneCodeGenerator.Parsing.Matching;
|
using ZoneCodeGenerator.Parsing.Matching;
|
||||||
@ -94,6 +95,18 @@ namespace ZoneCodeGenerator.Parsing.CommandFile.Tests
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nameParts = typenameString.Split(new[] { "::" }, StringSplitOptions.None);
|
var nameParts = typenameString.Split(new[] { "::" }, StringSplitOptions.None);
|
||||||
|
|
||||||
|
if (nameParts.Length == 1 && arrayIndexStrings.Count == 0)
|
||||||
|
{
|
||||||
|
var enumMember = state.Repository.GetAllEnums().SelectMany(_enum => _enum.Members)
|
||||||
|
.FirstOrDefault(member => member.Name.Equals(nameParts[0]));
|
||||||
|
|
||||||
|
if(enumMember != null)
|
||||||
|
{
|
||||||
|
return new OperandStatic(enumMember);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<MemberInformation> referencedMemberChain = null;
|
List<MemberInformation> referencedMemberChain = null;
|
||||||
|
|
||||||
var referencedType = GetUsedTypes(state)
|
var referencedType = GetUsedTypes(state)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user