diff options
| author | 2019-11-18 18:35:21 -0300 | |
|---|---|---|
| committer | 2019-11-22 21:28:48 -0300 | |
| commit | c8a48aacc0a2bfe87de74e0aa7842f5d1aec1558 (patch) | |
| tree | 472a1edcad13f148cf2dc7c25de0cd7b6206e83f /src/video_core/engines | |
| parent | gl_rasterizer: Bind graphics images to draw commands (diff) | |
| download | yuzu-c8a48aacc0a2bfe87de74e0aa7842f5d1aec1558.tar.gz yuzu-c8a48aacc0a2bfe87de74e0aa7842f5d1aec1558.tar.xz yuzu-c8a48aacc0a2bfe87de74e0aa7842f5d1aec1558.zip | |
video_core: Unify ProgramType and ShaderStage into ShaderType
Diffstat (limited to 'src/video_core/engines')
| -rw-r--r-- | src/video_core/engines/const_buffer_engine_interface.h | 10 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/engines/kepler_compute.h | 1 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 33 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 13 | ||||
| -rw-r--r-- | src/video_core/engines/shader_type.h | 20 |
6 files changed, 43 insertions, 35 deletions
diff --git a/src/video_core/engines/const_buffer_engine_interface.h b/src/video_core/engines/const_buffer_engine_interface.h index ac27b6cbe..44b8b8d22 100644 --- a/src/video_core/engines/const_buffer_engine_interface.h +++ b/src/video_core/engines/const_buffer_engine_interface.h | |||
| @@ -8,19 +8,11 @@ | |||
| 8 | #include "common/bit_field.h" | 8 | #include "common/bit_field.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "video_core/engines/shader_bytecode.h" | 10 | #include "video_core/engines/shader_bytecode.h" |
| 11 | #include "video_core/engines/shader_type.h" | ||
| 11 | #include "video_core/textures/texture.h" | 12 | #include "video_core/textures/texture.h" |
| 12 | 13 | ||
| 13 | namespace Tegra::Engines { | 14 | namespace Tegra::Engines { |
| 14 | 15 | ||
| 15 | enum class ShaderType : u32 { | ||
| 16 | Vertex = 0, | ||
| 17 | TesselationControl = 1, | ||
| 18 | TesselationEval = 2, | ||
| 19 | Geometry = 3, | ||
| 20 | Fragment = 4, | ||
| 21 | Compute = 5, | ||
| 22 | }; | ||
| 23 | |||
| 24 | struct SamplerDescriptor { | 16 | struct SamplerDescriptor { |
| 25 | union { | 17 | union { |
| 26 | BitField<0, 20, Tegra::Shader::TextureType> texture_type; | 18 | BitField<0, 20, Tegra::Shader::TextureType> texture_type; |
diff --git a/src/video_core/engines/kepler_compute.cpp b/src/video_core/engines/kepler_compute.cpp index 3a39aeabe..110406f2f 100644 --- a/src/video_core/engines/kepler_compute.cpp +++ b/src/video_core/engines/kepler_compute.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "video_core/engines/kepler_compute.h" | 9 | #include "video_core/engines/kepler_compute.h" |
| 10 | #include "video_core/engines/maxwell_3d.h" | 10 | #include "video_core/engines/maxwell_3d.h" |
| 11 | #include "video_core/engines/shader_type.h" | ||
| 11 | #include "video_core/memory_manager.h" | 12 | #include "video_core/memory_manager.h" |
| 12 | #include "video_core/rasterizer_interface.h" | 13 | #include "video_core/rasterizer_interface.h" |
| 13 | #include "video_core/renderer_base.h" | 14 | #include "video_core/renderer_base.h" |
diff --git a/src/video_core/engines/kepler_compute.h b/src/video_core/engines/kepler_compute.h index c526287b7..4ef3e0613 100644 --- a/src/video_core/engines/kepler_compute.h +++ b/src/video_core/engines/kepler_compute.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "video_core/engines/const_buffer_engine_interface.h" | 13 | #include "video_core/engines/const_buffer_engine_interface.h" |
| 14 | #include "video_core/engines/engine_upload.h" | 14 | #include "video_core/engines/engine_upload.h" |
| 15 | #include "video_core/engines/shader_type.h" | ||
| 15 | #include "video_core/gpu.h" | 16 | #include "video_core/gpu.h" |
| 16 | #include "video_core/textures/texture.h" | 17 | #include "video_core/textures/texture.h" |
| 17 | 18 | ||
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index a44c09003..15a7a9d6a 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 10 | #include "video_core/debug_utils/debug_utils.h" | 10 | #include "video_core/debug_utils/debug_utils.h" |
| 11 | #include "video_core/engines/maxwell_3d.h" | 11 | #include "video_core/engines/maxwell_3d.h" |
| 12 | #include "video_core/engines/shader_type.h" | ||
| 12 | #include "video_core/memory_manager.h" | 13 | #include "video_core/memory_manager.h" |
| 13 | #include "video_core/rasterizer_interface.h" | 14 | #include "video_core/rasterizer_interface.h" |
| 14 | #include "video_core/textures/texture.h" | 15 | #include "video_core/textures/texture.h" |
| @@ -368,24 +369,24 @@ void Maxwell3D::CallMethod(const GPU::MethodCall& method_call) { | |||
| 368 | StartCBData(method); | 369 | StartCBData(method); |
| 369 | break; | 370 | break; |
| 370 | } | 371 | } |
| 371 | case MAXWELL3D_REG_INDEX(cb_bind[0].raw_config): { | 372 | case MAXWELL3D_REG_INDEX(cb_bind[0]): { |
| 372 | ProcessCBBind(Regs::ShaderStage::Vertex); | 373 | ProcessCBBind(0); |
| 373 | break; | 374 | break; |
| 374 | } | 375 | } |
| 375 | case MAXWELL3D_REG_INDEX(cb_bind[1].raw_config): { | 376 | case MAXWELL3D_REG_INDEX(cb_bind[1]): { |
| 376 | ProcessCBBind(Regs::ShaderStage::TesselationControl); | 377 | ProcessCBBind(1); |
| 377 | break; | 378 | break; |
| 378 | } | 379 | } |
| 379 | case MAXWELL3D_REG_INDEX(cb_bind[2].raw_config): { | 380 | case MAXWELL3D_REG_INDEX(cb_bind[2]): { |
| 380 | ProcessCBBind(Regs::ShaderStage::TesselationEval); | 381 | ProcessCBBind(2); |
| 381 | break; | 382 | break; |
| 382 | } | 383 | } |
| 383 | case MAXWELL3D_REG_INDEX(cb_bind[3].raw_config): { | 384 | case MAXWELL3D_REG_INDEX(cb_bind[3]): { |
| 384 | ProcessCBBind(Regs::ShaderStage::Geometry); | 385 | ProcessCBBind(3); |
| 385 | break; | 386 | break; |
| 386 | } | 387 | } |
| 387 | case MAXWELL3D_REG_INDEX(cb_bind[4].raw_config): { | 388 | case MAXWELL3D_REG_INDEX(cb_bind[4]): { |
| 388 | ProcessCBBind(Regs::ShaderStage::Fragment); | 389 | ProcessCBBind(4); |
| 389 | break; | 390 | break; |
| 390 | } | 391 | } |
| 391 | case MAXWELL3D_REG_INDEX(draw.vertex_end_gl): { | 392 | case MAXWELL3D_REG_INDEX(draw.vertex_end_gl): { |
| @@ -687,10 +688,10 @@ void Maxwell3D::DrawArrays() { | |||
| 687 | } | 688 | } |
| 688 | } | 689 | } |
| 689 | 690 | ||
| 690 | void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) { | 691 | void Maxwell3D::ProcessCBBind(std::size_t stage_index) { |
| 691 | // Bind the buffer currently in CB_ADDRESS to the specified index in the desired shader stage. | 692 | // Bind the buffer currently in CB_ADDRESS to the specified index in the desired shader stage. |
| 692 | auto& shader = state.shader_stages[static_cast<std::size_t>(stage)]; | 693 | auto& shader = state.shader_stages[stage_index]; |
| 693 | auto& bind_data = regs.cb_bind[static_cast<std::size_t>(stage)]; | 694 | auto& bind_data = regs.cb_bind[stage_index]; |
| 694 | 695 | ||
| 695 | ASSERT(bind_data.index < Regs::MaxConstBuffers); | 696 | ASSERT(bind_data.index < Regs::MaxConstBuffers); |
| 696 | auto& buffer = shader.const_buffers[bind_data.index]; | 697 | auto& buffer = shader.const_buffers[bind_data.index]; |
| @@ -757,9 +758,9 @@ Texture::FullTextureInfo Maxwell3D::GetTextureInfo(Texture::TextureHandle tex_ha | |||
| 757 | return Texture::FullTextureInfo{GetTICEntry(tex_handle.tic_id), GetTSCEntry(tex_handle.tsc_id)}; | 758 | return Texture::FullTextureInfo{GetTICEntry(tex_handle.tic_id), GetTSCEntry(tex_handle.tsc_id)}; |
| 758 | } | 759 | } |
| 759 | 760 | ||
| 760 | Texture::FullTextureInfo Maxwell3D::GetStageTexture(Regs::ShaderStage stage, | 761 | Texture::FullTextureInfo Maxwell3D::GetStageTexture(ShaderType stage, std::size_t offset) const { |
| 761 | std::size_t offset) const { | 762 | const auto stage_index = static_cast<std::size_t>(stage); |
| 762 | const auto& shader = state.shader_stages[static_cast<std::size_t>(stage)]; | 763 | const auto& shader = state.shader_stages[stage_index]; |
| 763 | const auto& tex_info_buffer = shader.const_buffers[regs.tex_cb_index]; | 764 | const auto& tex_info_buffer = shader.const_buffers[regs.tex_cb_index]; |
| 764 | ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); | 765 | ASSERT(tex_info_buffer.enabled && tex_info_buffer.address != 0); |
| 765 | 766 | ||
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 1aa7c274f..72994f4d2 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include "video_core/engines/const_buffer_engine_interface.h" | 18 | #include "video_core/engines/const_buffer_engine_interface.h" |
| 19 | #include "video_core/engines/const_buffer_info.h" | 19 | #include "video_core/engines/const_buffer_info.h" |
| 20 | #include "video_core/engines/engine_upload.h" | 20 | #include "video_core/engines/engine_upload.h" |
| 21 | #include "video_core/engines/shader_type.h" | ||
| 21 | #include "video_core/gpu.h" | 22 | #include "video_core/gpu.h" |
| 22 | #include "video_core/macro_interpreter.h" | 23 | #include "video_core/macro_interpreter.h" |
| 23 | #include "video_core/textures/texture.h" | 24 | #include "video_core/textures/texture.h" |
| @@ -130,14 +131,6 @@ public: | |||
| 130 | Fragment = 5, | 131 | Fragment = 5, |
| 131 | }; | 132 | }; |
| 132 | 133 | ||
| 133 | enum class ShaderStage : u32 { | ||
| 134 | Vertex = 0, | ||
| 135 | TesselationControl = 1, | ||
| 136 | TesselationEval = 2, | ||
| 137 | Geometry = 3, | ||
| 138 | Fragment = 4, | ||
| 139 | }; | ||
| 140 | |||
| 141 | struct VertexAttribute { | 134 | struct VertexAttribute { |
| 142 | enum class Size : u32 { | 135 | enum class Size : u32 { |
| 143 | Invalid = 0x0, | 136 | Invalid = 0x0, |
| @@ -1254,7 +1247,7 @@ public: | |||
| 1254 | Texture::FullTextureInfo GetTextureInfo(Texture::TextureHandle tex_handle) const; | 1247 | Texture::FullTextureInfo GetTextureInfo(Texture::TextureHandle tex_handle) const; |
| 1255 | 1248 | ||
| 1256 | /// Returns the texture information for a specific texture in a specific shader stage. | 1249 | /// Returns the texture information for a specific texture in a specific shader stage. |
| 1257 | Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, std::size_t offset) const; | 1250 | Texture::FullTextureInfo GetStageTexture(ShaderType stage, std::size_t offset) const; |
| 1258 | 1251 | ||
| 1259 | u32 AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const override; | 1252 | u32 AccessConstBuffer32(ShaderType stage, u64 const_buffer, u64 offset) const override; |
| 1260 | 1253 | ||
| @@ -1376,7 +1369,7 @@ private: | |||
| 1376 | void FinishCBData(); | 1369 | void FinishCBData(); |
| 1377 | 1370 | ||
| 1378 | /// Handles a write to the CB_BIND register. | 1371 | /// Handles a write to the CB_BIND register. |
| 1379 | void ProcessCBBind(Regs::ShaderStage stage); | 1372 | void ProcessCBBind(std::size_t stage_index); |
| 1380 | 1373 | ||
| 1381 | /// Handles a write to the VERTEX_END_GL register, triggering a draw. | 1374 | /// Handles a write to the VERTEX_END_GL register, triggering a draw. |
| 1382 | void DrawArrays(); | 1375 | void DrawArrays(); |
diff --git a/src/video_core/engines/shader_type.h b/src/video_core/engines/shader_type.h new file mode 100644 index 000000000..239196ba9 --- /dev/null +++ b/src/video_core/engines/shader_type.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | // Copyright 2019 yuzu Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace Tegra::Engines { | ||
| 10 | |||
| 11 | enum class ShaderType : u32 { | ||
| 12 | Vertex = 0, | ||
| 13 | TesselationControl = 1, | ||
| 14 | TesselationEval = 2, | ||
| 15 | Geometry = 3, | ||
| 16 | Fragment = 4, | ||
| 17 | Compute = 5, | ||
| 18 | }; | ||
| 19 | |||
| 20 | } // namespace Tegra::Engines | ||