|
|
|
@ -104,40 +104,22 @@ Shader::CompareFunction MaxwellToCompareFunction(Maxwell::ComparisonOp compariso |
|
|
|
case Maxwell::ComparisonOp::Always_GL: |
|
|
|
return Shader::CompareFunction::Always; |
|
|
|
} |
|
|
|
UNIMPLEMENTED_MSG("Unimplemented comparison op={}", comparison); |
|
|
|
UNIMPLEMENTED_MSG("op={}", comparison); |
|
|
|
return {}; |
|
|
|
} |
|
|
|
|
|
|
|
Shader::AttributeType CastAttributeType(const FixedPipelineState::VertexAttribute& attr) { |
|
|
|
if (attr.enabled == 0) { |
|
|
|
return Shader::AttributeType::Disabled; |
|
|
|
} |
|
|
|
switch (attr.Type()) { |
|
|
|
case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway: |
|
|
|
ASSERT(false && "Invalid vertex attribute type!"); |
|
|
|
return Shader::AttributeType::Disabled; |
|
|
|
case Maxwell::VertexAttribute::Type::SNorm: return Shader::AttributeType::SignedNorm; |
|
|
|
case Maxwell::VertexAttribute::Type::UNorm: return Shader::AttributeType::UnsignedNorm; |
|
|
|
case Maxwell::VertexAttribute::Type::Float: return Shader::AttributeType::Float; |
|
|
|
case Maxwell::VertexAttribute::Type::SInt: return Shader::AttributeType::SignedInt; |
|
|
|
Shader::AttributeType MaxwellToAttributeType(Maxwell::VertexAttribute::Type type) noexcept { |
|
|
|
switch (type) { |
|
|
|
case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway: return Shader::AttributeType::Disabled; |
|
|
|
case Maxwell::VertexAttribute::Type::UInt: return Shader::AttributeType::UnsignedInt; |
|
|
|
case Maxwell::VertexAttribute::Type::SInt: return Shader::AttributeType::SignedInt; |
|
|
|
case Maxwell::VertexAttribute::Type::UScaled: return Shader::AttributeType::UnsignedScaled; |
|
|
|
case Maxwell::VertexAttribute::Type::SScaled: return Shader::AttributeType::SignedScaled; |
|
|
|
case Maxwell::VertexAttribute::Type::Float: return Shader::AttributeType::Float; |
|
|
|
case Maxwell::VertexAttribute::Type::UNorm: return Shader::AttributeType::Float; |
|
|
|
case Maxwell::VertexAttribute::Type::SNorm: return Shader::AttributeType::Float; |
|
|
|
} |
|
|
|
return Shader::AttributeType::Float; |
|
|
|
} |
|
|
|
|
|
|
|
Shader::AttributeType AttributeType(const FixedPipelineState& state, size_t index) { |
|
|
|
switch (state.DynamicAttributeType(index)) { |
|
|
|
case 0: return Shader::AttributeType::Disabled; |
|
|
|
case 1: return Shader::AttributeType::SignedNorm; |
|
|
|
case 2: return Shader::AttributeType::UnsignedNorm; |
|
|
|
case 3: return Shader::AttributeType::SignedInt; |
|
|
|
case 4: return Shader::AttributeType::UnsignedInt; |
|
|
|
case 5: return Shader::AttributeType::UnsignedScaled; |
|
|
|
case 6: return Shader::AttributeType::SignedScaled; |
|
|
|
case 7: return Shader::AttributeType::Float; |
|
|
|
} |
|
|
|
UNIMPLEMENTED_MSG("op={}", index); |
|
|
|
return Shader::AttributeType::Disabled; |
|
|
|
} |
|
|
|
|
|
|
|
@ -179,12 +161,12 @@ Shader::RuntimeInfo MakeRuntimeInfo(std::span<const Shader::IR::Program> program |
|
|
|
info.convert_depth_mode = gl_ndc; |
|
|
|
} |
|
|
|
if (key.state.dynamic_vertex_input) { |
|
|
|
for (size_t index = 0; index < Maxwell::NumVertexAttributes; ++index) { |
|
|
|
info.generic_input_types[index] = AttributeType(key.state, index); |
|
|
|
} |
|
|
|
for (size_t i = 0; i < Maxwell::NumVertexAttributes; ++i) |
|
|
|
info.generic_input_types[i] = MaxwellToAttributeType(key.state.DynamicAttributeType(i)); |
|
|
|
} else { |
|
|
|
std::ranges::transform(key.state.attributes, info.generic_input_types.begin(), |
|
|
|
&CastAttributeType); |
|
|
|
std::ranges::transform(key.state.attributes, info.generic_input_types.begin(), [](auto const attr) { |
|
|
|
return attr.enabled ? MaxwellToAttributeType(attr.Type()) : Shader::AttributeType::Disabled; |
|
|
|
}); |
|
|
|
} |
|
|
|
break; |
|
|
|
case Shader::Stage::TessellationEval: |
|
|
|
|