DXGL r925 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r924‎ | r925 | r926 >
Date:22:47, 13 May 2019
Author:admin
Status:new
Tags:
Comment:
Sample packed YUV formats at the middle of the pixel (fixes VMWare SVGA3D).
When failing creation of DDraw 1/2/4 surface set return to NULL.
Modified paths:
  • /ddraw/ShaderGen2D.cpp (modified) (history)
  • /ddraw/glDirectDraw.cpp (modified) (history)

Diff [purge]

Index: ddraw/ShaderGen2D.cpp
@@ -207,41 +207,41 @@
208208 static const char func_readrgbg_nearest[] =
209209 "vec4 readrgbg(sampler2DRect texture)\n\
210210 {\n\
211 - float x = floor(gl_TexCoord[0].s);\n\
212 - float y = floor(gl_TexCoord[0].t);\n\
213 - float x2 = floor(gl_TexCoord[0].s/2.0)*2.0;\n\
 211+ float x = floor(gl_TexCoord[0].s)+0.5;\n\
 212+ float y = floor(gl_TexCoord[0].t)+0.5;\n\
 213+ float x2 = (floor(gl_TexCoord[0].s/2.0)*2.0)+0.5;\n\
214214 return vec4(texture2DRect(texture,vec2(x2,y)).r,texture2DRect(texture,vec2(x,y)).g,texture2DRect(texture,vec2(x2+1.0,y)).r,1.0);\n\
215215 }\n\n";
216216 static const char func_readgrgb_nearest[] =
217217 "vec4 readgrgb(sampler2DRect texture)\n\
218218 {\n\
219 - float x = floor(gl_TexCoord[0].s);\n\
220 - float y = floor(gl_TexCoord[0].t);\n\
221 - float x2 = floor(gl_TexCoord[0].s/2.0)*2.0;\n\
 219+ float x = floor(gl_TexCoord[0].s)+0.5;\n\
 220+ float y = floor(gl_TexCoord[0].t)+0.5;\n\
 221+ float x2 = (floor(gl_TexCoord[0].s/2.0)*2.0)+0.5;\n\
222222 return vec4(texture2DRect(texture,vec2(x2,y)).g,texture2DRect(texture,vec2(x,y)).r,texture2DRect(texture,vec2(x2+1.0,y)).g,1.0);\n\
223223 }\n\n";
224224 static const char func_readuyvy_nearest[] =
225225 "vec4 readuyvy(sampler2DRect texture)\n\
226226 {\n\
227 - float x = floor(gl_TexCoord[0].s);\n\
228 - float y = floor(gl_TexCoord[0].t);\n\
229 - float x2 = floor(gl_TexCoord[0].s/2.0)*2.0;\n\
 227+ float x = floor(gl_TexCoord[0].s)+0.5;\n\
 228+ float y = floor(gl_TexCoord[0].t)+0.5;\n\
 229+ float x2 = (floor(gl_TexCoord[0].s/2.0)*2.0)+0.5;\n\
230230 return vec4(texture2DRect(texture,vec2(x,y)).g,texture2DRect(texture,vec2(x2,y)).r,texture2DRect(texture,vec2(x2+1.0,y)).r,1.0);\n\
231231 }\n\n";
232232 static const char func_readyuyv_nearest[] =
233233 "vec4 readyuyv(sampler2DRect texture)\n\
234234 {\n\
235 - float x = floor(gl_TexCoord[0].s);\n\
236 - float y = floor(gl_TexCoord[0].t);\n\
237 - float x2 = floor(gl_TexCoord[0].s/2.0)*2.0;\n\
 235+ float x = floor(gl_TexCoord[0].s)+0.5;\n\
 236+ float y = floor(gl_TexCoord[0].t)+0.5;\n\
 237+ float x2 = (floor(gl_TexCoord[0].s/2.0)*2.0)+0.5;\n\
238238 return vec4(texture2DRect(texture,vec2(x,y)).r,texture2DRect(texture,vec2(x2,y)).g,texture2DRect(texture,vec2(x2+1.0,y)).g,1.0);\n\
239239 }\n\n";
240240 static const char func_readyvyu_nearest[] =
241241 "vec4 readyvyu(sampler2DRect texture)\n\
242242 {\n\
243 - float x = floor(gl_TexCoord[0].s);\n\
244 - float y = floor(gl_TexCoord[0].t);\n\
245 - float x2 = floor(gl_TexCoord[0].s/2.0)*2.0;\n\
 243+ float x = floor(gl_TexCoord[0].s)+0.5;\n\
 244+ float y = floor(gl_TexCoord[0].t)+0.5;\n\
 245+ float x2 = (floor(gl_TexCoord[0].s/2.0)*2.0)+0.5;\n\
246246 return vec4(texture2DRect(texture,vec2(x,y)).r,texture2DRect(texture,vec2(x2+1.0,y)).g,texture2DRect(texture,vec2(x2,y)).g,1.0);\n\
247247 }\n\n";
248248
Index: ddraw/glDirectDraw.cpp
@@ -2803,6 +2803,7 @@
28042804 TRACE_EXIT(23,DD_OK);
28052805 return DD_OK;
28062806 }
 2807+ else *lplpDDSurface = NULL;
28072808 TRACE_EXIT(23,err);
28082809 return err;
28092810 }
@@ -3008,6 +3009,7 @@
30093010 TRACE_EXIT(23, DD_OK);
30103011 return DD_OK;
30113012 }
 3013+ else *lplpDDSurface = NULL;
30123014 TRACE_EXIT(23,err);
30133015 return err;
30143016 }
@@ -3240,6 +3242,7 @@
32413243 TRACE_EXIT(23, DD_OK);
32423244 return DD_OK;
32433245 }
 3246+ else *lplpDDSurface = NULL;
32443247 TRACE_EXIT(23,err);
32453248 return err;
32463249 }