summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp24
-rw-r--r--src/video_core/renderer_opengl/gl_state.cpp31
2 files changed, 29 insertions, 26 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index faab77ff5..518f79331 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -793,10 +793,10 @@ void RasterizerOpenGL::ReloadColorBuffer() {
793 for (int x = 0; x < fb_color_texture.width; ++x) { 793 for (int x = 0; x < fb_color_texture.width; ++x) {
794 const u32 coarse_y = y & ~7; 794 const u32 coarse_y = y & ~7;
795 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel; 795 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel;
796 u32 gl_px_idx = (x + y * fb_color_texture.width) * bytes_per_pixel; 796 u32 gl_pixel_index = (x + y * fb_color_texture.width) * bytes_per_pixel;
797 797
798 u8* pixel = color_buffer + dst_offset; 798 u8* pixel = color_buffer + dst_offset;
799 memcpy(&temp_fb_color_buffer[gl_px_idx], pixel, bytes_per_pixel); 799 memcpy(&temp_fb_color_buffer[gl_pixel_index], pixel, bytes_per_pixel);
800 } 800 }
801 } 801 }
802 802
@@ -834,11 +834,11 @@ void RasterizerOpenGL::ReloadDepthBuffer() {
834 for (int x = 0; x < fb_depth_texture.width; ++x) { 834 for (int x = 0; x < fb_depth_texture.width; ++x) {
835 const u32 coarse_y = y & ~7; 835 const u32 coarse_y = y & ~7;
836 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; 836 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel;
837 u32 gl_px_idx = (x + y * fb_depth_texture.width); 837 u32 gl_pixel_index = (x + y * fb_depth_texture.width);
838 838
839 u8* pixel = depth_buffer + dst_offset; 839 u8* pixel = depth_buffer + dst_offset;
840 u32 depth_stencil = *(u32*)pixel; 840 u32 depth_stencil = *(u32*)pixel;
841 ((u32*)temp_fb_depth_data)[gl_px_idx] = (depth_stencil << 8) | (depth_stencil >> 24); 841 ((u32*)temp_fb_depth_data)[gl_pixel_index] = (depth_stencil << 8) | (depth_stencil >> 24);
842 } 842 }
843 } 843 }
844 } else { 844 } else {
@@ -846,10 +846,10 @@ void RasterizerOpenGL::ReloadDepthBuffer() {
846 for (int x = 0; x < fb_depth_texture.width; ++x) { 846 for (int x = 0; x < fb_depth_texture.width; ++x) {
847 const u32 coarse_y = y & ~7; 847 const u32 coarse_y = y & ~7;
848 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; 848 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel;
849 u32 gl_px_idx = (x + y * fb_depth_texture.width) * gl_bpp; 849 u32 gl_pixel_index = (x + y * fb_depth_texture.width) * gl_bpp;
850 850
851 u8* pixel = depth_buffer + dst_offset; 851 u8* pixel = depth_buffer + dst_offset;
852 memcpy(&temp_fb_depth_data[gl_px_idx], pixel, bytes_per_pixel); 852 memcpy(&temp_fb_depth_data[gl_pixel_index], pixel, bytes_per_pixel);
853 } 853 }
854 } 854 }
855 } 855 }
@@ -890,10 +890,10 @@ void RasterizerOpenGL::CommitColorBuffer() {
890 for (int x = 0; x < fb_color_texture.width; ++x) { 890 for (int x = 0; x < fb_color_texture.width; ++x) {
891 const u32 coarse_y = y & ~7; 891 const u32 coarse_y = y & ~7;
892 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel; 892 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel;
893 u32 gl_px_idx = x * bytes_per_pixel + y * fb_color_texture.width * bytes_per_pixel; 893 u32 gl_pixel_index = x * bytes_per_pixel + y * fb_color_texture.width * bytes_per_pixel;
894 894
895 u8* pixel = color_buffer + dst_offset; 895 u8* pixel = color_buffer + dst_offset;
896 memcpy(pixel, &temp_gl_color_buffer[gl_px_idx], bytes_per_pixel); 896 memcpy(pixel, &temp_gl_color_buffer[gl_pixel_index], bytes_per_pixel);
897 } 897 }
898 } 898 }
899 } 899 }
@@ -930,10 +930,10 @@ void RasterizerOpenGL::CommitDepthBuffer() {
930 for (int x = 0; x < fb_depth_texture.width; ++x) { 930 for (int x = 0; x < fb_depth_texture.width; ++x) {
931 const u32 coarse_y = y & ~7; 931 const u32 coarse_y = y & ~7;
932 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; 932 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel;
933 u32 gl_px_idx = (x + y * fb_depth_texture.width); 933 u32 gl_pixel_index = (x + y * fb_depth_texture.width);
934 934
935 u8* pixel = depth_buffer + dst_offset; 935 u8* pixel = depth_buffer + dst_offset;
936 u32 depth_stencil = ((u32*)temp_gl_depth_data)[gl_px_idx]; 936 u32 depth_stencil = ((u32*)temp_gl_depth_data)[gl_pixel_index];
937 *(u32*)pixel = (depth_stencil >> 8) | (depth_stencil << 24); 937 *(u32*)pixel = (depth_stencil >> 8) | (depth_stencil << 24);
938 } 938 }
939 } 939 }
@@ -942,10 +942,10 @@ void RasterizerOpenGL::CommitDepthBuffer() {
942 for (int x = 0; x < fb_depth_texture.width; ++x) { 942 for (int x = 0; x < fb_depth_texture.width; ++x) {
943 const u32 coarse_y = y & ~7; 943 const u32 coarse_y = y & ~7;
944 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; 944 u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel;
945 u32 gl_px_idx = (x + y * fb_depth_texture.width) * gl_bpp; 945 u32 gl_pixel_index = (x + y * fb_depth_texture.width) * gl_bpp;
946 946
947 u8* pixel = depth_buffer + dst_offset; 947 u8* pixel = depth_buffer + dst_offset;
948 memcpy(pixel, &temp_gl_depth_data[gl_px_idx], bytes_per_pixel); 948 memcpy(pixel, &temp_gl_depth_data[gl_pixel_index], bytes_per_pixel);
949 } 949 }
950 } 950 }
951 } 951 }
diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp
index 2305fb2cb..3526e16d5 100644
--- a/src/video_core/renderer_opengl/gl_state.cpp
+++ b/src/video_core/renderer_opengl/gl_state.cpp
@@ -84,10 +84,11 @@ void OpenGLState::Apply() {
84 84
85 // Color mask 85 // Color mask
86 if (color_mask.red_enabled != cur_state.color_mask.red_enabled || 86 if (color_mask.red_enabled != cur_state.color_mask.red_enabled ||
87 color_mask.green_enabled != cur_state.color_mask.green_enabled || 87 color_mask.green_enabled != cur_state.color_mask.green_enabled ||
88 color_mask.blue_enabled != cur_state.color_mask.blue_enabled || 88 color_mask.blue_enabled != cur_state.color_mask.blue_enabled ||
89 color_mask.alpha_enabled != cur_state.color_mask.alpha_enabled) { 89 color_mask.alpha_enabled != cur_state.color_mask.alpha_enabled) {
90 glColorMask(color_mask.red_enabled, color_mask.green_enabled, color_mask.blue_enabled, color_mask.alpha_enabled); 90 glColorMask(color_mask.red_enabled, color_mask.green_enabled,
91 color_mask.blue_enabled, color_mask.alpha_enabled);
91 } 92 }
92 93
93 // Stencil test 94 // Stencil test
@@ -100,8 +101,8 @@ void OpenGLState::Apply() {
100 } 101 }
101 102
102 if (stencil.test_func != cur_state.stencil.test_func || 103 if (stencil.test_func != cur_state.stencil.test_func ||
103 stencil.test_ref != cur_state.stencil.test_ref || 104 stencil.test_ref != cur_state.stencil.test_ref ||
104 stencil.test_mask != cur_state.stencil.test_mask) { 105 stencil.test_mask != cur_state.stencil.test_mask) {
105 glStencilFunc(stencil.test_func, stencil.test_ref, stencil.test_mask); 106 glStencilFunc(stencil.test_func, stencil.test_ref, stencil.test_mask);
106 } 107 }
107 108
@@ -125,17 +126,19 @@ void OpenGLState::Apply() {
125 } 126 }
126 127
127 if (blend.color.red != cur_state.blend.color.red || 128 if (blend.color.red != cur_state.blend.color.red ||
128 blend.color.green != cur_state.blend.color.green || 129 blend.color.green != cur_state.blend.color.green ||
129 blend.color.blue != cur_state.blend.color.blue || 130 blend.color.blue != cur_state.blend.color.blue ||
130 blend.color.alpha != cur_state.blend.color.alpha) { 131 blend.color.alpha != cur_state.blend.color.alpha) {
131 glBlendColor(blend.color.red, blend.color.green, blend.color.blue, blend.color.alpha); 132 glBlendColor(blend.color.red, blend.color.green,
133 blend.color.blue, blend.color.alpha);
132 } 134 }
133 135
134 if (blend.src_rgb_func != cur_state.blend.src_rgb_func || 136 if (blend.src_rgb_func != cur_state.blend.src_rgb_func ||
135 blend.dst_rgb_func != cur_state.blend.dst_rgb_func || 137 blend.dst_rgb_func != cur_state.blend.dst_rgb_func ||
136 blend.src_a_func != cur_state.blend.src_a_func || 138 blend.src_a_func != cur_state.blend.src_a_func ||
137 blend.dst_a_func != cur_state.blend.dst_a_func) { 139 blend.dst_a_func != cur_state.blend.dst_a_func) {
138 glBlendFuncSeparate(blend.src_rgb_func, blend.dst_rgb_func, blend.src_a_func, blend.dst_a_func); 140 glBlendFuncSeparate(blend.src_rgb_func, blend.dst_rgb_func,
141 blend.src_a_func, blend.dst_a_func);
139 } 142 }
140 143
141 if (logic_op != cur_state.logic_op) { 144 if (logic_op != cur_state.logic_op) {