Shader: Refactor output_mask copy loop to function
This commit is contained in:
parent
a5aa5e2b2d
commit
0184419814
@ -77,13 +77,18 @@ void UnitState::LoadInput(const ShaderRegs& config, const AttributeBuffer& input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitState::WriteOutput(const ShaderRegs& config, AttributeBuffer& output) {
|
static void CopyRegistersToOutput(const Math::Vec4<float24>* regs, u32 mask,
|
||||||
unsigned int output_i = 0;
|
AttributeBuffer& buffer) {
|
||||||
for (unsigned int reg : Common::BitSet<u32>(config.output_mask)) {
|
int output_i = 0;
|
||||||
output.attr[output_i++] = registers.output[reg];
|
for (int reg : Common::BitSet<u32>(mask)) {
|
||||||
|
buffer.attr[output_i++] = regs[reg];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UnitState::WriteOutput(const ShaderRegs& config, AttributeBuffer& output) {
|
||||||
|
CopyRegistersToOutput(registers.output, config.output_mask, output);
|
||||||
|
}
|
||||||
|
|
||||||
UnitState::UnitState(GSEmitter* emitter) : emitter_ptr(emitter) {}
|
UnitState::UnitState(GSEmitter* emitter) : emitter_ptr(emitter) {}
|
||||||
|
|
||||||
GSEmitter::GSEmitter() {
|
GSEmitter::GSEmitter() {
|
||||||
@ -102,10 +107,7 @@ void GSEmitter::Emit(Math::Vec4<float24> (&vertex)[16]) {
|
|||||||
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;
|
AttributeBuffer output;
|
||||||
unsigned int output_i = 0;
|
CopyRegistersToOutput(buffer[i].data(), output_mask, output);
|
||||||
for (unsigned int reg : Common::BitSet<u32>(output_mask)) {
|
|
||||||
output.attr[output_i++] = buffer[i][reg];
|
|
||||||
}
|
|
||||||
handlers->vertex_handler(output);
|
handlers->vertex_handler(output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user