Shader: Store AttributeBuffers in GS output buffer

This also does the output masking early at EMIT time, instead of when a
triangle is sent to the vertex handler.
This commit is contained in:
Yuri Kunde Schlesner 2017-12-09 20:30:14 -08:00
parent 0184419814
commit 230a7557f1
2 changed files with 7 additions and 7 deletions

View File

@ -99,16 +99,16 @@ GSEmitter::~GSEmitter() {
delete handlers;
}
void GSEmitter::Emit(Math::Vec4<float24> (&vertex)[16]) {
void GSEmitter::Emit(Math::Vec4<float24> (&output_regs)[16]) {
ASSERT(vertex_id < 3);
std::copy(std::begin(vertex), std::end(vertex), buffer[vertex_id].begin());
// TODO: This should be merged with UnitState::WriteOutput somehow
CopyRegistersToOutput(output_regs, output_mask, buffer[vertex_id]);
if (prim_emit) {
if (winding)
handlers->winding_setter();
for (size_t i = 0; i < buffer.size(); ++i) {
AttributeBuffer output;
CopyRegistersToOutput(buffer[i].data(), output_mask, output);
handlers->vertex_handler(output);
handlers->vertex_handler(buffer[i]);
}
}
}

View File

@ -72,7 +72,7 @@ static_assert(sizeof(OutputVertex) == 24 * sizeof(float), "OutputVertex has inva
* This structure contains state information for primitive emitting in geometry shader.
*/
struct GSEmitter {
std::array<std::array<Math::Vec4<float24>, 16>, 3> buffer;
std::array<AttributeBuffer, 3> buffer;
u8 vertex_id;
bool prim_emit;
bool winding;
@ -87,7 +87,7 @@ struct GSEmitter {
GSEmitter();
~GSEmitter();
void Emit(Math::Vec4<float24> (&vertex)[16]);
void Emit(Math::Vec4<float24> (&output_regs)[16]);
};
static_assert(std::is_standard_layout<GSEmitter>::value, "GSEmitter is not standard layout type");