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:
parent
0184419814
commit
230a7557f1
|
@ -99,16 +99,16 @@ GSEmitter::~GSEmitter() {
|
||||||
delete handlers;
|
delete handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSEmitter::Emit(Math::Vec4<float24> (&vertex)[16]) {
|
void GSEmitter::Emit(Math::Vec4<float24> (&output_regs)[16]) {
|
||||||
ASSERT(vertex_id < 3);
|
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 (prim_emit) {
|
||||||
if (winding)
|
if (winding)
|
||||||
handlers->winding_setter();
|
handlers->winding_setter();
|
||||||
for (size_t i = 0; i < buffer.size(); ++i) {
|
for (size_t i = 0; i < buffer.size(); ++i) {
|
||||||
AttributeBuffer output;
|
handlers->vertex_handler(buffer[i]);
|
||||||
CopyRegistersToOutput(buffer[i].data(), output_mask, output);
|
|
||||||
handlers->vertex_handler(output);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* This structure contains state information for primitive emitting in geometry shader.
|
||||||
*/
|
*/
|
||||||
struct GSEmitter {
|
struct GSEmitter {
|
||||||
std::array<std::array<Math::Vec4<float24>, 16>, 3> buffer;
|
std::array<AttributeBuffer, 3> buffer;
|
||||||
u8 vertex_id;
|
u8 vertex_id;
|
||||||
bool prim_emit;
|
bool prim_emit;
|
||||||
bool winding;
|
bool winding;
|
||||||
|
@ -87,7 +87,7 @@ struct GSEmitter {
|
||||||
|
|
||||||
GSEmitter();
|
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");
|
static_assert(std::is_standard_layout<GSEmitter>::value, "GSEmitter is not standard layout type");
|
||||||
|
|
||||||
|
|
Reference in New Issue