summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/shader.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2017-09-08 05:02:59 +0200
committerGitHub <noreply@github.com>2017-09-08 05:02:59 +0200
commit11baa40d75d8a479bd738a05e91bba6f09856fe5 (patch)
tree2a7affcefd22d5332970c7a28a04c139aa9a6654 /src/video_core/shader/shader.cpp
parentMerge pull request #2918 from jroweboy/remove-debug (diff)
parentpica/command_processor: build geometry pipeline and run geometry shader (diff)
downloadyuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.gz
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.bz2
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.lz
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.xz
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.tar.zst
yuzu-11baa40d75d8a479bd738a05e91bba6f09856fe5.zip
Diffstat (limited to 'src/video_core/shader/shader.cpp')
-rw-r--r--src/video_core/shader/shader.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index 67ed19ba8..e9063e616 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -21,7 +21,8 @@ namespace Pica {
namespace Shader {
-OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs, AttributeBuffer& input) {
+OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs,
+ const AttributeBuffer& input) {
// Setup output data
union {
OutputVertex ret{};
@@ -82,6 +83,44 @@ void UnitState::WriteOutput(const ShaderRegs& config, AttributeBuffer& output) {
}
}
+UnitState::UnitState(GSEmitter* emitter) : emitter_ptr(emitter) {}
+
+GSEmitter::GSEmitter() {
+ handlers = new Handlers;
+}
+
+GSEmitter::~GSEmitter() {
+ delete handlers;
+}
+
+void GSEmitter::Emit(Math::Vec4<float24> (&vertex)[16]) {
+ ASSERT(vertex_id < 3);
+ std::copy(std::begin(vertex), std::end(vertex), buffer[vertex_id].begin());
+ if (prim_emit) {
+ if (winding)
+ handlers->winding_setter();
+ for (size_t i = 0; i < buffer.size(); ++i) {
+ AttributeBuffer output;
+ unsigned int output_i = 0;
+ for (unsigned int reg : Common::BitSet<u32>(output_mask)) {
+ output.attr[output_i++] = buffer[i][reg];
+ }
+ handlers->vertex_handler(output);
+ }
+ }
+}
+
+GSUnitState::GSUnitState() : UnitState(&emitter) {}
+
+void GSUnitState::SetVertexHandler(VertexHandler vertex_handler, WindingSetter winding_setter) {
+ emitter.handlers->vertex_handler = std::move(vertex_handler);
+ emitter.handlers->winding_setter = std::move(winding_setter);
+}
+
+void GSUnitState::ConfigOutput(const ShaderRegs& config) {
+ emitter.output_mask = config.output_mask;
+}
+
MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
#ifdef ARCHITECTURE_x86_64