|
|
@ -83,23 +83,6 @@ struct OutputVertex { |
|
|
static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD"); |
|
|
static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD"); |
|
|
static_assert(sizeof(OutputVertex) == 32 * sizeof(float), "OutputVertex has invalid size"); |
|
|
static_assert(sizeof(OutputVertex) == 32 * sizeof(float), "OutputVertex has invalid size"); |
|
|
|
|
|
|
|
|
/// Vertex shader memory |
|
|
|
|
|
struct ShaderSetup { |
|
|
|
|
|
struct { |
|
|
|
|
|
// The float uniforms are accessed by the shader JIT using SSE instructions, and are |
|
|
|
|
|
// therefore required to be 16-byte aligned. |
|
|
|
|
|
alignas(16) Math::Vec4<float24> f[96]; |
|
|
|
|
|
|
|
|
|
|
|
std::array<bool, 16> b; |
|
|
|
|
|
std::array<Math::Vec4<u8>, 4> i; |
|
|
|
|
|
} uniforms; |
|
|
|
|
|
|
|
|
|
|
|
Math::Vec4<float24> default_attributes[16]; |
|
|
|
|
|
|
|
|
|
|
|
std::array<u32, 1024> program_code; |
|
|
|
|
|
std::array<u32, 1024> swizzle_data; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
// Helper structure used to keep track of data useful for inspection of shader emulation |
|
|
// Helper structure used to keep track of data useful for inspection of shader emulation |
|
|
template<bool full_debugging> |
|
|
template<bool full_debugging> |
|
|
struct DebugData; |
|
|
struct DebugData; |
|
|
@ -342,15 +325,31 @@ struct UnitState { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/// Clears the shader cache |
|
|
|
|
|
void ClearCache(); |
|
|
|
|
|
|
|
|
|
|
|
struct ShaderSetup { |
|
|
|
|
|
|
|
|
|
|
|
struct { |
|
|
|
|
|
// The float uniforms are accessed by the shader JIT using SSE instructions, and are |
|
|
|
|
|
// therefore required to be 16-byte aligned. |
|
|
|
|
|
alignas(16) Math::Vec4<float24> f[96]; |
|
|
|
|
|
|
|
|
|
|
|
std::array<bool, 16> b; |
|
|
|
|
|
std::array<Math::Vec4<u8>, 4> i; |
|
|
|
|
|
} uniforms; |
|
|
|
|
|
|
|
|
|
|
|
Math::Vec4<float24> default_attributes[16]; |
|
|
|
|
|
|
|
|
|
|
|
std::array<u32, 1024> program_code; |
|
|
|
|
|
std::array<u32, 1024> swizzle_data; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Performs any shader unit setup that only needs to happen once per shader (as opposed to once per |
|
|
* 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). |
|
|
* vertex, which would happen within the `Run` function). |
|
|
*/ |
|
|
*/ |
|
|
void Setup(); |
|
|
void Setup(); |
|
|
|
|
|
|
|
|
/// Performs any cleanup when the emulator is shutdown |
|
|
|
|
|
void Shutdown(); |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Runs the currently setup shader |
|
|
* Runs the currently setup shader |
|
|
* @param state Shader unit state, must be setup per shader and per shader unit |
|
|
* @param state Shader unit state, must be setup per shader and per shader unit |
|
|
@ -370,6 +369,8 @@ OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attr |
|
|
*/ |
|
|
*/ |
|
|
DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, const Regs::ShaderConfig& config, const ShaderSetup& setup); |
|
|
DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, const Regs::ShaderConfig& config, const ShaderSetup& setup); |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
} // namespace Shader |
|
|
} // namespace Shader |
|
|
|
|
|
|
|
|
} // namespace Pica |
|
|
} // namespace Pica |