summaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r--src/video_core/renderer_opengl/gl_graphics_pipeline.cpp29
-rw-r--r--src/video_core/renderer_opengl/gl_graphics_pipeline.h4
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp140
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp43
-rw-r--r--src/video_core/renderer_opengl/gl_state_tracker.cpp57
-rw-r--r--src/video_core/renderer_opengl/maxwell_to_gl.h287
6 files changed, 296 insertions, 264 deletions
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
index 41493a7da..1d20a79ec 100644
--- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
+++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
@@ -73,8 +73,8 @@ GLenum AssemblyStage(size_t stage_index) {
73/// @param location Hardware location 73/// @param location Hardware location
74/// @return Pair of ARB_transform_feedback3 token stream first and third arguments 74/// @return Pair of ARB_transform_feedback3 token stream first and third arguments
75/// @note Read https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_transform_feedback3.txt 75/// @note Read https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_transform_feedback3.txt
76std::pair<GLint, GLint> TransformFeedbackEnum(u8 location) { 76std::pair<GLint, GLint> TransformFeedbackEnum(u32 location) {
77 const u8 index = location / 4; 77 const auto index = location / 4;
78 if (index >= 8 && index <= 39) { 78 if (index >= 8 && index <= 39) {
79 return {GL_GENERIC_ATTRIB_NV, index - 8}; 79 return {GL_GENERIC_ATTRIB_NV, index - 8};
80 } 80 }
@@ -286,7 +286,7 @@ void GraphicsPipeline::ConfigureImpl(bool is_indexed) {
286 buffer_cache.runtime.SetEnableStorageBuffers(use_storage_buffers); 286 buffer_cache.runtime.SetEnableStorageBuffers(use_storage_buffers);
287 287
288 const auto& regs{maxwell3d->regs}; 288 const auto& regs{maxwell3d->regs};
289 const bool via_header_index{regs.sampler_index == Maxwell::SamplerIndex::ViaHeaderIndex}; 289 const bool via_header_index{regs.sampler_binding == Maxwell::SamplerBinding::ViaHeaderBinding};
290 const auto config_stage{[&](size_t stage) LAMBDA_FORCEINLINE { 290 const auto config_stage{[&](size_t stage) LAMBDA_FORCEINLINE {
291 const Shader::Info& info{stage_infos[stage]}; 291 const Shader::Info& info{stage_infos[stage]};
292 buffer_cache.UnbindGraphicsStorageBuffers(stage); 292 buffer_cache.UnbindGraphicsStorageBuffers(stage);
@@ -557,10 +557,25 @@ void GraphicsPipeline::GenerateTransformFeedbackState() {
557 ++current_stream; 557 ++current_stream;
558 558
559 const auto& locations = key.xfb_state.varyings[feedback]; 559 const auto& locations = key.xfb_state.varyings[feedback];
560 std::optional<u8> current_index; 560 std::optional<u32> current_index;
561 for (u32 offset = 0; offset < layout.varying_count; ++offset) { 561 for (u32 offset = 0; offset < layout.varying_count; ++offset) {
562 const u8 location = locations[offset]; 562 const auto get_attribute = [&locations](u32 index) -> u32 {
563 const u8 index = location / 4; 563 switch (index % 4) {
564 case 0:
565 return locations[index / 4].attribute0.Value();
566 case 1:
567 return locations[index / 4].attribute1.Value();
568 case 2:
569 return locations[index / 4].attribute2.Value();
570 case 3:
571 return locations[index / 4].attribute3.Value();
572 }
573 UNREACHABLE();
574 return 0;
575 };
576
577 const auto attribute{get_attribute(offset)};
578 const auto index = attribute / 4U;
564 579
565 if (current_index == index) { 580 if (current_index == index) {
566 // Increase number of components of the previous attachment 581 // Increase number of components of the previous attachment
@@ -569,7 +584,7 @@ void GraphicsPipeline::GenerateTransformFeedbackState() {
569 } 584 }
570 current_index = index; 585 current_index = index;
571 586
572 std::tie(cursor[0], cursor[2]) = TransformFeedbackEnum(location); 587 std::tie(cursor[0], cursor[2]) = TransformFeedbackEnum(attribute);
573 cursor[1] = 1; 588 cursor[1] = 1;
574 cursor += XFB_ENTRY_STRIDE; 589 cursor += XFB_ENTRY_STRIDE;
575 } 590 }
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.h b/src/video_core/renderer_opengl/gl_graphics_pipeline.h
index a0f0e63cb..ea53ddb46 100644
--- a/src/video_core/renderer_opengl/gl_graphics_pipeline.h
+++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.h
@@ -37,8 +37,8 @@ struct GraphicsPipelineKey {
37 BitField<0, 1, u32> xfb_enabled; 37 BitField<0, 1, u32> xfb_enabled;
38 BitField<1, 1, u32> early_z; 38 BitField<1, 1, u32> early_z;
39 BitField<2, 4, Maxwell::PrimitiveTopology> gs_input_topology; 39 BitField<2, 4, Maxwell::PrimitiveTopology> gs_input_topology;
40 BitField<6, 2, Maxwell::TessellationPrimitive> tessellation_primitive; 40 BitField<6, 2, Maxwell::Tessellation::DomainType> tessellation_primitive;
41 BitField<8, 2, Maxwell::TessellationSpacing> tessellation_spacing; 41 BitField<8, 2, Maxwell::Tessellation::Spacing> tessellation_spacing;
42 BitField<10, 1, u32> tessellation_clockwise; 42 BitField<10, 1, u32> tessellation_clockwise;
43 }; 43 };
44 std::array<u32, 3> padding; 44 std::array<u32, 3> padding;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index c2d80605d..cce00cea8 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -87,7 +87,7 @@ void RasterizerOpenGL::SyncVertexFormats() {
87 } 87 }
88 flags[Dirty::VertexFormat0 + index] = false; 88 flags[Dirty::VertexFormat0 + index] = false;
89 89
90 const auto attrib = maxwell3d->regs.vertex_attrib_format[index]; 90 const auto& attrib = maxwell3d->regs.vertex_attrib_format[index];
91 const auto gl_index = static_cast<GLuint>(index); 91 const auto gl_index = static_cast<GLuint>(index);
92 92
93 // Disable constant attributes. 93 // Disable constant attributes.
@@ -97,8 +97,8 @@ void RasterizerOpenGL::SyncVertexFormats() {
97 } 97 }
98 glEnableVertexAttribArray(gl_index); 98 glEnableVertexAttribArray(gl_index);
99 99
100 if (attrib.type == Maxwell::VertexAttribute::Type::SignedInt || 100 if (attrib.type == Maxwell::VertexAttribute::Type::SInt ||
101 attrib.type == Maxwell::VertexAttribute::Type::UnsignedInt) { 101 attrib.type == Maxwell::VertexAttribute::Type::UInt) {
102 glVertexAttribIFormat(gl_index, attrib.ComponentCount(), 102 glVertexAttribIFormat(gl_index, attrib.ComponentCount(),
103 MaxwellToGL::VertexFormat(attrib), attrib.offset); 103 MaxwellToGL::VertexFormat(attrib), attrib.offset);
104 } else { 104 } else {
@@ -125,8 +125,8 @@ void RasterizerOpenGL::SyncVertexInstances() {
125 flags[Dirty::VertexInstance0 + index] = false; 125 flags[Dirty::VertexInstance0 + index] = false;
126 126
127 const auto gl_index = static_cast<GLuint>(index); 127 const auto gl_index = static_cast<GLuint>(index);
128 const bool instancing_enabled = regs.instanced_arrays.IsInstancingEnabled(gl_index); 128 const bool instancing_enabled = regs.vertex_stream_instances.IsInstancingEnabled(gl_index);
129 const GLuint divisor = instancing_enabled ? regs.vertex_array[index].divisor : 0; 129 const GLuint divisor = instancing_enabled ? regs.vertex_streams[index].frequency : 0;
130 glVertexBindingDivisor(gl_index, divisor); 130 glVertexBindingDivisor(gl_index, divisor);
131 } 131 }
132} 132}
@@ -147,27 +147,27 @@ void RasterizerOpenGL::Clear() {
147 bool use_depth{}; 147 bool use_depth{};
148 bool use_stencil{}; 148 bool use_stencil{};
149 149
150 if (regs.clear_buffers.R || regs.clear_buffers.G || regs.clear_buffers.B || 150 if (regs.clear_surface.R || regs.clear_surface.G || regs.clear_surface.B ||
151 regs.clear_buffers.A) { 151 regs.clear_surface.A) {
152 use_color = true; 152 use_color = true;
153 153
154 const GLuint index = regs.clear_buffers.RT; 154 const GLuint index = regs.clear_surface.RT;
155 state_tracker.NotifyColorMask(index); 155 state_tracker.NotifyColorMask(index);
156 glColorMaski(index, regs.clear_buffers.R != 0, regs.clear_buffers.G != 0, 156 glColorMaski(index, regs.clear_surface.R != 0, regs.clear_surface.G != 0,
157 regs.clear_buffers.B != 0, regs.clear_buffers.A != 0); 157 regs.clear_surface.B != 0, regs.clear_surface.A != 0);
158 158
159 // TODO(Rodrigo): Determine if clamping is used on clears 159 // TODO(Rodrigo): Determine if clamping is used on clears
160 SyncFragmentColorClampState(); 160 SyncFragmentColorClampState();
161 SyncFramebufferSRGB(); 161 SyncFramebufferSRGB();
162 } 162 }
163 if (regs.clear_buffers.Z) { 163 if (regs.clear_surface.Z) {
164 ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!"); 164 ASSERT_MSG(regs.zeta_enable != 0, "Tried to clear Z but buffer is not enabled!");
165 use_depth = true; 165 use_depth = true;
166 166
167 state_tracker.NotifyDepthMask(); 167 state_tracker.NotifyDepthMask();
168 glDepthMask(GL_TRUE); 168 glDepthMask(GL_TRUE);
169 } 169 }
170 if (regs.clear_buffers.S) { 170 if (regs.clear_surface.S) {
171 ASSERT_MSG(regs.zeta_enable, "Tried to clear stencil but buffer is not enabled!"); 171 ASSERT_MSG(regs.zeta_enable, "Tried to clear stencil but buffer is not enabled!");
172 use_stencil = true; 172 use_stencil = true;
173 } 173 }
@@ -184,16 +184,16 @@ void RasterizerOpenGL::Clear() {
184 texture_cache.UpdateRenderTargets(true); 184 texture_cache.UpdateRenderTargets(true);
185 state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle()); 185 state_tracker.BindFramebuffer(texture_cache.GetFramebuffer()->Handle());
186 SyncViewport(); 186 SyncViewport();
187 if (regs.clear_flags.scissor) { 187 if (regs.clear_control.use_scissor) {
188 SyncScissorTest(); 188 SyncScissorTest();
189 } else { 189 } else {
190 state_tracker.NotifyScissor0(); 190 state_tracker.NotifyScissor0();
191 glDisablei(GL_SCISSOR_TEST, 0); 191 glDisablei(GL_SCISSOR_TEST, 0);
192 } 192 }
193 UNIMPLEMENTED_IF(regs.clear_flags.viewport); 193 UNIMPLEMENTED_IF(regs.clear_control.use_viewport_clip0);
194 194
195 if (use_color) { 195 if (use_color) {
196 glClearBufferfv(GL_COLOR, regs.clear_buffers.RT, regs.clear_color); 196 glClearBufferfv(GL_COLOR, regs.clear_surface.RT, regs.clear_color.data());
197 } 197 }
198 if (use_depth && use_stencil) { 198 if (use_depth && use_stencil) {
199 glClearBufferfi(GL_DEPTH_STENCIL, 0, regs.clear_depth, regs.clear_stencil); 199 glClearBufferfi(GL_DEPTH_STENCIL, 0, regs.clear_depth, regs.clear_stencil);
@@ -227,14 +227,14 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
227 const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(maxwell3d->regs.draw.topology); 227 const GLenum primitive_mode = MaxwellToGL::PrimitiveTopology(maxwell3d->regs.draw.topology);
228 BeginTransformFeedback(pipeline, primitive_mode); 228 BeginTransformFeedback(pipeline, primitive_mode);
229 229
230 const GLuint base_instance = static_cast<GLuint>(maxwell3d->regs.vb_base_instance); 230 const GLuint base_instance = static_cast<GLuint>(maxwell3d->regs.global_base_instance_index);
231 const GLsizei num_instances = 231 const GLsizei num_instances =
232 static_cast<GLsizei>(is_instanced ? maxwell3d->mme_draw.instance_count : 1); 232 static_cast<GLsizei>(is_instanced ? maxwell3d->mme_draw.instance_count : 1);
233 if (is_indexed) { 233 if (is_indexed) {
234 const GLint base_vertex = static_cast<GLint>(maxwell3d->regs.vb_element_base); 234 const GLint base_vertex = static_cast<GLint>(maxwell3d->regs.global_base_vertex_index);
235 const GLsizei num_vertices = static_cast<GLsizei>(maxwell3d->regs.index_array.count); 235 const GLsizei num_vertices = static_cast<GLsizei>(maxwell3d->regs.index_buffer.count);
236 const GLvoid* const offset = buffer_cache_runtime.IndexOffset(); 236 const GLvoid* const offset = buffer_cache_runtime.IndexOffset();
237 const GLenum format = MaxwellToGL::IndexFormat(maxwell3d->regs.index_array.format); 237 const GLenum format = MaxwellToGL::IndexFormat(maxwell3d->regs.index_buffer.format);
238 if (num_instances == 1 && base_instance == 0 && base_vertex == 0) { 238 if (num_instances == 1 && base_instance == 0 && base_vertex == 0) {
239 glDrawElements(primitive_mode, num_vertices, format, offset); 239 glDrawElements(primitive_mode, num_vertices, format, offset);
240 } else if (num_instances == 1 && base_instance == 0) { 240 } else if (num_instances == 1 && base_instance == 0) {
@@ -555,9 +555,9 @@ void RasterizerOpenGL::SyncViewport() {
555 if (dirty_viewport || dirty_clip_control || flags[Dirty::FrontFace]) { 555 if (dirty_viewport || dirty_clip_control || flags[Dirty::FrontFace]) {
556 flags[Dirty::FrontFace] = false; 556 flags[Dirty::FrontFace] = false;
557 557
558 GLenum mode = MaxwellToGL::FrontFace(regs.front_face); 558 GLenum mode = MaxwellToGL::FrontFace(regs.gl_front_face);
559 bool flip_faces = true; 559 bool flip_faces = true;
560 if (regs.screen_y_control.triangle_rast_flip != 0) { 560 if (regs.window_origin.flip_y != 0) {
561 flip_faces = !flip_faces; 561 flip_faces = !flip_faces;
562 } 562 }
563 if (regs.viewport_transform[0].scale_y < 0.0f) { 563 if (regs.viewport_transform[0].scale_y < 0.0f) {
@@ -582,14 +582,15 @@ void RasterizerOpenGL::SyncViewport() {
582 if (regs.viewport_transform[0].scale_y < 0.0f) { 582 if (regs.viewport_transform[0].scale_y < 0.0f) {
583 flip_y = !flip_y; 583 flip_y = !flip_y;
584 } 584 }
585 if (regs.screen_y_control.y_negate != 0) { 585 const bool lower_left{regs.window_origin.mode != Maxwell::WindowOrigin::Mode::UpperLeft};
586 if (lower_left) {
586 flip_y = !flip_y; 587 flip_y = !flip_y;
587 } 588 }
588 const bool is_zero_to_one = regs.depth_mode == Maxwell::DepthMode::ZeroToOne; 589 const bool is_zero_to_one = regs.depth_mode == Maxwell::DepthMode::ZeroToOne;
589 const GLenum origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT; 590 const GLenum origin = flip_y ? GL_UPPER_LEFT : GL_LOWER_LEFT;
590 const GLenum depth = is_zero_to_one ? GL_ZERO_TO_ONE : GL_NEGATIVE_ONE_TO_ONE; 591 const GLenum depth = is_zero_to_one ? GL_ZERO_TO_ONE : GL_NEGATIVE_ONE_TO_ONE;
591 state_tracker.ClipControl(origin, depth); 592 state_tracker.ClipControl(origin, depth);
592 state_tracker.SetYNegate(regs.screen_y_control.y_negate != 0); 593 state_tracker.SetYNegate(lower_left);
593 } 594 }
594 const bool is_rescaling{texture_cache.IsRescaling()}; 595 const bool is_rescaling{texture_cache.IsRescaling()};
595 const float scale = is_rescaling ? Settings::values.resolution_info.up_factor : 1.0f; 596 const float scale = is_rescaling ? Settings::values.resolution_info.up_factor : 1.0f;
@@ -657,7 +658,8 @@ void RasterizerOpenGL::SyncDepthClamp() {
657 } 658 }
658 flags[Dirty::DepthClampEnabled] = false; 659 flags[Dirty::DepthClampEnabled] = false;
659 660
660 oglEnable(GL_DEPTH_CLAMP, maxwell3d->regs.view_volume_clip_control.depth_clamp_disabled == 0); 661 oglEnable(GL_DEPTH_CLAMP, maxwell3d->regs.viewport_clip_control.geometry_clip !=
662 Maxwell::ViewportClipControl::GeometryClip::Passthrough);
661} 663}
662 664
663void RasterizerOpenGL::SyncClipEnabled(u32 clip_mask) { 665void RasterizerOpenGL::SyncClipEnabled(u32 clip_mask) {
@@ -667,7 +669,7 @@ void RasterizerOpenGL::SyncClipEnabled(u32 clip_mask) {
667 } 669 }
668 flags[Dirty::ClipDistances] = false; 670 flags[Dirty::ClipDistances] = false;
669 671
670 clip_mask &= maxwell3d->regs.clip_distance_enabled; 672 clip_mask &= maxwell3d->regs.user_clip_enable.raw;
671 if (clip_mask == last_clip_distance_mask) { 673 if (clip_mask == last_clip_distance_mask) {
672 return; 674 return;
673 } 675 }
@@ -689,9 +691,9 @@ void RasterizerOpenGL::SyncCullMode() {
689 if (flags[Dirty::CullTest]) { 691 if (flags[Dirty::CullTest]) {
690 flags[Dirty::CullTest] = false; 692 flags[Dirty::CullTest] = false;
691 693
692 if (regs.cull_test_enabled) { 694 if (regs.gl_cull_test_enabled) {
693 glEnable(GL_CULL_FACE); 695 glEnable(GL_CULL_FACE);
694 glCullFace(MaxwellToGL::CullFace(regs.cull_face)); 696 glCullFace(MaxwellToGL::CullFace(regs.gl_cull_face));
695 } else { 697 } else {
696 glDisable(GL_CULL_FACE); 698 glDisable(GL_CULL_FACE);
697 } 699 }
@@ -743,20 +745,20 @@ void RasterizerOpenGL::SyncStencilTestState() {
743 const auto& regs = maxwell3d->regs; 745 const auto& regs = maxwell3d->regs;
744 oglEnable(GL_STENCIL_TEST, regs.stencil_enable); 746 oglEnable(GL_STENCIL_TEST, regs.stencil_enable);
745 747
746 glStencilFuncSeparate(GL_FRONT, MaxwellToGL::ComparisonOp(regs.stencil_front_func_func), 748 glStencilFuncSeparate(GL_FRONT, MaxwellToGL::ComparisonOp(regs.stencil_front_op.func),
747 regs.stencil_front_func_ref, regs.stencil_front_func_mask); 749 regs.stencil_front_func.ref, regs.stencil_front_func.func_mask);
748 glStencilOpSeparate(GL_FRONT, MaxwellToGL::StencilOp(regs.stencil_front_op_fail), 750 glStencilOpSeparate(GL_FRONT, MaxwellToGL::StencilOp(regs.stencil_front_op.fail),
749 MaxwellToGL::StencilOp(regs.stencil_front_op_zfail), 751 MaxwellToGL::StencilOp(regs.stencil_front_op.zfail),
750 MaxwellToGL::StencilOp(regs.stencil_front_op_zpass)); 752 MaxwellToGL::StencilOp(regs.stencil_front_op.zpass));
751 glStencilMaskSeparate(GL_FRONT, regs.stencil_front_mask); 753 glStencilMaskSeparate(GL_FRONT, regs.stencil_front_func.mask);
752 754
753 if (regs.stencil_two_side_enable) { 755 if (regs.stencil_two_side_enable) {
754 glStencilFuncSeparate(GL_BACK, MaxwellToGL::ComparisonOp(regs.stencil_back_func_func), 756 glStencilFuncSeparate(GL_BACK, MaxwellToGL::ComparisonOp(regs.stencil_back_op.func),
755 regs.stencil_back_func_ref, regs.stencil_back_func_mask); 757 regs.stencil_back_func.ref, regs.stencil_back_func.mask);
756 glStencilOpSeparate(GL_BACK, MaxwellToGL::StencilOp(regs.stencil_back_op_fail), 758 glStencilOpSeparate(GL_BACK, MaxwellToGL::StencilOp(regs.stencil_back_op.fail),
757 MaxwellToGL::StencilOp(regs.stencil_back_op_zfail), 759 MaxwellToGL::StencilOp(regs.stencil_back_op.zfail),
758 MaxwellToGL::StencilOp(regs.stencil_back_op_zpass)); 760 MaxwellToGL::StencilOp(regs.stencil_back_op.zpass));
759 glStencilMaskSeparate(GL_BACK, regs.stencil_back_mask); 761 glStencilMaskSeparate(GL_BACK, regs.stencil_back_func.mask);
760 } else { 762 } else {
761 glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFF); 763 glStencilFuncSeparate(GL_BACK, GL_ALWAYS, 0, 0xFFFFFFFF);
762 glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP); 764 glStencilOpSeparate(GL_BACK, GL_KEEP, GL_KEEP, GL_KEEP);
@@ -782,7 +784,7 @@ void RasterizerOpenGL::SyncPolygonModes() {
782 flags[Dirty::PolygonModes] = false; 784 flags[Dirty::PolygonModes] = false;
783 785
784 const auto& regs = maxwell3d->regs; 786 const auto& regs = maxwell3d->regs;
785 if (regs.fill_rectangle) { 787 if (regs.fill_via_triangle_mode != Maxwell::FillViaTriangleMode::Disabled) {
786 if (!GLAD_GL_NV_fill_rectangle) { 788 if (!GLAD_GL_NV_fill_rectangle) {
787 LOG_ERROR(Render_OpenGL, "GL_NV_fill_rectangle used and not supported"); 789 LOG_ERROR(Render_OpenGL, "GL_NV_fill_rectangle used and not supported");
788 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); 790 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -855,8 +857,8 @@ void RasterizerOpenGL::SyncMultiSampleState() {
855 flags[Dirty::MultisampleControl] = false; 857 flags[Dirty::MultisampleControl] = false;
856 858
857 const auto& regs = maxwell3d->regs; 859 const auto& regs = maxwell3d->regs;
858 oglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE, regs.multisample_control.alpha_to_coverage); 860 oglEnable(GL_SAMPLE_ALPHA_TO_COVERAGE, regs.anti_alias_alpha_control.alpha_to_coverage);
859 oglEnable(GL_SAMPLE_ALPHA_TO_ONE, regs.multisample_control.alpha_to_one); 861 oglEnable(GL_SAMPLE_ALPHA_TO_ONE, regs.anti_alias_alpha_control.alpha_to_one);
860} 862}
861 863
862void RasterizerOpenGL::SyncFragmentColorClampState() { 864void RasterizerOpenGL::SyncFragmentColorClampState() {
@@ -866,7 +868,8 @@ void RasterizerOpenGL::SyncFragmentColorClampState() {
866 } 868 }
867 flags[Dirty::FragmentClampColor] = false; 869 flags[Dirty::FragmentClampColor] = false;
868 870
869 glClampColor(GL_CLAMP_FRAGMENT_COLOR, maxwell3d->regs.frag_color_clamp ? GL_TRUE : GL_FALSE); 871 glClampColor(GL_CLAMP_FRAGMENT_COLOR,
872 maxwell3d->regs.frag_color_clamp.AnyEnabled() ? GL_TRUE : GL_FALSE);
870} 873}
871 874
872void RasterizerOpenGL::SyncBlendState() { 875void RasterizerOpenGL::SyncBlendState() {
@@ -886,18 +889,18 @@ void RasterizerOpenGL::SyncBlendState() {
886 } 889 }
887 flags[Dirty::BlendStates] = false; 890 flags[Dirty::BlendStates] = false;
888 891
889 if (!regs.independent_blend_enable) { 892 if (!regs.blend_per_target_enabled) {
890 if (!regs.blend.enable[0]) { 893 if (!regs.blend.enable[0]) {
891 glDisable(GL_BLEND); 894 glDisable(GL_BLEND);
892 return; 895 return;
893 } 896 }
894 glEnable(GL_BLEND); 897 glEnable(GL_BLEND);
895 glBlendFuncSeparate(MaxwellToGL::BlendFunc(regs.blend.factor_source_rgb), 898 glBlendFuncSeparate(MaxwellToGL::BlendFunc(regs.blend.color_source),
896 MaxwellToGL::BlendFunc(regs.blend.factor_dest_rgb), 899 MaxwellToGL::BlendFunc(regs.blend.color_dest),
897 MaxwellToGL::BlendFunc(regs.blend.factor_source_a), 900 MaxwellToGL::BlendFunc(regs.blend.alpha_source),
898 MaxwellToGL::BlendFunc(regs.blend.factor_dest_a)); 901 MaxwellToGL::BlendFunc(regs.blend.alpha_dest));
899 glBlendEquationSeparate(MaxwellToGL::BlendEquation(regs.blend.equation_rgb), 902 glBlendEquationSeparate(MaxwellToGL::BlendEquation(regs.blend.color_op),
900 MaxwellToGL::BlendEquation(regs.blend.equation_a)); 903 MaxwellToGL::BlendEquation(regs.blend.alpha_op));
901 return; 904 return;
902 } 905 }
903 906
@@ -916,14 +919,13 @@ void RasterizerOpenGL::SyncBlendState() {
916 } 919 }
917 glEnablei(GL_BLEND, static_cast<GLuint>(i)); 920 glEnablei(GL_BLEND, static_cast<GLuint>(i));
918 921
919 const auto& src = regs.independent_blend[i]; 922 const auto& src = regs.blend_per_target[i];
920 glBlendFuncSeparatei(static_cast<GLuint>(i), MaxwellToGL::BlendFunc(src.factor_source_rgb), 923 glBlendFuncSeparatei(static_cast<GLuint>(i), MaxwellToGL::BlendFunc(src.color_source),
921 MaxwellToGL::BlendFunc(src.factor_dest_rgb), 924 MaxwellToGL::BlendFunc(src.color_dest),
922 MaxwellToGL::BlendFunc(src.factor_source_a), 925 MaxwellToGL::BlendFunc(src.alpha_source),
923 MaxwellToGL::BlendFunc(src.factor_dest_a)); 926 MaxwellToGL::BlendFunc(src.alpha_dest));
924 glBlendEquationSeparatei(static_cast<GLuint>(i), 927 glBlendEquationSeparatei(static_cast<GLuint>(i), MaxwellToGL::BlendEquation(src.color_op),
925 MaxwellToGL::BlendEquation(src.equation_rgb), 928 MaxwellToGL::BlendEquation(src.alpha_op));
926 MaxwellToGL::BlendEquation(src.equation_a));
927 } 929 }
928} 930}
929 931
@@ -937,7 +939,7 @@ void RasterizerOpenGL::SyncLogicOpState() {
937 const auto& regs = maxwell3d->regs; 939 const auto& regs = maxwell3d->regs;
938 if (regs.logic_op.enable) { 940 if (regs.logic_op.enable) {
939 glEnable(GL_COLOR_LOGIC_OP); 941 glEnable(GL_COLOR_LOGIC_OP);
940 glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.operation)); 942 glLogicOp(MaxwellToGL::LogicOp(regs.logic_op.op));
941 } else { 943 } else {
942 glDisable(GL_COLOR_LOGIC_OP); 944 glDisable(GL_COLOR_LOGIC_OP);
943 } 945 }
@@ -996,7 +998,7 @@ void RasterizerOpenGL::SyncPointState() {
996 flags[Dirty::PointSize] = false; 998 flags[Dirty::PointSize] = false;
997 999
998 oglEnable(GL_POINT_SPRITE, maxwell3d->regs.point_sprite_enable); 1000 oglEnable(GL_POINT_SPRITE, maxwell3d->regs.point_sprite_enable);
999 oglEnable(GL_PROGRAM_POINT_SIZE, maxwell3d->regs.vp_point_size.enable); 1001 oglEnable(GL_PROGRAM_POINT_SIZE, maxwell3d->regs.point_size_attribute.enabled);
1000 const bool is_rescaling{texture_cache.IsRescaling()}; 1002 const bool is_rescaling{texture_cache.IsRescaling()};
1001 const float scale = is_rescaling ? Settings::values.resolution_info.up_factor : 1.0f; 1003 const float scale = is_rescaling ? Settings::values.resolution_info.up_factor : 1.0f;
1002 glPointSize(std::max(1.0f, maxwell3d->regs.point_size * scale)); 1004 glPointSize(std::max(1.0f, maxwell3d->regs.point_size * scale));
@@ -1010,8 +1012,8 @@ void RasterizerOpenGL::SyncLineState() {
1010 flags[Dirty::LineWidth] = false; 1012 flags[Dirty::LineWidth] = false;
1011 1013
1012 const auto& regs = maxwell3d->regs; 1014 const auto& regs = maxwell3d->regs;
1013 oglEnable(GL_LINE_SMOOTH, regs.line_smooth_enable); 1015 oglEnable(GL_LINE_SMOOTH, regs.line_anti_alias_enable);
1014 glLineWidth(regs.line_smooth_enable ? regs.line_width_smooth : regs.line_width_aliased); 1016 glLineWidth(regs.line_anti_alias_enable ? regs.line_width_smooth : regs.line_width_aliased);
1015} 1017}
1016 1018
1017void RasterizerOpenGL::SyncPolygonOffset() { 1019void RasterizerOpenGL::SyncPolygonOffset() {
@@ -1029,8 +1031,8 @@ void RasterizerOpenGL::SyncPolygonOffset() {
1029 if (regs.polygon_offset_fill_enable || regs.polygon_offset_line_enable || 1031 if (regs.polygon_offset_fill_enable || regs.polygon_offset_line_enable ||
1030 regs.polygon_offset_point_enable) { 1032 regs.polygon_offset_point_enable) {
1031 // Hardware divides polygon offset units by two 1033 // Hardware divides polygon offset units by two
1032 glPolygonOffsetClamp(regs.polygon_offset_factor, regs.polygon_offset_units / 2.0f, 1034 glPolygonOffsetClamp(regs.slope_scale_depth_bias, regs.depth_bias / 2.0f,
1033 regs.polygon_offset_clamp); 1035 regs.depth_bias_clamp);
1034 } 1036 }
1035} 1037}
1036 1038
@@ -1062,14 +1064,14 @@ void RasterizerOpenGL::SyncFramebufferSRGB() {
1062 1064
1063void RasterizerOpenGL::BeginTransformFeedback(GraphicsPipeline* program, GLenum primitive_mode) { 1065void RasterizerOpenGL::BeginTransformFeedback(GraphicsPipeline* program, GLenum primitive_mode) {
1064 const auto& regs = maxwell3d->regs; 1066 const auto& regs = maxwell3d->regs;
1065 if (regs.tfb_enabled == 0) { 1067 if (regs.transform_feedback_enabled == 0) {
1066 return; 1068 return;
1067 } 1069 }
1068 program->ConfigureTransformFeedback(); 1070 program->ConfigureTransformFeedback();
1069 1071
1070 UNIMPLEMENTED_IF(regs.IsShaderConfigEnabled(Maxwell::ShaderProgram::TesselationControl) || 1072 UNIMPLEMENTED_IF(regs.IsShaderConfigEnabled(Maxwell::ShaderType::TessellationInit) ||
1071 regs.IsShaderConfigEnabled(Maxwell::ShaderProgram::TesselationEval) || 1073 regs.IsShaderConfigEnabled(Maxwell::ShaderType::Tessellation) ||
1072 regs.IsShaderConfigEnabled(Maxwell::ShaderProgram::Geometry)); 1074 regs.IsShaderConfigEnabled(Maxwell::ShaderType::Geometry));
1073 UNIMPLEMENTED_IF(primitive_mode != GL_POINTS); 1075 UNIMPLEMENTED_IF(primitive_mode != GL_POINTS);
1074 1076
1075 // We may have to call BeginTransformFeedbackNV here since they seem to call different 1077 // We may have to call BeginTransformFeedbackNV here since they seem to call different
@@ -1080,7 +1082,7 @@ void RasterizerOpenGL::BeginTransformFeedback(GraphicsPipeline* program, GLenum
1080} 1082}
1081 1083
1082void RasterizerOpenGL::EndTransformFeedback() { 1084void RasterizerOpenGL::EndTransformFeedback() {
1083 if (maxwell3d->regs.tfb_enabled != 0) { 1085 if (maxwell3d->regs.transform_feedback_enabled != 0) {
1084 glEndTransformFeedback(); 1086 glEndTransformFeedback();
1085 } 1087 }
1086} 1088}
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 5a29a41d2..6bdb0b645 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -78,11 +78,11 @@ Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key,
78 info.tess_clockwise = key.tessellation_clockwise != 0; 78 info.tess_clockwise = key.tessellation_clockwise != 0;
79 info.tess_primitive = [&key] { 79 info.tess_primitive = [&key] {
80 switch (key.tessellation_primitive) { 80 switch (key.tessellation_primitive) {
81 case Maxwell::TessellationPrimitive::Isolines: 81 case Maxwell::Tessellation::DomainType::Isolines:
82 return Shader::TessPrimitive::Isolines; 82 return Shader::TessPrimitive::Isolines;
83 case Maxwell::TessellationPrimitive::Triangles: 83 case Maxwell::Tessellation::DomainType::Triangles:
84 return Shader::TessPrimitive::Triangles; 84 return Shader::TessPrimitive::Triangles;
85 case Maxwell::TessellationPrimitive::Quads: 85 case Maxwell::Tessellation::DomainType::Quads:
86 return Shader::TessPrimitive::Quads; 86 return Shader::TessPrimitive::Quads;
87 } 87 }
88 ASSERT(false); 88 ASSERT(false);
@@ -90,11 +90,11 @@ Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key,
90 }(); 90 }();
91 info.tess_spacing = [&] { 91 info.tess_spacing = [&] {
92 switch (key.tessellation_spacing) { 92 switch (key.tessellation_spacing) {
93 case Maxwell::TessellationSpacing::Equal: 93 case Maxwell::Tessellation::Spacing::Integer:
94 return Shader::TessSpacing::Equal; 94 return Shader::TessSpacing::Equal;
95 case Maxwell::TessellationSpacing::FractionalOdd: 95 case Maxwell::Tessellation::Spacing::FractionalOdd:
96 return Shader::TessSpacing::FractionalOdd; 96 return Shader::TessSpacing::FractionalOdd;
97 case Maxwell::TessellationSpacing::FractionalEven: 97 case Maxwell::Tessellation::Spacing::FractionalEven:
98 return Shader::TessSpacing::FractionalEven; 98 return Shader::TessSpacing::FractionalEven;
99 } 99 }
100 ASSERT(false); 100 ASSERT(false);
@@ -139,14 +139,15 @@ Shader::RuntimeInfo MakeRuntimeInfo(const GraphicsPipelineKey& key,
139} 139}
140 140
141void SetXfbState(VideoCommon::TransformFeedbackState& state, const Maxwell& regs) { 141void SetXfbState(VideoCommon::TransformFeedbackState& state, const Maxwell& regs) {
142 std::ranges::transform(regs.tfb_layouts, state.layouts.begin(), [](const auto& layout) { 142 std::ranges::transform(regs.transform_feedback.controls, state.layouts.begin(),
143 return VideoCommon::TransformFeedbackState::Layout{ 143 [](const auto& layout) {
144 .stream = layout.stream, 144 return VideoCommon::TransformFeedbackState::Layout{
145 .varying_count = layout.varying_count, 145 .stream = layout.stream,
146 .stride = layout.stride, 146 .varying_count = layout.varying_count,
147 }; 147 .stride = layout.stride,
148 }); 148 };
149 state.varyings = regs.tfb_varying_locs; 149 });
150 state.varyings = regs.stream_out_layout;
150} 151}
151} // Anonymous namespace 152} // Anonymous namespace
152 153
@@ -309,14 +310,16 @@ GraphicsPipeline* ShaderCache::CurrentGraphicsPipeline() {
309 } 310 }
310 const auto& regs{maxwell3d->regs}; 311 const auto& regs{maxwell3d->regs};
311 graphics_key.raw = 0; 312 graphics_key.raw = 0;
312 graphics_key.early_z.Assign(regs.force_early_fragment_tests != 0 ? 1 : 0); 313 graphics_key.early_z.Assign(regs.mandated_early_z != 0 ? 1 : 0);
313 graphics_key.gs_input_topology.Assign(graphics_key.unique_hashes[4] != 0 314 graphics_key.gs_input_topology.Assign(graphics_key.unique_hashes[4] != 0
314 ? regs.draw.topology.Value() 315 ? regs.draw.topology.Value()
315 : Maxwell::PrimitiveTopology{}); 316 : Maxwell::PrimitiveTopology{});
316 graphics_key.tessellation_primitive.Assign(regs.tess_mode.prim.Value()); 317 graphics_key.tessellation_primitive.Assign(regs.tessellation.params.domain_type.Value());
317 graphics_key.tessellation_spacing.Assign(regs.tess_mode.spacing.Value()); 318 graphics_key.tessellation_spacing.Assign(regs.tessellation.params.spacing.Value());
318 graphics_key.tessellation_clockwise.Assign(regs.tess_mode.cw.Value()); 319 graphics_key.tessellation_clockwise.Assign(
319 graphics_key.xfb_enabled.Assign(regs.tfb_enabled != 0 ? 1 : 0); 320 regs.tessellation.params.output_primitives.Value() !=
321 Maxwell::Tessellation::OutputPrimitves::Triangles_CCW);
322 graphics_key.xfb_enabled.Assign(regs.transform_feedback_enabled != 0 ? 1 : 0);
320 if (graphics_key.xfb_enabled) { 323 if (graphics_key.xfb_enabled) {
321 SetXfbState(graphics_key.xfb_state, regs); 324 SetXfbState(graphics_key.xfb_state, regs);
322 } 325 }
@@ -354,7 +357,7 @@ GraphicsPipeline* ShaderCache::BuiltPipeline(GraphicsPipeline* pipeline) const n
354 // If games are using a small index count, we can assume these are full screen quads. 357 // If games are using a small index count, we can assume these are full screen quads.
355 // Usually these shaders are only used once for building textures so we can assume they 358 // Usually these shaders are only used once for building textures so we can assume they
356 // can't be built async 359 // can't be built async
357 if (maxwell3d->regs.index_array.count <= 6 || maxwell3d->regs.vertex_buffer.count <= 6) { 360 if (maxwell3d->regs.index_buffer.count <= 6 || maxwell3d->regs.vertex_buffer.count <= 6) {
358 return pipeline; 361 return pipeline;
359 } 362 }
360 return nullptr; 363 return nullptr;
diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp
index a8f3a0f57..e2c709aac 100644
--- a/src/video_core/renderer_opengl/gl_state_tracker.cpp
+++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp
@@ -38,12 +38,12 @@ void SetupDirtyColorMasks(Tables& tables) {
38void SetupDirtyVertexInstances(Tables& tables) { 38void SetupDirtyVertexInstances(Tables& tables) {
39 static constexpr std::size_t instance_base_offset = 3; 39 static constexpr std::size_t instance_base_offset = 3;
40 for (std::size_t i = 0; i < Regs::NumVertexArrays; ++i) { 40 for (std::size_t i = 0; i < Regs::NumVertexArrays; ++i) {
41 const std::size_t array_offset = OFF(vertex_array) + i * NUM(vertex_array[0]); 41 const std::size_t array_offset = OFF(vertex_streams) + i * NUM(vertex_streams[0]);
42 const std::size_t instance_array_offset = array_offset + instance_base_offset; 42 const std::size_t instance_array_offset = array_offset + instance_base_offset;
43 tables[0][instance_array_offset] = static_cast<u8>(VertexInstance0 + i); 43 tables[0][instance_array_offset] = static_cast<u8>(VertexInstance0 + i);
44 tables[1][instance_array_offset] = VertexInstances; 44 tables[1][instance_array_offset] = VertexInstances;
45 45
46 const std::size_t instance_offset = OFF(instanced_arrays) + i; 46 const std::size_t instance_offset = OFF(vertex_stream_instances) + i;
47 tables[0][instance_offset] = static_cast<u8>(VertexInstance0 + i); 47 tables[0][instance_offset] = static_cast<u8>(VertexInstance0 + i);
48 tables[1][instance_offset] = VertexInstances; 48 tables[1][instance_offset] = VertexInstances;
49 } 49 }
@@ -70,8 +70,8 @@ void SetupDirtyViewports(Tables& tables) {
70 FillBlock(tables[1], OFF(viewport_transform), NUM(viewport_transform), Viewports); 70 FillBlock(tables[1], OFF(viewport_transform), NUM(viewport_transform), Viewports);
71 FillBlock(tables[1], OFF(viewports), NUM(viewports), Viewports); 71 FillBlock(tables[1], OFF(viewports), NUM(viewports), Viewports);
72 72
73 tables[0][OFF(viewport_transform_enabled)] = ViewportTransform; 73 tables[0][OFF(viewport_scale_offset_enbled)] = ViewportTransform;
74 tables[1][OFF(viewport_transform_enabled)] = Viewports; 74 tables[1][OFF(viewport_scale_offset_enbled)] = Viewports;
75} 75}
76 76
77void SetupDirtyScissors(Tables& tables) { 77void SetupDirtyScissors(Tables& tables) {
@@ -88,7 +88,7 @@ void SetupDirtyPolygonModes(Tables& tables) {
88 88
89 tables[1][OFF(polygon_mode_front)] = PolygonModes; 89 tables[1][OFF(polygon_mode_front)] = PolygonModes;
90 tables[1][OFF(polygon_mode_back)] = PolygonModes; 90 tables[1][OFF(polygon_mode_back)] = PolygonModes;
91 tables[0][OFF(fill_rectangle)] = PolygonModes; 91 tables[0][OFF(fill_via_triangle_mode)] = PolygonModes;
92} 92}
93 93
94void SetupDirtyDepthTest(Tables& tables) { 94void SetupDirtyDepthTest(Tables& tables) {
@@ -100,12 +100,14 @@ void SetupDirtyDepthTest(Tables& tables) {
100 100
101void SetupDirtyStencilTest(Tables& tables) { 101void SetupDirtyStencilTest(Tables& tables) {
102 static constexpr std::array offsets = { 102 static constexpr std::array offsets = {
103 OFF(stencil_enable), OFF(stencil_front_func_func), OFF(stencil_front_func_ref), 103 OFF(stencil_enable), OFF(stencil_front_op.func),
104 OFF(stencil_front_func_mask), OFF(stencil_front_op_fail), OFF(stencil_front_op_zfail), 104 OFF(stencil_front_func.ref), OFF(stencil_front_func.func_mask),
105 OFF(stencil_front_op_zpass), OFF(stencil_front_mask), OFF(stencil_two_side_enable), 105 OFF(stencil_front_op.fail), OFF(stencil_front_op.zfail),
106 OFF(stencil_back_func_func), OFF(stencil_back_func_ref), OFF(stencil_back_func_mask), 106 OFF(stencil_front_op.zpass), OFF(stencil_front_func.mask),
107 OFF(stencil_back_op_fail), OFF(stencil_back_op_zfail), OFF(stencil_back_op_zpass), 107 OFF(stencil_two_side_enable), OFF(stencil_back_op.func),
108 OFF(stencil_back_mask)}; 108 OFF(stencil_back_func.ref), OFF(stencil_back_func.func_mask),
109 OFF(stencil_back_op.fail), OFF(stencil_back_op.zfail),
110 OFF(stencil_back_op.zpass), OFF(stencil_back_func.mask)};
109 for (const auto offset : offsets) { 111 for (const auto offset : offsets) {
110 tables[0][offset] = StencilTest; 112 tables[0][offset] = StencilTest;
111 } 113 }
@@ -121,15 +123,15 @@ void SetupDirtyAlphaTest(Tables& tables) {
121void SetupDirtyBlend(Tables& tables) { 123void SetupDirtyBlend(Tables& tables) {
122 FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendColor); 124 FillBlock(tables[0], OFF(blend_color), NUM(blend_color), BlendColor);
123 125
124 tables[0][OFF(independent_blend_enable)] = BlendIndependentEnabled; 126 tables[0][OFF(blend_per_target_enabled)] = BlendIndependentEnabled;
125 127
126 for (std::size_t i = 0; i < Regs::NumRenderTargets; ++i) { 128 for (std::size_t i = 0; i < Regs::NumRenderTargets; ++i) {
127 const std::size_t offset = OFF(independent_blend) + i * NUM(independent_blend[0]); 129 const std::size_t offset = OFF(blend_per_target) + i * NUM(blend_per_target[0]);
128 FillBlock(tables[0], offset, NUM(independent_blend[0]), BlendState0 + i); 130 FillBlock(tables[0], offset, NUM(blend_per_target[0]), BlendState0 + i);
129 131
130 tables[0][OFF(blend.enable) + i] = static_cast<u8>(BlendState0 + i); 132 tables[0][OFF(blend.enable) + i] = static_cast<u8>(BlendState0 + i);
131 } 133 }
132 FillBlock(tables[1], OFF(independent_blend), NUM(independent_blend), BlendStates); 134 FillBlock(tables[1], OFF(blend_per_target), NUM(blend_per_target), BlendStates);
133 FillBlock(tables[1], OFF(blend), NUM(blend), BlendStates); 135 FillBlock(tables[1], OFF(blend), NUM(blend), BlendStates);
134} 136}
135 137
@@ -142,13 +144,14 @@ void SetupDirtyPolygonOffset(Tables& tables) {
142 table[OFF(polygon_offset_fill_enable)] = PolygonOffset; 144 table[OFF(polygon_offset_fill_enable)] = PolygonOffset;
143 table[OFF(polygon_offset_line_enable)] = PolygonOffset; 145 table[OFF(polygon_offset_line_enable)] = PolygonOffset;
144 table[OFF(polygon_offset_point_enable)] = PolygonOffset; 146 table[OFF(polygon_offset_point_enable)] = PolygonOffset;
145 table[OFF(polygon_offset_factor)] = PolygonOffset; 147 table[OFF(slope_scale_depth_bias)] = PolygonOffset;
146 table[OFF(polygon_offset_units)] = PolygonOffset; 148 table[OFF(depth_bias)] = PolygonOffset;
147 table[OFF(polygon_offset_clamp)] = PolygonOffset; 149 table[OFF(depth_bias_clamp)] = PolygonOffset;
148} 150}
149 151
150void SetupDirtyMultisampleControl(Tables& tables) { 152void SetupDirtyMultisampleControl(Tables& tables) {
151 FillBlock(tables[0], OFF(multisample_control), NUM(multisample_control), MultisampleControl); 153 FillBlock(tables[0], OFF(anti_alias_alpha_control), NUM(anti_alias_alpha_control),
154 MultisampleControl);
152} 155}
153 156
154void SetupDirtyRasterizeEnable(Tables& tables) { 157void SetupDirtyRasterizeEnable(Tables& tables) {
@@ -168,7 +171,7 @@ void SetupDirtyFragmentClampColor(Tables& tables) {
168} 171}
169 172
170void SetupDirtyPointSize(Tables& tables) { 173void SetupDirtyPointSize(Tables& tables) {
171 tables[0][OFF(vp_point_size)] = PointSize; 174 tables[0][OFF(point_size_attribute)] = PointSize;
172 tables[0][OFF(point_size)] = PointSize; 175 tables[0][OFF(point_size)] = PointSize;
173 tables[0][OFF(point_sprite_enable)] = PointSize; 176 tables[0][OFF(point_sprite_enable)] = PointSize;
174} 177}
@@ -176,28 +179,28 @@ void SetupDirtyPointSize(Tables& tables) {
176void SetupDirtyLineWidth(Tables& tables) { 179void SetupDirtyLineWidth(Tables& tables) {
177 tables[0][OFF(line_width_smooth)] = LineWidth; 180 tables[0][OFF(line_width_smooth)] = LineWidth;
178 tables[0][OFF(line_width_aliased)] = LineWidth; 181 tables[0][OFF(line_width_aliased)] = LineWidth;
179 tables[0][OFF(line_smooth_enable)] = LineWidth; 182 tables[0][OFF(line_anti_alias_enable)] = LineWidth;
180} 183}
181 184
182void SetupDirtyClipControl(Tables& tables) { 185void SetupDirtyClipControl(Tables& tables) {
183 auto& table = tables[0]; 186 auto& table = tables[0];
184 table[OFF(screen_y_control)] = ClipControl; 187 table[OFF(window_origin)] = ClipControl;
185 table[OFF(depth_mode)] = ClipControl; 188 table[OFF(depth_mode)] = ClipControl;
186} 189}
187 190
188void SetupDirtyDepthClampEnabled(Tables& tables) { 191void SetupDirtyDepthClampEnabled(Tables& tables) {
189 tables[0][OFF(view_volume_clip_control)] = DepthClampEnabled; 192 tables[0][OFF(viewport_clip_control)] = DepthClampEnabled;
190} 193}
191 194
192void SetupDirtyMisc(Tables& tables) { 195void SetupDirtyMisc(Tables& tables) {
193 auto& table = tables[0]; 196 auto& table = tables[0];
194 197
195 table[OFF(clip_distance_enabled)] = ClipDistances; 198 table[OFF(user_clip_enable)] = ClipDistances;
196 199
197 table[OFF(front_face)] = FrontFace; 200 table[OFF(gl_front_face)] = FrontFace;
198 201
199 table[OFF(cull_test_enabled)] = CullTest; 202 table[OFF(gl_cull_test_enabled)] = CullTest;
200 table[OFF(cull_face)] = CullTest; 203 table[OFF(gl_cull_face)] = CullTest;
201} 204}
202 205
203} // Anonymous namespace 206} // Anonymous namespace
diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h
index 004421236..e14f9b2db 100644
--- a/src/video_core/renderer_opengl/maxwell_to_gl.h
+++ b/src/video_core/renderer_opengl/maxwell_to_gl.h
@@ -126,51 +126,60 @@ inline const FormatTuple& GetFormatTuple(VideoCore::Surface::PixelFormat pixel_f
126 126
127inline GLenum VertexFormat(Maxwell::VertexAttribute attrib) { 127inline GLenum VertexFormat(Maxwell::VertexAttribute attrib) {
128 switch (attrib.type) { 128 switch (attrib.type) {
129 case Maxwell::VertexAttribute::Type::UnsignedNorm: 129 case Maxwell::VertexAttribute::Type::UnusedEnumDoNotUseBecauseItWillGoAway:
130 case Maxwell::VertexAttribute::Type::UnsignedScaled: 130 ASSERT_MSG(false, "Invalid vertex attribute type!");
131 case Maxwell::VertexAttribute::Type::UnsignedInt: 131 break;
132 case Maxwell::VertexAttribute::Type::UNorm:
133 case Maxwell::VertexAttribute::Type::UScaled:
134 case Maxwell::VertexAttribute::Type::UInt:
132 switch (attrib.size) { 135 switch (attrib.size) {
133 case Maxwell::VertexAttribute::Size::Size_8: 136 case Maxwell::VertexAttribute::Size::Size_R8:
134 case Maxwell::VertexAttribute::Size::Size_8_8: 137 case Maxwell::VertexAttribute::Size::Size_A8:
135 case Maxwell::VertexAttribute::Size::Size_8_8_8: 138 case Maxwell::VertexAttribute::Size::Size_R8_G8:
136 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 139 case Maxwell::VertexAttribute::Size::Size_G8_R8:
140 case Maxwell::VertexAttribute::Size::Size_R8_G8_B8:
141 case Maxwell::VertexAttribute::Size::Size_R8_G8_B8_A8:
142 case Maxwell::VertexAttribute::Size::Size_X8_B8_G8_R8:
137 return GL_UNSIGNED_BYTE; 143 return GL_UNSIGNED_BYTE;
138 case Maxwell::VertexAttribute::Size::Size_16: 144 case Maxwell::VertexAttribute::Size::Size_R16:
139 case Maxwell::VertexAttribute::Size::Size_16_16: 145 case Maxwell::VertexAttribute::Size::Size_R16_G16:
140 case Maxwell::VertexAttribute::Size::Size_16_16_16: 146 case Maxwell::VertexAttribute::Size::Size_R16_G16_B16:
141 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 147 case Maxwell::VertexAttribute::Size::Size_R16_G16_B16_A16:
142 return GL_UNSIGNED_SHORT; 148 return GL_UNSIGNED_SHORT;
143 case Maxwell::VertexAttribute::Size::Size_32: 149 case Maxwell::VertexAttribute::Size::Size_R32:
144 case Maxwell::VertexAttribute::Size::Size_32_32: 150 case Maxwell::VertexAttribute::Size::Size_R32_G32:
145 case Maxwell::VertexAttribute::Size::Size_32_32_32: 151 case Maxwell::VertexAttribute::Size::Size_R32_G32_B32:
146 case Maxwell::VertexAttribute::Size::Size_32_32_32_32: 152 case Maxwell::VertexAttribute::Size::Size_R32_G32_B32_A32:
147 return GL_UNSIGNED_INT; 153 return GL_UNSIGNED_INT;
148 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 154 case Maxwell::VertexAttribute::Size::Size_A2_B10_G10_R10:
149 return GL_UNSIGNED_INT_2_10_10_10_REV; 155 return GL_UNSIGNED_INT_2_10_10_10_REV;
150 default: 156 default:
151 break; 157 break;
152 } 158 }
153 break; 159 break;
154 case Maxwell::VertexAttribute::Type::SignedNorm: 160 case Maxwell::VertexAttribute::Type::SNorm:
155 case Maxwell::VertexAttribute::Type::SignedScaled: 161 case Maxwell::VertexAttribute::Type::SScaled:
156 case Maxwell::VertexAttribute::Type::SignedInt: 162 case Maxwell::VertexAttribute::Type::SInt:
157 switch (attrib.size) { 163 switch (attrib.size) {
158 case Maxwell::VertexAttribute::Size::Size_8: 164 case Maxwell::VertexAttribute::Size::Size_R8:
159 case Maxwell::VertexAttribute::Size::Size_8_8: 165 case Maxwell::VertexAttribute::Size::Size_A8:
160 case Maxwell::VertexAttribute::Size::Size_8_8_8: 166 case Maxwell::VertexAttribute::Size::Size_R8_G8:
161 case Maxwell::VertexAttribute::Size::Size_8_8_8_8: 167 case Maxwell::VertexAttribute::Size::Size_G8_R8:
168 case Maxwell::VertexAttribute::Size::Size_R8_G8_B8:
169 case Maxwell::VertexAttribute::Size::Size_R8_G8_B8_A8:
170 case Maxwell::VertexAttribute::Size::Size_X8_B8_G8_R8:
162 return GL_BYTE; 171 return GL_BYTE;
163 case Maxwell::VertexAttribute::Size::Size_16: 172 case Maxwell::VertexAttribute::Size::Size_R16:
164 case Maxwell::VertexAttribute::Size::Size_16_16: 173 case Maxwell::VertexAttribute::Size::Size_R16_G16:
165 case Maxwell::VertexAttribute::Size::Size_16_16_16: 174 case Maxwell::VertexAttribute::Size::Size_R16_G16_B16:
166 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 175 case Maxwell::VertexAttribute::Size::Size_R16_G16_B16_A16:
167 return GL_SHORT; 176 return GL_SHORT;
168 case Maxwell::VertexAttribute::Size::Size_32: 177 case Maxwell::VertexAttribute::Size::Size_R32:
169 case Maxwell::VertexAttribute::Size::Size_32_32: 178 case Maxwell::VertexAttribute::Size::Size_R32_G32:
170 case Maxwell::VertexAttribute::Size::Size_32_32_32: 179 case Maxwell::VertexAttribute::Size::Size_R32_G32_B32:
171 case Maxwell::VertexAttribute::Size::Size_32_32_32_32: 180 case Maxwell::VertexAttribute::Size::Size_R32_G32_B32_A32:
172 return GL_INT; 181 return GL_INT;
173 case Maxwell::VertexAttribute::Size::Size_10_10_10_2: 182 case Maxwell::VertexAttribute::Size::Size_A2_B10_G10_R10:
174 return GL_INT_2_10_10_10_REV; 183 return GL_INT_2_10_10_10_REV;
175 default: 184 default:
176 break; 185 break;
@@ -178,17 +187,17 @@ inline GLenum VertexFormat(Maxwell::VertexAttribute attrib) {
178 break; 187 break;
179 case Maxwell::VertexAttribute::Type::Float: 188 case Maxwell::VertexAttribute::Type::Float:
180 switch (attrib.size) { 189 switch (attrib.size) {
181 case Maxwell::VertexAttribute::Size::Size_16: 190 case Maxwell::VertexAttribute::Size::Size_R16:
182 case Maxwell::VertexAttribute::Size::Size_16_16: 191 case Maxwell::VertexAttribute::Size::Size_R16_G16:
183 case Maxwell::VertexAttribute::Size::Size_16_16_16: 192 case Maxwell::VertexAttribute::Size::Size_R16_G16_B16:
184 case Maxwell::VertexAttribute::Size::Size_16_16_16_16: 193 case Maxwell::VertexAttribute::Size::Size_R16_G16_B16_A16:
185 return GL_HALF_FLOAT; 194 return GL_HALF_FLOAT;
186 case Maxwell::VertexAttribute::Size::Size_32: 195 case Maxwell::VertexAttribute::Size::Size_R32:
187 case Maxwell::VertexAttribute::Size::Size_32_32: 196 case Maxwell::VertexAttribute::Size::Size_R32_G32:
188 case Maxwell::VertexAttribute::Size::Size_32_32_32: 197 case Maxwell::VertexAttribute::Size::Size_R32_G32_B32:
189 case Maxwell::VertexAttribute::Size::Size_32_32_32_32: 198 case Maxwell::VertexAttribute::Size::Size_R32_G32_B32_A32:
190 return GL_FLOAT; 199 return GL_FLOAT;
191 case Maxwell::VertexAttribute::Size::Size_11_11_10: 200 case Maxwell::VertexAttribute::Size::Size_B10_G11_R11:
192 return GL_UNSIGNED_INT_10F_11F_11F_REV; 201 return GL_UNSIGNED_INT_10F_11F_11F_REV;
193 default: 202 default:
194 break; 203 break;
@@ -335,20 +344,20 @@ inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) {
335 344
336inline GLenum BlendEquation(Maxwell::Blend::Equation equation) { 345inline GLenum BlendEquation(Maxwell::Blend::Equation equation) {
337 switch (equation) { 346 switch (equation) {
338 case Maxwell::Blend::Equation::Add: 347 case Maxwell::Blend::Equation::Add_D3D:
339 case Maxwell::Blend::Equation::AddGL: 348 case Maxwell::Blend::Equation::Add_GL:
340 return GL_FUNC_ADD; 349 return GL_FUNC_ADD;
341 case Maxwell::Blend::Equation::Subtract: 350 case Maxwell::Blend::Equation::Subtract_D3D:
342 case Maxwell::Blend::Equation::SubtractGL: 351 case Maxwell::Blend::Equation::Subtract_GL:
343 return GL_FUNC_SUBTRACT; 352 return GL_FUNC_SUBTRACT;
344 case Maxwell::Blend::Equation::ReverseSubtract: 353 case Maxwell::Blend::Equation::ReverseSubtract_D3D:
345 case Maxwell::Blend::Equation::ReverseSubtractGL: 354 case Maxwell::Blend::Equation::ReverseSubtract_GL:
346 return GL_FUNC_REVERSE_SUBTRACT; 355 return GL_FUNC_REVERSE_SUBTRACT;
347 case Maxwell::Blend::Equation::Min: 356 case Maxwell::Blend::Equation::Min_D3D:
348 case Maxwell::Blend::Equation::MinGL: 357 case Maxwell::Blend::Equation::Min_GL:
349 return GL_MIN; 358 return GL_MIN;
350 case Maxwell::Blend::Equation::Max: 359 case Maxwell::Blend::Equation::Max_D3D:
351 case Maxwell::Blend::Equation::MaxGL: 360 case Maxwell::Blend::Equation::Max_GL:
352 return GL_MAX; 361 return GL_MAX;
353 } 362 }
354 UNIMPLEMENTED_MSG("Unimplemented blend equation={}", equation); 363 UNIMPLEMENTED_MSG("Unimplemented blend equation={}", equation);
@@ -357,62 +366,62 @@ inline GLenum BlendEquation(Maxwell::Blend::Equation equation) {
357 366
358inline GLenum BlendFunc(Maxwell::Blend::Factor factor) { 367inline GLenum BlendFunc(Maxwell::Blend::Factor factor) {
359 switch (factor) { 368 switch (factor) {
360 case Maxwell::Blend::Factor::Zero: 369 case Maxwell::Blend::Factor::Zero_D3D:
361 case Maxwell::Blend::Factor::ZeroGL: 370 case Maxwell::Blend::Factor::Zero_GL:
362 return GL_ZERO; 371 return GL_ZERO;
363 case Maxwell::Blend::Factor::One: 372 case Maxwell::Blend::Factor::One_D3D:
364 case Maxwell::Blend::Factor::OneGL: 373 case Maxwell::Blend::Factor::One_GL:
365 return GL_ONE; 374 return GL_ONE;
366 case Maxwell::Blend::Factor::SourceColor: 375 case Maxwell::Blend::Factor::SourceColor_D3D:
367 case Maxwell::Blend::Factor::SourceColorGL: 376 case Maxwell::Blend::Factor::SourceColor_GL:
368 return GL_SRC_COLOR; 377 return GL_SRC_COLOR;
369 case Maxwell::Blend::Factor::OneMinusSourceColor: 378 case Maxwell::Blend::Factor::OneMinusSourceColor_D3D:
370 case Maxwell::Blend::Factor::OneMinusSourceColorGL: 379 case Maxwell::Blend::Factor::OneMinusSourceColor_GL:
371 return GL_ONE_MINUS_SRC_COLOR; 380 return GL_ONE_MINUS_SRC_COLOR;
372 case Maxwell::Blend::Factor::SourceAlpha: 381 case Maxwell::Blend::Factor::SourceAlpha_D3D:
373 case Maxwell::Blend::Factor::SourceAlphaGL: 382 case Maxwell::Blend::Factor::SourceAlpha_GL:
374 return GL_SRC_ALPHA; 383 return GL_SRC_ALPHA;
375 case Maxwell::Blend::Factor::OneMinusSourceAlpha: 384 case Maxwell::Blend::Factor::OneMinusSourceAlpha_D3D:
376 case Maxwell::Blend::Factor::OneMinusSourceAlphaGL: 385 case Maxwell::Blend::Factor::OneMinusSourceAlpha_GL:
377 return GL_ONE_MINUS_SRC_ALPHA; 386 return GL_ONE_MINUS_SRC_ALPHA;
378 case Maxwell::Blend::Factor::DestAlpha: 387 case Maxwell::Blend::Factor::DestAlpha_D3D:
379 case Maxwell::Blend::Factor::DestAlphaGL: 388 case Maxwell::Blend::Factor::DestAlpha_GL:
380 return GL_DST_ALPHA; 389 return GL_DST_ALPHA;
381 case Maxwell::Blend::Factor::OneMinusDestAlpha: 390 case Maxwell::Blend::Factor::OneMinusDestAlpha_D3D:
382 case Maxwell::Blend::Factor::OneMinusDestAlphaGL: 391 case Maxwell::Blend::Factor::OneMinusDestAlpha_GL:
383 return GL_ONE_MINUS_DST_ALPHA; 392 return GL_ONE_MINUS_DST_ALPHA;
384 case Maxwell::Blend::Factor::DestColor: 393 case Maxwell::Blend::Factor::DestColor_D3D:
385 case Maxwell::Blend::Factor::DestColorGL: 394 case Maxwell::Blend::Factor::DestColor_GL:
386 return GL_DST_COLOR; 395 return GL_DST_COLOR;
387 case Maxwell::Blend::Factor::OneMinusDestColor: 396 case Maxwell::Blend::Factor::OneMinusDestColor_D3D:
388 case Maxwell::Blend::Factor::OneMinusDestColorGL: 397 case Maxwell::Blend::Factor::OneMinusDestColor_GL:
389 return GL_ONE_MINUS_DST_COLOR; 398 return GL_ONE_MINUS_DST_COLOR;
390 case Maxwell::Blend::Factor::SourceAlphaSaturate: 399 case Maxwell::Blend::Factor::SourceAlphaSaturate_D3D:
391 case Maxwell::Blend::Factor::SourceAlphaSaturateGL: 400 case Maxwell::Blend::Factor::SourceAlphaSaturate_GL:
392 return GL_SRC_ALPHA_SATURATE; 401 return GL_SRC_ALPHA_SATURATE;
393 case Maxwell::Blend::Factor::Source1Color: 402 case Maxwell::Blend::Factor::Source1Color_D3D:
394 case Maxwell::Blend::Factor::Source1ColorGL: 403 case Maxwell::Blend::Factor::Source1Color_GL:
395 return GL_SRC1_COLOR; 404 return GL_SRC1_COLOR;
396 case Maxwell::Blend::Factor::OneMinusSource1Color: 405 case Maxwell::Blend::Factor::OneMinusSource1Color_D3D:
397 case Maxwell::Blend::Factor::OneMinusSource1ColorGL: 406 case Maxwell::Blend::Factor::OneMinusSource1Color_GL:
398 return GL_ONE_MINUS_SRC1_COLOR; 407 return GL_ONE_MINUS_SRC1_COLOR;
399 case Maxwell::Blend::Factor::Source1Alpha: 408 case Maxwell::Blend::Factor::Source1Alpha_D3D:
400 case Maxwell::Blend::Factor::Source1AlphaGL: 409 case Maxwell::Blend::Factor::Source1Alpha_GL:
401 return GL_SRC1_ALPHA; 410 return GL_SRC1_ALPHA;
402 case Maxwell::Blend::Factor::OneMinusSource1Alpha: 411 case Maxwell::Blend::Factor::OneMinusSource1Alpha_D3D:
403 case Maxwell::Blend::Factor::OneMinusSource1AlphaGL: 412 case Maxwell::Blend::Factor::OneMinusSource1Alpha_GL:
404 return GL_ONE_MINUS_SRC1_ALPHA; 413 return GL_ONE_MINUS_SRC1_ALPHA;
405 case Maxwell::Blend::Factor::ConstantColor: 414 case Maxwell::Blend::Factor::BlendFactor_D3D:
406 case Maxwell::Blend::Factor::ConstantColorGL: 415 case Maxwell::Blend::Factor::ConstantColor_GL:
407 return GL_CONSTANT_COLOR; 416 return GL_CONSTANT_COLOR;
408 case Maxwell::Blend::Factor::OneMinusConstantColor: 417 case Maxwell::Blend::Factor::OneMinusBlendFactor_D3D:
409 case Maxwell::Blend::Factor::OneMinusConstantColorGL: 418 case Maxwell::Blend::Factor::OneMinusConstantColor_GL:
410 return GL_ONE_MINUS_CONSTANT_COLOR; 419 return GL_ONE_MINUS_CONSTANT_COLOR;
411 case Maxwell::Blend::Factor::ConstantAlpha: 420 case Maxwell::Blend::Factor::BothSourceAlpha_D3D:
412 case Maxwell::Blend::Factor::ConstantAlphaGL: 421 case Maxwell::Blend::Factor::ConstantAlpha_GL:
413 return GL_CONSTANT_ALPHA; 422 return GL_CONSTANT_ALPHA;
414 case Maxwell::Blend::Factor::OneMinusConstantAlpha: 423 case Maxwell::Blend::Factor::OneMinusBothSourceAlpha_D3D:
415 case Maxwell::Blend::Factor::OneMinusConstantAlphaGL: 424 case Maxwell::Blend::Factor::OneMinusConstantAlpha_GL:
416 return GL_ONE_MINUS_CONSTANT_ALPHA; 425 return GL_ONE_MINUS_CONSTANT_ALPHA;
417 } 426 }
418 UNIMPLEMENTED_MSG("Unimplemented blend factor={}", factor); 427 UNIMPLEMENTED_MSG("Unimplemented blend factor={}", factor);
@@ -421,60 +430,60 @@ inline GLenum BlendFunc(Maxwell::Blend::Factor factor) {
421 430
422inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) { 431inline GLenum ComparisonOp(Maxwell::ComparisonOp comparison) {
423 switch (comparison) { 432 switch (comparison) {
424 case Maxwell::ComparisonOp::Never: 433 case Maxwell::ComparisonOp::Never_D3D:
425 case Maxwell::ComparisonOp::NeverOld: 434 case Maxwell::ComparisonOp::Never_GL:
426 return GL_NEVER; 435 return GL_NEVER;
427 case Maxwell::ComparisonOp::Less: 436 case Maxwell::ComparisonOp::Less_D3D:
428 case Maxwell::ComparisonOp::LessOld: 437 case Maxwell::ComparisonOp::Less_GL:
429 return GL_LESS; 438 return GL_LESS;
430 case Maxwell::ComparisonOp::Equal: 439 case Maxwell::ComparisonOp::Equal_D3D:
431 case Maxwell::ComparisonOp::EqualOld: 440 case Maxwell::ComparisonOp::Equal_GL:
432 return GL_EQUAL; 441 return GL_EQUAL;
433 case Maxwell::ComparisonOp::LessEqual: 442 case Maxwell::ComparisonOp::LessEqual_D3D:
434 case Maxwell::ComparisonOp::LessEqualOld: 443 case Maxwell::ComparisonOp::LessEqual_GL:
435 return GL_LEQUAL; 444 return GL_LEQUAL;
436 case Maxwell::ComparisonOp::Greater: 445 case Maxwell::ComparisonOp::Greater_D3D:
437 case Maxwell::ComparisonOp::GreaterOld: 446 case Maxwell::ComparisonOp::Greater_GL:
438 return GL_GREATER; 447 return GL_GREATER;
439 case Maxwell::ComparisonOp::NotEqual: 448 case Maxwell::ComparisonOp::NotEqual_D3D:
440 case Maxwell::ComparisonOp::NotEqualOld: 449 case Maxwell::ComparisonOp::NotEqual_GL:
441 return GL_NOTEQUAL; 450 return GL_NOTEQUAL;
442 case Maxwell::ComparisonOp::GreaterEqual: 451 case Maxwell::ComparisonOp::GreaterEqual_D3D:
443 case Maxwell::ComparisonOp::GreaterEqualOld: 452 case Maxwell::ComparisonOp::GreaterEqual_GL:
444 return GL_GEQUAL; 453 return GL_GEQUAL;
445 case Maxwell::ComparisonOp::Always: 454 case Maxwell::ComparisonOp::Always_D3D:
446 case Maxwell::ComparisonOp::AlwaysOld: 455 case Maxwell::ComparisonOp::Always_GL:
447 return GL_ALWAYS; 456 return GL_ALWAYS;
448 } 457 }
449 UNIMPLEMENTED_MSG("Unimplemented comparison op={}", comparison); 458 UNIMPLEMENTED_MSG("Unimplemented comparison op={}", comparison);
450 return GL_ALWAYS; 459 return GL_ALWAYS;
451} 460}
452 461
453inline GLenum StencilOp(Maxwell::StencilOp stencil) { 462inline GLenum StencilOp(Maxwell::StencilOp::Op stencil) {
454 switch (stencil) { 463 switch (stencil) {
455 case Maxwell::StencilOp::Keep: 464 case Maxwell::StencilOp::Op::Keep_D3D:
456 case Maxwell::StencilOp::KeepOGL: 465 case Maxwell::StencilOp::Op::Keep_GL:
457 return GL_KEEP; 466 return GL_KEEP;
458 case Maxwell::StencilOp::Zero: 467 case Maxwell::StencilOp::Op::Zero_D3D:
459 case Maxwell::StencilOp::ZeroOGL: 468 case Maxwell::StencilOp::Op::Zero_GL:
460 return GL_ZERO; 469 return GL_ZERO;
461 case Maxwell::StencilOp::Replace: 470 case Maxwell::StencilOp::Op::Replace_D3D:
462 case Maxwell::StencilOp::ReplaceOGL: 471 case Maxwell::StencilOp::Op::Replace_GL:
463 return GL_REPLACE; 472 return GL_REPLACE;
464 case Maxwell::StencilOp::Incr: 473 case Maxwell::StencilOp::Op::IncrSaturate_D3D:
465 case Maxwell::StencilOp::IncrOGL: 474 case Maxwell::StencilOp::Op::IncrSaturate_GL:
466 return GL_INCR; 475 return GL_INCR;
467 case Maxwell::StencilOp::Decr: 476 case Maxwell::StencilOp::Op::DecrSaturate_D3D:
468 case Maxwell::StencilOp::DecrOGL: 477 case Maxwell::StencilOp::Op::DecrSaturate_GL:
469 return GL_DECR; 478 return GL_DECR;
470 case Maxwell::StencilOp::Invert: 479 case Maxwell::StencilOp::Op::Invert_D3D:
471 case Maxwell::StencilOp::InvertOGL: 480 case Maxwell::StencilOp::Op::Invert_GL:
472 return GL_INVERT; 481 return GL_INVERT;
473 case Maxwell::StencilOp::IncrWrap: 482 case Maxwell::StencilOp::Op::Incr_D3D:
474 case Maxwell::StencilOp::IncrWrapOGL: 483 case Maxwell::StencilOp::Op::Incr_GL:
475 return GL_INCR_WRAP; 484 return GL_INCR_WRAP;
476 case Maxwell::StencilOp::DecrWrap: 485 case Maxwell::StencilOp::Op::Decr_D3D:
477 case Maxwell::StencilOp::DecrWrapOGL: 486 case Maxwell::StencilOp::Op::Decr_GL:
478 return GL_DECR_WRAP; 487 return GL_DECR_WRAP;
479 } 488 }
480 UNIMPLEMENTED_MSG("Unimplemented stencil op={}", stencil); 489 UNIMPLEMENTED_MSG("Unimplemented stencil op={}", stencil);
@@ -505,39 +514,39 @@ inline GLenum CullFace(Maxwell::CullFace cull_face) {
505 return GL_BACK; 514 return GL_BACK;
506} 515}
507 516
508inline GLenum LogicOp(Maxwell::LogicOperation operation) { 517inline GLenum LogicOp(Maxwell::LogicOp::Op operation) {
509 switch (operation) { 518 switch (operation) {
510 case Maxwell::LogicOperation::Clear: 519 case Maxwell::LogicOp::Op::Clear:
511 return GL_CLEAR; 520 return GL_CLEAR;
512 case Maxwell::LogicOperation::And: 521 case Maxwell::LogicOp::Op::And:
513 return GL_AND; 522 return GL_AND;
514 case Maxwell::LogicOperation::AndReverse: 523 case Maxwell::LogicOp::Op::AndReverse:
515 return GL_AND_REVERSE; 524 return GL_AND_REVERSE;
516 case Maxwell::LogicOperation::Copy: 525 case Maxwell::LogicOp::Op::Copy:
517 return GL_COPY; 526 return GL_COPY;
518 case Maxwell::LogicOperation::AndInverted: 527 case Maxwell::LogicOp::Op::AndInverted:
519 return GL_AND_INVERTED; 528 return GL_AND_INVERTED;
520 case Maxwell::LogicOperation::NoOp: 529 case Maxwell::LogicOp::Op::NoOp:
521 return GL_NOOP; 530 return GL_NOOP;
522 case Maxwell::LogicOperation::Xor: 531 case Maxwell::LogicOp::Op::Xor:
523 return GL_XOR; 532 return GL_XOR;
524 case Maxwell::LogicOperation::Or: 533 case Maxwell::LogicOp::Op::Or:
525 return GL_OR; 534 return GL_OR;
526 case Maxwell::LogicOperation::Nor: 535 case Maxwell::LogicOp::Op::Nor:
527 return GL_NOR; 536 return GL_NOR;
528 case Maxwell::LogicOperation::Equiv: 537 case Maxwell::LogicOp::Op::Equiv:
529 return GL_EQUIV; 538 return GL_EQUIV;
530 case Maxwell::LogicOperation::Invert: 539 case Maxwell::LogicOp::Op::Invert:
531 return GL_INVERT; 540 return GL_INVERT;
532 case Maxwell::LogicOperation::OrReverse: 541 case Maxwell::LogicOp::Op::OrReverse:
533 return GL_OR_REVERSE; 542 return GL_OR_REVERSE;
534 case Maxwell::LogicOperation::CopyInverted: 543 case Maxwell::LogicOp::Op::CopyInverted:
535 return GL_COPY_INVERTED; 544 return GL_COPY_INVERTED;
536 case Maxwell::LogicOperation::OrInverted: 545 case Maxwell::LogicOp::Op::OrInverted:
537 return GL_OR_INVERTED; 546 return GL_OR_INVERTED;
538 case Maxwell::LogicOperation::Nand: 547 case Maxwell::LogicOp::Op::Nand:
539 return GL_NAND; 548 return GL_NAND;
540 case Maxwell::LogicOperation::Set: 549 case Maxwell::LogicOp::Op::Set:
541 return GL_SET; 550 return GL_SET;
542 } 551 }
543 UNIMPLEMENTED_MSG("Unimplemented logic operation={}", operation); 552 UNIMPLEMENTED_MSG("Unimplemented logic operation={}", operation);