2015-07-21 23:38:59 +00:00
|
|
|
// Copyright 2015 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-01-07 20:37:42 +00:00
|
|
|
#include <memory>
|
2015-07-21 23:38:59 +00:00
|
|
|
#include "common/common_types.h"
|
|
|
|
|
2023-12-28 10:46:57 +00:00
|
|
|
namespace Pica {
|
2015-07-21 23:38:59 +00:00
|
|
|
|
2023-12-28 10:46:57 +00:00
|
|
|
struct ShaderSetup;
|
|
|
|
struct ShaderUnit;
|
2016-12-17 07:21:26 +00:00
|
|
|
|
|
|
|
class ShaderEngine {
|
|
|
|
public:
|
|
|
|
virtual ~ShaderEngine() = default;
|
2016-03-30 00:45:18 +00:00
|
|
|
|
|
|
|
/**
|
2016-09-18 00:38:01 +00:00
|
|
|
* Performs any shader unit setup that only needs to happen once per shader (as opposed to once
|
2016-09-19 01:01:46 +00:00
|
|
|
* per vertex, which would happen within the `Run` function).
|
2016-03-30 00:45:18 +00:00
|
|
|
*/
|
2023-11-26 23:15:36 +00:00
|
|
|
virtual void SetupBatch(ShaderSetup& setup, u32 entry_point) = 0;
|
2016-03-30 00:45:18 +00:00
|
|
|
|
|
|
|
/**
|
2016-12-18 00:06:04 +00:00
|
|
|
* Runs the currently setup shader.
|
|
|
|
*
|
|
|
|
* @param setup Shader engine state, must be setup with SetupBatch on each shader change.
|
|
|
|
* @param state Shader unit state, must be setup with input data before each shader invocation.
|
2016-03-30 00:45:18 +00:00
|
|
|
*/
|
2023-12-28 10:46:57 +00:00
|
|
|
virtual void Run(const ShaderSetup& setup, ShaderUnit& state) const = 0;
|
2016-03-30 00:45:18 +00:00
|
|
|
};
|
2015-07-21 23:38:59 +00:00
|
|
|
|
2023-12-28 10:46:57 +00:00
|
|
|
std::unique_ptr<ShaderEngine> CreateEngine(bool use_jit);
|
2016-12-17 07:21:26 +00:00
|
|
|
|
2023-12-28 10:46:57 +00:00
|
|
|
} // namespace Pica
|