summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-07-13 04:57:57 +0200
committerbunnei <bunneidev@gmail.com>2018-07-13 04:57:57 +0200
commit8aeff9cf8e84c27ab83cea8df1a94ce8082efc78 (patch)
treee79cdf86838e120908b50fd25ad4f48a98bc29e9 /src
parentgl_shader_gen: Implement dual vertex shader mode. (diff)
downloadyuzu-8aeff9cf8e84c27ab83cea8df1a94ce8082efc78.tar
yuzu-8aeff9cf8e84c27ab83cea8df1a94ce8082efc78.tar.gz
yuzu-8aeff9cf8e84c27ab83cea8df1a94ce8082efc78.tar.bz2
yuzu-8aeff9cf8e84c27ab83cea8df1a94ce8082efc78.tar.lz
yuzu-8aeff9cf8e84c27ab83cea8df1a94ce8082efc78.tar.xz
yuzu-8aeff9cf8e84c27ab83cea8df1a94ce8082efc78.tar.zst
yuzu-8aeff9cf8e84c27ab83cea8df1a94ce8082efc78.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp21
-rw-r--r--src/video_core/engines/maxwell_3d.h11
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp14
3 files changed, 11 insertions, 35 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 3bca16364..dfbf80abd 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -398,27 +398,6 @@ u32 Maxwell3D::GetRegisterValue(u32 method) const {
return regs.reg_array[method];
}
-bool Maxwell3D::IsShaderStageEnabled(Regs::ShaderStage stage) const {
- // The Vertex stage is always enabled.
- if (stage == Regs::ShaderStage::Vertex)
- return true;
-
- switch (stage) {
- case Regs::ShaderStage::TesselationControl:
- return regs.shader_config[static_cast<size_t>(Regs::ShaderProgram::TesselationControl)]
- .enable != 0;
- case Regs::ShaderStage::TesselationEval:
- return regs.shader_config[static_cast<size_t>(Regs::ShaderProgram::TesselationEval)]
- .enable != 0;
- case Regs::ShaderStage::Geometry:
- return regs.shader_config[static_cast<size_t>(Regs::ShaderProgram::Geometry)].enable != 0;
- case Regs::ShaderStage::Fragment:
- return regs.shader_config[static_cast<size_t>(Regs::ShaderProgram::Fragment)].enable != 0;
- }
-
- UNREACHABLE();
-}
-
void Maxwell3D::ProcessClearBuffers() {
ASSERT(regs.clear_buffers.R == regs.clear_buffers.G &&
regs.clear_buffers.R == regs.clear_buffers.B &&
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index 5a7cf0107..6f0170ff7 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -379,6 +379,14 @@ public:
}
};
+ bool IsShaderConfigEnabled(size_t index) const {
+ // The VertexB is always enabled.
+ if (index == static_cast<size_t>(Regs::ShaderProgram::VertexB)) {
+ return true;
+ }
+ return shader_config[index].enable != 0;
+ }
+
union {
struct {
INSERT_PADDING_WORDS(0x45);
@@ -780,9 +788,6 @@ public:
/// Returns the texture information for a specific texture in a specific shader stage.
Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, size_t offset) const;
- /// Returns whether the specified shader stage is enabled or not.
- bool IsShaderStageEnabled(Regs::ShaderStage stage) const;
-
private:
std::unordered_map<u32, std::vector<u32>> uploaded_macros;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index 02ffd9bde..4072a12b4 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -216,15 +216,13 @@ void RasterizerOpenGL::SetupShaders(u8* buffer_ptr, GLintptr buffer_offset) {
auto& shader_config = gpu.regs.shader_config[index];
const Maxwell::ShaderProgram program{static_cast<Maxwell::ShaderProgram>(index)};
- const size_t stage{index == 0 ? 0 : index - 1}; // Stage indices are 0 - 5
-
- const bool is_enabled = gpu.IsShaderStageEnabled(static_cast<Maxwell::ShaderStage>(stage));
-
// Skip stages that are not enabled
- if (!is_enabled) {
+ if (!gpu.regs.IsShaderConfigEnabled(index)) {
continue;
}
+ const size_t stage{index == 0 ? 0 : index - 1}; // Stage indices are 0 - 5
+
GLShader::MaxwellUniformData ubo{};
ubo.SetFromRegs(gpu.state.shader_stages[stage]);
std::memcpy(buffer_ptr, &ubo, sizeof(ubo));
@@ -628,9 +626,6 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr
auto& gpu = Core::System::GetInstance().GPU();
auto& maxwell3d = gpu.Get3DEngine();
- ASSERT_MSG(maxwell3d.IsShaderStageEnabled(stage),
- "Attempted to upload constbuffer of disabled shader stage");
-
// Reset all buffer draw state for this stage.
for (auto& buffer : state.draw.const_buffers[static_cast<size_t>(stage)]) {
buffer.bindpoint = 0;
@@ -697,9 +692,6 @@ u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program,
auto& gpu = Core::System::GetInstance().GPU();
auto& maxwell3d = gpu.Get3DEngine();
- ASSERT_MSG(maxwell3d.IsShaderStageEnabled(stage),
- "Attempted to upload textures of disabled shader stage");
-
ASSERT_MSG(current_unit + entries.size() <= std::size(state.texture_units),
"Exceeded the number of active textures.");