VideoCore/Shader: Move per-batch ShaderEngine state into ShaderSetup
This commit is contained in:
parent
6fa3687afc
commit
0f64274145
7 changed files with 43 additions and 46 deletions
|
@ -167,6 +167,12 @@ struct ShaderSetup {
|
|||
|
||||
std::array<u32, 1024> program_code;
|
||||
std::array<u32, 1024> swizzle_data;
|
||||
|
||||
/// Data private to ShaderEngines
|
||||
struct EngineData {
|
||||
/// Used by the JIT, points to a compiled shader object.
|
||||
const void* cached_shader = nullptr;
|
||||
} engine_data;
|
||||
};
|
||||
|
||||
class ShaderEngine {
|
||||
|
@ -177,13 +183,16 @@ public:
|
|||
* Performs any shader unit setup that only needs to happen once per shader (as opposed to once
|
||||
* per vertex, which would happen within the `Run` function).
|
||||
*/
|
||||
virtual void SetupBatch(const ShaderSetup* setup) = 0;
|
||||
virtual void SetupBatch(ShaderSetup& setup) = 0;
|
||||
|
||||
/**
|
||||
* Runs the currently setup shader
|
||||
* @param state Shader unit state, must be setup per shader and per shader unit
|
||||
* 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.
|
||||
*/
|
||||
virtual void Run(UnitState& state, unsigned int entry_point) const = 0;
|
||||
virtual void Run(const ShaderSetup& setup, UnitState& state,
|
||||
unsigned int entry_point) const = 0;
|
||||
};
|
||||
|
||||
// TODO(yuriks): Remove and make it non-global state somewhere
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue