http://bugs.winehq.org/show_bug.cgi?id=6153
------- Additional Comments From wine@kapila.force9.co.uk 2006-11-09 15:17 ------- I think the wrong developer has been added - the issue was not caused by bc66d7edde877877ef7f601926520fc2e3209a43 but by bc449ca31fbd4a97ef1a06cabbfb2787e2ea6ca1 (first one was a red herring). Developer should be Author: Stefan Dösinger stefan@codeweavers.com I think.
Been working on identifying what breaks it. This change breaks it.
@@ -763,7 +773,8 @@ static VOID IWineD3DVertexShaderImpl_Gen
shader_generate_arb_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION);
/* We need the projection matrix to correctly render upside-down objects (render to texture) */
- shader_addline(&buffer, "PARAM PROJECTION = state.matrix.projection.row[1];\n");
+ shader_addline(&buffer, "PARAM PROJECTIONX = state.matrix.projection.row[0];\n");
+ shader_addline(&buffer, "PARAM PROJECTIONY = state.matrix.projection.row[1];\n");
AND this one
@@ -777,11 +788,21 @@ static VOID IWineD3DVertexShaderImpl_Gen
if (reg_maps->fog)
shader_addline(&buffer, "MAX result.fogcoord, TMP_FOG, 0.0;\n");
- /* Write the final position.
- * Account for any inverted textures (render to texture case) by reversing the y coordinate
- * (this is handled in drawPrim() when it sets the MODELVIEW and PROJECTION matrices) */
shader_addline(&buffer, "MOV result.position, TMP_OUT;\n");
- shader_addline(&buffer, "MUL result.position.y, TMP_OUT.y, PROJECTION.y;\n");
+ /* Write the final position.
+ *
+ * OpenGL coordinates specify the center of the pixel while d3d coords specify
+ * the corner. For that reason a translation is done with the projection matrix,
+ * which sets the offsets to move in the w coords of the matrix(see glTranslate manpage)
+ * Add the w coordinates to x and y, this avoids the need for a full matrix
+ * multiplication. The matrix is set up in drawprim.c, primitiveInitState.
+ */
+ shader_addline(&buffer, "ADD result.position.x, TMP_OUT.x, PROJECTIONX.w;\n");
+ shader_addline(&buffer, "ADD result.position.y, TMP_OUT.y, PROJECTIONY.w;\n");
+ /* Account for any inverted textures (render to texture case) by reversing the y coordinate
+ * (this is handled in drawPrim() when it sets the MODELVIEW and PROJECTION matrices)
+ */
+ shader_addline(&buffer, "MUL result.position.y, TMP_OUT.y, PROJECTIONY.y;\n");
When not working, Im now getting the following errors as well.
fixme:d3d_draw:drawStridedFast >>>>>>>>>>>>>>>>> 502 from glDrawRangeElements @ drawprim.c / 1253