diff options
| author | 2016-03-30 02:45:18 +0200 | |
|---|---|---|
| committer | 2016-05-11 23:48:24 +0200 | |
| commit | ae7a82fa1c65b4efc9e7bf9863fa229778a72d1c (patch) | |
| tree | 5a2da227058d4f22b3e3e0d21a1f13a02f7e5e37 /src/video_core/shader/shader.h | |
| parent | Merge pull request #1621 from JayFoxRox/w-buffer (diff) | |
| download | yuzu-ae7a82fa1c65b4efc9e7bf9863fa229778a72d1c.tar.gz yuzu-ae7a82fa1c65b4efc9e7bf9863fa229778a72d1c.tar.xz yuzu-ae7a82fa1c65b4efc9e7bf9863fa229778a72d1c.zip | |
Turn ShaderSetup into struct
Diffstat (limited to 'src/video_core/shader/shader.h')
| -rw-r--r-- | src/video_core/shader/shader.h | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index 56b83bfeb..cfbb7f2ee 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h | |||
| @@ -83,23 +83,6 @@ struct OutputVertex { | |||
| 83 | static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD"); | 83 | static_assert(std::is_pod<OutputVertex>::value, "Structure is not POD"); |
| 84 | static_assert(sizeof(OutputVertex) == 32 * sizeof(float), "OutputVertex has invalid size"); | 84 | static_assert(sizeof(OutputVertex) == 32 * sizeof(float), "OutputVertex has invalid size"); |
| 85 | 85 | ||
| 86 | /// Vertex shader memory | ||
| 87 | struct ShaderSetup { | ||
| 88 | struct { | ||
| 89 | // The float uniforms are accessed by the shader JIT using SSE instructions, and are | ||
| 90 | // therefore required to be 16-byte aligned. | ||
| 91 | alignas(16) Math::Vec4<float24> f[96]; | ||
| 92 | |||
| 93 | std::array<bool, 16> b; | ||
| 94 | std::array<Math::Vec4<u8>, 4> i; | ||
| 95 | } uniforms; | ||
| 96 | |||
| 97 | Math::Vec4<float24> default_attributes[16]; | ||
| 98 | |||
| 99 | std::array<u32, 1024> program_code; | ||
| 100 | std::array<u32, 1024> swizzle_data; | ||
| 101 | }; | ||
| 102 | |||
| 103 | // Helper structure used to keep track of data useful for inspection of shader emulation | 86 | // Helper structure used to keep track of data useful for inspection of shader emulation |
| 104 | template<bool full_debugging> | 87 | template<bool full_debugging> |
| 105 | struct DebugData; | 88 | struct DebugData; |
| @@ -342,33 +325,51 @@ struct UnitState { | |||
| 342 | } | 325 | } |
| 343 | }; | 326 | }; |
| 344 | 327 | ||
| 345 | /** | 328 | /// Clears the shader cache |
| 346 | * Performs any shader unit setup that only needs to happen once per shader (as opposed to once per | 329 | void ClearCache(); |
| 347 | * vertex, which would happen within the `Run` function). | 330 | |
| 348 | */ | 331 | struct ShaderSetup { |
| 349 | void Setup(); | ||
| 350 | 332 | ||
| 351 | /// Performs any cleanup when the emulator is shutdown | 333 | struct { |
| 352 | void Shutdown(); | 334 | // The float uniforms are accessed by the shader JIT using SSE instructions, and are |
| 335 | // therefore required to be 16-byte aligned. | ||
| 336 | alignas(16) Math::Vec4<float24> f[96]; | ||
| 353 | 337 | ||
| 354 | /** | 338 | std::array<bool, 16> b; |
| 355 | * Runs the currently setup shader | 339 | std::array<Math::Vec4<u8>, 4> i; |
| 356 | * @param state Shader unit state, must be setup per shader and per shader unit | 340 | } uniforms; |
| 357 | * @param input Input vertex into the shader | ||
| 358 | * @param num_attributes The number of vertex shader attributes | ||
| 359 | * @return The output vertex, after having been processed by the vertex shader | ||
| 360 | */ | ||
| 361 | OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attributes); | ||
| 362 | 341 | ||
| 363 | /** | 342 | Math::Vec4<float24> default_attributes[16]; |
| 364 | * Produce debug information based on the given shader and input vertex | 343 | |
| 365 | * @param input Input vertex into the shader | 344 | std::array<u32, 1024> program_code; |
| 366 | * @param num_attributes The number of vertex shader attributes | 345 | std::array<u32, 1024> swizzle_data; |
| 367 | * @param config Configuration object for the shader pipeline | 346 | |
| 368 | * @param setup Setup object for the shader pipeline | 347 | /** |
| 369 | * @return Debug information for this shader with regards to the given vertex | 348 | * Performs any shader unit setup that only needs to happen once per shader (as opposed to once per |
| 370 | */ | 349 | * vertex, which would happen within the `Run` function). |
| 371 | DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, const Regs::ShaderConfig& config, const ShaderSetup& setup); | 350 | */ |
| 351 | void Setup(); | ||
| 352 | |||
| 353 | /** | ||
| 354 | * Runs the currently setup shader | ||
| 355 | * @param state Shader unit state, must be setup per shader and per shader unit | ||
| 356 | * @param input Input vertex into the shader | ||
| 357 | * @param num_attributes The number of vertex shader attributes | ||
| 358 | * @return The output vertex, after having been processed by the vertex shader | ||
| 359 | */ | ||
| 360 | OutputVertex Run(UnitState<false>& state, const InputVertex& input, int num_attributes); | ||
| 361 | |||
| 362 | /** | ||
| 363 | * Produce debug information based on the given shader and input vertex | ||
| 364 | * @param input Input vertex into the shader | ||
| 365 | * @param num_attributes The number of vertex shader attributes | ||
| 366 | * @param config Configuration object for the shader pipeline | ||
| 367 | * @param setup Setup object for the shader pipeline | ||
| 368 | * @return Debug information for this shader with regards to the given vertex | ||
| 369 | */ | ||
| 370 | DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, const Regs::ShaderConfig& config, const ShaderSetup& setup); | ||
| 371 | |||
| 372 | }; | ||
| 372 | 373 | ||
| 373 | } // namespace Shader | 374 | } // namespace Shader |
| 374 | 375 | ||