Fixing vfetch_mini use.

This commit is contained in:
Ben Vanik 2015-12-07 19:16:32 -08:00
parent 522ff9d23e
commit 1f773f14b3
2 changed files with 10 additions and 6 deletions

View File

@ -205,6 +205,9 @@ void ShaderTranslator::GatherVertexBindingInformation(
return; return;
} }
ParsedVertexFetchInstruction fetch_instr;
ParseVertexFetchInstruction(op, &fetch_instr);
// Try to allocate an attribute on an existing binding. // Try to allocate an attribute on an existing binding.
// If no binding for this fetch slot is found create it. // If no binding for this fetch slot is found create it.
using VertexBinding = Shader::VertexBinding; using VertexBinding = Shader::VertexBinding;
@ -212,18 +215,19 @@ void ShaderTranslator::GatherVertexBindingInformation(
for (auto& vertex_binding : vertex_bindings_) { for (auto& vertex_binding : vertex_bindings_) {
if (vertex_binding.fetch_constant == op.fetch_constant_index()) { if (vertex_binding.fetch_constant == op.fetch_constant_index()) {
// It may not hold that all strides are equal, but I hope it does. // It may not hold that all strides are equal, but I hope it does.
assert_true(!op.stride() || vertex_binding.stride_words == op.stride()); assert_true(!fetch_instr.attributes.stride ||
vertex_binding.stride_words == fetch_instr.attributes.stride);
vertex_binding.attributes.push_back({}); vertex_binding.attributes.push_back({});
attrib = &vertex_binding.attributes.back(); attrib = &vertex_binding.attributes.back();
break; break;
} }
} }
if (!attrib) { if (!attrib) {
assert_not_zero(op.stride()); assert_not_zero(fetch_instr.attributes.stride);
VertexBinding vertex_binding; VertexBinding vertex_binding;
vertex_binding.binding_index = static_cast<int>(vertex_bindings_.size()); vertex_binding.binding_index = static_cast<int>(vertex_bindings_.size());
vertex_binding.fetch_constant = op.fetch_constant_index(); vertex_binding.fetch_constant = op.fetch_constant_index();
vertex_binding.stride_words = op.stride(); vertex_binding.stride_words = fetch_instr.attributes.stride;
vertex_binding.attributes.push_back({}); vertex_binding.attributes.push_back({});
vertex_bindings_.emplace_back(std::move(vertex_binding)); vertex_bindings_.emplace_back(std::move(vertex_binding));
attrib = &vertex_bindings_.back().attributes.back(); attrib = &vertex_bindings_.back().attributes.back();
@ -231,7 +235,7 @@ void ShaderTranslator::GatherVertexBindingInformation(
// Populate attribute. // Populate attribute.
attrib->attrib_index = total_attrib_count_++; attrib->attrib_index = total_attrib_count_++;
ParseVertexFetchInstruction(op, &attrib->fetch_instr); attrib->fetch_instr = fetch_instr;
attrib->size_words = attrib->size_words =
GetVertexFormatSizeInWords(attrib->fetch_instr.attributes.data_format); GetVertexFormatSizeInWords(attrib->fetch_instr.attributes.data_format);
} }
@ -670,7 +674,7 @@ void ShaderTranslator::ParseVertexFetchInstruction(
i.attributes.data_format = op.data_format(); i.attributes.data_format = op.data_format();
i.attributes.offset = op.offset(); i.attributes.offset = op.offset();
i.attributes.stride = op.stride(); i.attributes.stride = full_op.stride();
i.attributes.exp_adjust = op.exp_adjust(); i.attributes.exp_adjust = op.exp_adjust();
i.attributes.is_index_rounded = op.is_index_rounded(); i.attributes.is_index_rounded = op.is_index_rounded();
i.attributes.is_signed = op.is_signed(); i.attributes.is_signed = op.is_signed();

View File

@ -332,7 +332,7 @@ void ParsedVertexFetchInstruction::Disassemble(StringBuffer* out) const {
", DataFormat=%s", ", DataFormat=%s",
kVertexFetchDataFormats[static_cast<int>(attributes.data_format)]); kVertexFetchDataFormats[static_cast<int>(attributes.data_format)]);
} }
if (attributes.stride) { if (!is_mini_fetch && attributes.stride) {
out->AppendFormat(", Stride=%d", attributes.stride); out->AppendFormat(", Stride=%d", attributes.stride);
} }
if (attributes.is_signed) { if (attributes.is_signed) {