Changeset 48073 in vbox for trunk/src/VBox/Additions/WINNT
- Timestamp:
- Aug 26, 2013 9:24:22 PM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine_new
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/d3d9/device.c
r47486 r48073 988 988 resource = wined3d_texture_get_sub_resource(object->wined3d_texture, 0); 989 989 surface = wined3d_resource_get_parent(resource); 990 wined3d_surface_set_mem(surface->wined3d_surface, *shared_handle );990 wined3d_surface_set_mem(surface->wined3d_surface, *shared_handle, 0); 991 991 } 992 992 -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/vbox/libWineStub/include/wine/port.h
r46521 r48073 237 237 #endif 238 238 239 #ifndef HAVE_GETOPT_LONG 239 #ifndef HAVE_GETOPT_LONG_ONLY 240 240 extern char *optarg; 241 241 extern int optind; … … 260 260 const char *__shortopts, 261 261 const struct option *__longopts, int *__longind); 262 #endif /* HAVE_GETOPT_LONG */262 #endif /* HAVE_GETOPT_LONG_ONLY */ 263 263 264 264 #ifndef HAVE_FFS -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/vbox/libWineStub/include/wine/wined3d.h
r46966 r48073 2363 2363 HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface, 2364 2364 DWORD flags, const struct wined3d_color_key *color_key); 2365 HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem );2365 HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem, UINT pitch); 2366 2366 HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y); 2367 2367 void __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/arb_program_shader.c
r46521 r48073 40 40 WINE_DECLARE_DEBUG_CHANNEL(d3d); 41 41 42 /* sRGB correction constants */ 43 static const float srgb_cmp = 0.0031308f; 44 static const float srgb_mul_low = 12.92f; 45 static const float srgb_pow = 0.41666f; 46 static const float srgb_mul_high = 1.055f; 47 static const float srgb_sub_high = 0.055f; 48 42 49 static BOOL shader_is_pshader_version(enum wined3d_shader_type type) 43 50 { … … 272 279 unsigned int num_loops, loop_depth, num_ifcs; 273 280 int aL; 281 BOOL ps_post_process; 274 282 275 283 unsigned int vs_clipplanes; … … 1154 1162 1155 1163 case WINED3DSPR_COLOROUT: 1156 if (ctx-> cur_ps_args->super.srgb_correction&& !reg->idx[0].offset)1164 if (ctx->ps_post_process && !reg->idx[0].offset) 1157 1165 { 1158 1166 strcpy(register_name, "TMP_COLOR"); … … 1623 1631 shader_arb_get_src_param(ins, &ins->src[1], 1, src_name[1]); 1624 1632 1625 /* The coissue flag changes the semantic of the cnd instruction in <= 1.3 shaders */1626 if (shader_version <= WINED3D_SHADER_VERSION(1, 3) && ins->coissue)1633 if (shader_version <= WINED3D_SHADER_VERSION(1, 3) && ins->coissue 1634 && ins->dst->write_mask != WINED3DSP_WRITEMASK_3) 1627 1635 { 1628 1636 shader_addline(buffer, "MOV%s %s, %s;\n", shader_arb_get_modifier(ins), dst_name, src_name[1]); … … 1844 1852 else if (ins->dst[0].reg.type == WINED3DSPR_COLOROUT && !ins->dst[0].reg.idx[0].offset && pshader) 1845 1853 { 1846 if (ctx-> cur_ps_args->super.srgb_correction&& shader->u.ps.color0_mov)1847 { 1848 shader_addline(buffer, "#mov handled in srgb write code\n");1854 if (ctx->ps_post_process && shader->u.ps.color0_mov) 1855 { 1856 shader_addline(buffer, "#mov handled in srgb write or fog code\n"); 1849 1857 return; 1850 1858 } … … 3553 3561 } 3554 3562 3563 static void arbfp_add_linear_fog(struct wined3d_shader_buffer *buffer, 3564 const char *fragcolor, const char *tmp) 3565 { 3566 shader_addline(buffer, "SUB %s.x, state.fog.params.z, fragment.fogcoord.x;\n", tmp); 3567 shader_addline(buffer, "MUL_SAT %s.x, %s.x, state.fog.params.w;\n", tmp, tmp); 3568 shader_addline(buffer, "LRP %s.rgb, %s.x, %s, state.fog.color;\n", fragcolor, tmp, fragcolor); 3569 } 3570 3555 3571 /* Context activation is done by the caller. */ 3556 3572 static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader, … … 3569 3585 GLint errPos; 3570 3586 DWORD map; 3587 BOOL custom_linear_fog = FALSE; 3571 3588 3572 3589 char srgbtmp[4][4]; … … 3616 3633 init_ps_input(shader, args, &priv_ctx); 3617 3634 list_init(&priv_ctx.control_frames); 3635 priv_ctx.ps_post_process = args->super.srgb_correction; 3618 3636 3619 3637 /* Avoid enabling NV_fragment_program* if we do not need it. … … 3668 3686 break; 3669 3687 case WINED3D_FFP_PS_FOG_LINEAR: 3688 if (gl_info->quirks & WINED3D_QUIRK_BROKEN_ARB_FOG) 3689 { 3690 custom_linear_fog = TRUE; 3691 priv_ctx.ps_post_process = TRUE; 3692 break; 3693 } 3670 3694 shader_addline(buffer, "OPTION ARB_fog_linear;\n"); 3671 3695 break; … … 3697 3721 else 3698 3722 { 3699 if ( args->super.srgb_correction)3723 if (priv_ctx.ps_post_process) 3700 3724 { 3701 3725 if (shader->u.ps.color0_mov) … … 3847 3871 priv_ctx.target_version >= NV2); 3848 3872 } 3873 3874 if (custom_linear_fog) 3875 arbfp_add_linear_fog(buffer, fragcolor, "TA"); 3849 3876 3850 3877 if(strcmp(fragcolor, "result.color")) { … … 6141 6168 const char *final_combiner_src = "ret"; 6142 6169 GLint pos; 6170 BOOL custom_linear_fog = FALSE; 6143 6171 6144 6172 /* Find out which textures are read */ … … 6213 6241 { 6214 6242 case WINED3D_FFP_PS_FOG_OFF: break; 6215 case WINED3D_FFP_PS_FOG_LINEAR: shader_addline(&buffer, "OPTION ARB_fog_linear;\n"); break; 6243 case WINED3D_FFP_PS_FOG_LINEAR: 6244 if (gl_info->quirks & WINED3D_QUIRK_BROKEN_ARB_FOG) 6245 { 6246 custom_linear_fog = TRUE; 6247 break; 6248 } 6249 shader_addline(&buffer, "OPTION ARB_fog_linear;\n"); 6250 break; 6251 6216 6252 case WINED3D_FFP_PS_FOG_EXP: shader_addline(&buffer, "OPTION ARB_fog_exp;\n"); break; 6217 6253 case WINED3D_FFP_PS_FOG_EXP2: shader_addline(&buffer, "OPTION ARB_fog_exp2;\n"); break; … … 6378 6414 } 6379 6415 6380 if(settings->sRGB_write) { 6416 if (settings->sRGB_write || custom_linear_fog) 6417 { 6381 6418 shader_addline(&buffer, "MAD ret, fragment.color.secondary, specular_enable, %s;\n", final_combiner_src); 6419 if (settings->sRGB_write) 6382 6420 arbfp_add_sRGB_correction(&buffer, "ret", "arg0", "arg1", "arg2", "tempreg", FALSE); 6421 if (custom_linear_fog) 6422 arbfp_add_linear_fog(&buffer, "ret", "arg0"); 6383 6423 shader_addline(&buffer, "MOV result.color, ret;\n"); 6384 } else { 6385 shader_addline(&buffer, "MAD result.color, fragment.color.secondary, specular_enable, %s;\n", final_combiner_src); 6424 } 6425 else 6426 { 6427 shader_addline(&buffer, "MAD result.color, fragment.color.secondary, specular_enable, %s;\n", 6428 final_combiner_src); 6386 6429 } 6387 6430 … … 6507 6550 { 6508 6551 enum fogsource new_source; 6552 DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART]; 6553 DWORD fogend = state->render_states[WINED3D_RS_FOGEND]; 6509 6554 6510 6555 TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); … … 6535 6580 } 6536 6581 6537 if (new_source != context->fog_source )6582 if (new_source != context->fog_source || fogstart == fogend) 6538 6583 { 6539 6584 context->fog_source = new_source; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/buffer.c
r46521 r48073 298 298 299 299 static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct wined3d_stream_info *si, 300 UINT attrib_idx, const BOOL check_d3dcolor, const BOOL is_ffp_position, const BOOL is_ffp_color,300 UINT attrib_idx, const BOOL check_d3dcolor, const BOOL check_position, const BOOL is_ffp_color, 301 301 DWORD *stride_this_run 302 302 #ifdef VBOX_WITH_WINE_FIX_BUFOFFSET … … 328 328 if (!is_ffp_color) FIXME("Test for non-color fixed function WINED3DFMT_B8G8R8A8_UNORM format\n"); 329 329 } 330 else if ( is_ffp_position && si->position_transformed)330 else if (check_position && si->position_transformed) 331 331 { 332 332 if (format != WINED3DFMT_R32G32B32A32_FLOAT) … … 357 357 { 358 358 struct wined3d_device *device = This->resource.device; 359 const struct wined3d_ gl_info *gl_info = &device->adapter->gl_info;359 const struct wined3d_adapter *adapter = device->adapter; 360 360 const struct wined3d_stream_info *si = &device->stream_info; 361 361 const struct wined3d_state *state = &device->stateBlock->state; 362 BOOL support_d3dcolor = adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA]; 363 BOOL support_xyzrhw = adapter->d3d_info.xyzrhw; 362 364 UINT stride_this_run = 0; 363 365 #ifdef VBOX_WITH_WINE_FIX_BUFOFFSET … … 365 367 #endif 366 368 BOOL ret = FALSE; 367 BOOL support_d3dcolor = gl_info->supported[ARB_VERTEX_ARRAY_BGRA];368 369 369 370 /* In d3d7 the vertex buffer declaration NEVER changes because it is stored in the d3d7 vertex buffer. … … 437 438 438 439 ret = buffer_check_attribute(This, si, WINED3D_FFP_POSITION, 439 TRUE, TRUE, FALSE, &stride_this_run440 TRUE, !support_xyzrhw, FALSE, &stride_this_run 440 441 #ifdef VBOX_WITH_WINE_FIX_BUFOFFSET 441 442 , &offset_this_run -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/device.c
r46966 r48073 341 341 & ((1 << WINED3D_FFP_DIFFUSE) | (1 << WINED3D_FFP_SPECULAR)); 342 342 343 if (( stream_info->position_transformed || (stream_info->use_map & slow_mask)) && !stream_info->all_vbo)344 {343 if (((stream_info->position_transformed && !device->adapter->d3d_info.xyzrhw) 344 || (stream_info->use_map & slow_mask)) && !stream_info->all_vbo) 345 345 device->useDrawStridedSlow = TRUE; 346 }347 346 else 348 {349 347 device->useDrawStridedSlow = FALSE; 350 348 } 351 }352 349 353 350 if (prev_all_vbo != stream_info->all_vbo) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/directx.c
r46593 r48073 813 813 } 814 814 815 static BOOL match_broken_arb_fog(const struct wined3d_gl_info *gl_info, const char *gl_renderer, 816 enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device) 817 { 818 DWORD data[4]; 819 GLuint tex, fbo; 820 GLenum status; 821 float color[4] = {0.0f, 1.0f, 0.0f, 0.0f}; 822 GLuint prog; 823 GLint err_pos; 824 static const char *program_code = 825 "!!ARBfp1.0\n" 826 "OPTION ARB_fog_linear;\n" 827 "MOV result.color, {1.0, 0.0, 0.0, 0.0};\n" 828 "END\n"; 829 830 if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) 831 return FALSE; 832 if (!gl_info->supported[ARB_FRAGMENT_PROGRAM]) 833 return FALSE; 834 835 gl_info->gl_ops.gl.p_glGenTextures(1, &tex); 836 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, tex); 837 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 838 gl_info->gl_ops.gl.p_glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 839 gl_info->gl_ops.gl.p_glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 4, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, NULL); 840 checkGLcall("glTexImage2D"); 841 842 gl_info->fbo_ops.glGenFramebuffers(1, &fbo); 843 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, fbo); 844 gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex, 0); 845 checkGLcall("glFramebufferTexture2D"); 846 847 status = gl_info->fbo_ops.glCheckFramebufferStatus(GL_FRAMEBUFFER); 848 if (status != GL_FRAMEBUFFER_COMPLETE) ERR("FBO status %#x\n", status); 849 checkGLcall("glCheckFramebufferStatus"); 850 851 gl_info->gl_ops.gl.p_glClearColor(0.0f, 0.0f, 1.0f, 0.0f); 852 gl_info->gl_ops.gl.p_glClear(GL_COLOR_BUFFER_BIT); 853 checkGLcall("glClear"); 854 gl_info->gl_ops.gl.p_glViewport(0, 0, 4, 1); 855 checkGLcall("glViewport"); 856 857 gl_info->gl_ops.gl.p_glEnable(GL_FOG); 858 gl_info->gl_ops.gl.p_glFogf(GL_FOG_START, 0.5f); 859 gl_info->gl_ops.gl.p_glFogf(GL_FOG_END, 0.5f); 860 gl_info->gl_ops.gl.p_glFogi(GL_FOG_MODE, GL_LINEAR); 861 gl_info->gl_ops.gl.p_glHint(GL_FOG_HINT, GL_NICEST); 862 gl_info->gl_ops.gl.p_glFogfv(GL_FOG_COLOR, color); 863 checkGLcall("fog setup"); 864 865 GL_EXTCALL(glGenProgramsARB(1, &prog)); 866 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog)); 867 GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, 868 strlen(program_code), program_code)); 869 gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB); 870 checkGLcall("Test fragment program setup"); 871 872 gl_info->gl_ops.gl.p_glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &err_pos); 873 if (err_pos != -1) 874 { 875 const char *error_str; 876 error_str = (const char *)gl_info->gl_ops.gl.p_glGetString(GL_PROGRAM_ERROR_STRING_ARB); 877 FIXME("Fog test program error at position %d: %s\n\n", err_pos, debugstr_a(error_str)); 878 } 879 880 gl_info->gl_ops.gl.p_glBegin(GL_TRIANGLE_STRIP); 881 gl_info->gl_ops.gl.p_glVertex3f(-1.0f, -1.0f, 0.0f); 882 gl_info->gl_ops.gl.p_glVertex3f( 1.0f, -1.0f, 1.0f); 883 gl_info->gl_ops.gl.p_glVertex3f(-1.0f, 1.0f, 0.0f); 884 gl_info->gl_ops.gl.p_glVertex3f( 1.0f, 1.0f, 1.0f); 885 gl_info->gl_ops.gl.p_glEnd(); 886 checkGLcall("ARBfp fog test draw"); 887 888 gl_info->gl_ops.gl.p_glGetTexImage(GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data); 889 checkGLcall("glGetTexImage"); 890 data[0] &= 0x00ffffff; 891 data[1] &= 0x00ffffff; 892 data[2] &= 0x00ffffff; 893 data[3] &= 0x00ffffff; 894 895 gl_info->fbo_ops.glBindFramebuffer(GL_FRAMEBUFFER, 0); 896 gl_info->gl_ops.gl.p_glBindTexture(GL_TEXTURE_2D, 0); 897 898 gl_info->fbo_ops.glDeleteFramebuffers(1, &fbo); 899 gl_info->gl_ops.gl.p_glDeleteTextures(1, &tex); 900 gl_info->gl_ops.gl.p_glDisable(GL_FOG); 901 GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0)); 902 gl_info->gl_ops.gl.p_glDisable(GL_FRAGMENT_PROGRAM_ARB); 903 GL_EXTCALL(glDeleteProgramsARB(1, &prog)); 904 checkGLcall("ARBfp fog test teardown"); 905 906 TRACE("Fog test data: %08x %08x %08x %08x\n", data[0], data[1], data[2], data[3]); 907 return data[0] != 0x00ff0000 || data[3] != 0x0000ff00; 908 } 909 815 910 static void quirk_apple_glsl_constants(struct wined3d_gl_info *gl_info) 816 911 { … … 936 1031 } 937 1032 1033 static void quirk_broken_arb_fog(struct wined3d_gl_info *gl_info) 1034 { 1035 gl_info->quirks |= WINED3D_QUIRK_BROKEN_ARB_FOG; 1036 } 1037 938 1038 #ifdef VBOX_WITH_WINE_FIX_QUIRKS 939 1039 static BOOL match_ati_hd4800(const struct wined3d_gl_info *gl_info, const char *gl_renderer, … … 1070 1170 quirk_r200_constants, 1071 1171 "r200 vertex shader constants" 1172 }, 1173 { 1174 match_broken_arb_fog, 1175 quirk_broken_arb_fog, 1176 "ARBfp fogstart == fogend workaround" 1072 1177 }, 1073 1178 #ifdef VBOX_WITH_WINE_FIX_QUIRKS … … 1254 1359 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660TI, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE6, 2048}, 1255 1360 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE6, 2048}, 1361 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670MX, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE6, 3072}, 1256 1362 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX680, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE6, 2048}, 1363 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX770M, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE6, 3072}, 1257 1364 1258 1365 /* AMD cards */ … … 1665 1772 cards[] = 1666 1773 { 1774 {"GTX 770M", CARD_NVIDIA_GEFORCE_GTX770M}, /* Geforce 700 - midend high mobile */ 1667 1775 {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680}, /* Geforce 600 - highend */ 1776 {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX}, /* Geforce 600 - highend */ 1668 1777 {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670}, /* Geforce 600 - midend high */ 1669 1778 {"GTX 660 Ti", CARD_NVIDIA_GEFORCE_GTX660TI}, /* Geforce 600 - midend high */ … … 2164 2273 { 2165 2274 /* Kepler */ 2275 {"NVE6", CARD_NVIDIA_GEFORCE_GTX770M}, 2166 2276 {"NVE4", CARD_NVIDIA_GEFORCE_GTX680}, 2167 2277 /* Fermi */ … … 2790 2900 const char *gl_vendor_str, *gl_renderer_str, *gl_version_str; 2791 2901 struct wined3d_gl_info *gl_info = &adapter->gl_info; 2902 struct wined3d_vertex_caps vertex_caps; 2792 2903 enum wined3d_pci_vendor card_vendor; 2793 2904 struct fragment_caps fragment_caps; … … 3019 3130 adapter->d3d_info.limits.vs_uniform_count = shader_caps.vs_uniform_count; 3020 3131 adapter->d3d_info.limits.ps_uniform_count = shader_caps.ps_uniform_count; 3132 3133 adapter->vertex_pipe->vp_get_caps(gl_info, &vertex_caps); 3134 adapter->d3d_info.xyzrhw = vertex_caps.xyzrhw; 3021 3135 3022 3136 adapter->fragment_pipe->get_caps(gl_info, &fragment_caps); … … 4870 4984 } 4871 4985 4872 static void fillGLAttribFuncs(const struct wined3d_gl_info *gl_info) 4873 { 4986 static void wined3d_adapter_init_ffp_attrib_ops(const struct wined3d_adapter *adapter) 4987 { 4988 const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info; 4989 const struct wined3d_gl_info *gl_info = &adapter->gl_info; 4990 4874 4991 position_funcs[WINED3D_FFP_EMIT_FLOAT1] = invalid_func; 4875 4992 position_funcs[WINED3D_FFP_EMIT_FLOAT2] = invalid_func; 4876 4993 position_funcs[WINED3D_FFP_EMIT_FLOAT3] = (glAttribFunc)gl_info->gl_ops.gl.p_glVertex3fv; 4994 if (!d3d_info->xyzrhw) 4877 4995 position_funcs[WINED3D_FFP_EMIT_FLOAT4] = position_float4; 4996 else 4997 position_funcs[WINED3D_FFP_EMIT_FLOAT4] = (glAttribFunc)gl_info->gl_ops.gl.p_glVertex4fv; 4878 4998 position_funcs[WINED3D_FFP_EMIT_D3DCOLOR] = position_d3dcolor; 4879 4999 position_funcs[WINED3D_FFP_EMIT_UBYTE4] = invalid_func; … … 5297 5417 WineD3D_ReleaseFakeGLContext(&fake_gl_ctx); 5298 5418 5299 fillGLAttribFuncs(&adapter->gl_info);5419 wined3d_adapter_init_ffp_attrib_ops(adapter); 5300 5420 5301 5421 #ifdef VBOX_WITH_WDDM -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/glsl_shader.c
r47061 r48073 38 38 #include "wined3d_private.h" 39 39 40 #if defined(VBOX) && defined(RT_ARCH_AMD64) 41 # define copysignf _copysignf 42 #endif 43 40 44 WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); 41 45 WINE_DECLARE_DEBUG_CHANNEL(d3d_constants); … … 47 51 #define WINED3D_GLSL_SAMPLE_LOD 0x4 48 52 #define WINED3D_GLSL_SAMPLE_GRAD 0x8 53 54 static const float srgb_const0[] = {0.41666f, 1.055f, 0.055f, 12.92f}; /* pow, mul_high, sub_high, mul_low */ 55 static const float srgb_const1[] = {0.0031308f, 0.0f, 0.0f, 0.0f}; /* cmp */ 49 56 50 57 struct glsl_dst_param … … 241 248 return "unknown"; 242 249 } 250 } 251 252 /* This should be equivalent to using the %.8e format specifier, but always 253 * using '.' as decimal separator. This doesn't handle +/-INF or NAN, since 254 * the GLSL parser wouldn't be able to handle those anyway. */ 255 static void shader_glsl_ftoa(float value, char *s) 256 { 257 int x, frac, exponent; 258 const char *sign = ""; 259 double d; 260 261 d = value; 262 #if defined(VBOX) && !defined(RT_ARCH_AMD64) 263 if (value < 0.0f) 264 #else 265 if (copysignf(1.0f, value) < 0.0f) 266 #endif 267 { 268 d = -d; 269 sign = "-"; 270 } 271 272 if (d == 0.0f) 273 { 274 x = 0; 275 frac = 0; 276 exponent = 0; 277 } 278 else 279 { 280 double t, diff; 281 282 exponent = floorf(log10f(d)); 283 d /= pow(10.0, exponent); 284 285 x = d; 286 t = (d - x) * 100000000; 287 frac = t; 288 diff = t - frac; 289 290 if ((diff > 0.5) || (diff == 0.5 && (frac & 1))) 291 { 292 if (++frac >= 100000000) 293 { 294 frac = 0; 295 ++x; 296 } 297 } 298 } 299 300 sprintf(s, "%s%d.%08de%+03d", sign, x, frac, exponent); 301 } 302 303 static void shader_glsl_append_imm_vec4(struct wined3d_shader_buffer *buffer, const float *values) 304 { 305 char str[4][16]; 306 307 shader_glsl_ftoa(values[0], str[0]); 308 shader_glsl_ftoa(values[1], str[1]); 309 shader_glsl_ftoa(values[2], str[2]); 310 shader_glsl_ftoa(values[3], str[3]); 311 shader_addline(buffer, "vec4(%s, %s, %s, %s)", str[0], str[1], str[2], str[3]); 243 312 } 244 313 … … 1207 1276 if (ps_args->srgb_correction) 1208 1277 { 1209 shader_addline(buffer, "const vec4 srgb_const0 = vec4(%.8e, %.8e, %.8e, %.8e);\n", 1210 srgb_pow, srgb_mul_high, srgb_sub_high, srgb_mul_low); 1211 shader_addline(buffer, "const vec4 srgb_const1 = vec4(%.8e, 0.0, 0.0, 0.0);\n", 1212 srgb_cmp); 1278 shader_addline(buffer, "const vec4 srgb_const0 = "); 1279 shader_glsl_append_imm_vec4(buffer, srgb_const0); 1280 shader_addline(buffer, ";\n"); 1281 shader_addline(buffer, "const vec4 srgb_const1 = "); 1282 shader_glsl_append_imm_vec4(buffer, srgb_const1); 1283 shader_addline(buffer, ";\n"); 1213 1284 } 1214 1285 if (reg_maps->vpos || reg_maps->usesdsy) … … 1222 1293 else 1223 1294 { 1224 /* This happens because we do not have proper tracking of the constant registers that are 1225 * actually used, only the max limit of the shader version 1226 */ 1295 float ycorrection[] = 1296 { 1297 context->render_offscreen ? 0.0f : fb->render_targets[0]->resource.height, 1298 context->render_offscreen ? 1.0f : -1.0f, 1299 0.0f, 1300 0.0f, 1301 }; 1302 1303 /* This happens because we do not have proper tracking of the 1304 * constant registers that are actually used, only the max 1305 * limit of the shader version. */ 1227 1306 FIXME("Cannot find a free uniform for vpos correction params\n"); 1228 shader_addline(buffer, "const vec4 ycorrection = vec4(%f, %f, 0.0, 0.0);\n",1229 context->render_offscreen ? 0.0f : fb->render_targets[0]->resource.height,1230 context->render_offscreen ? 1.0f : -1.0f);1307 shader_addline(buffer, "const vec4 ycorrection = "); 1308 shader_glsl_append_imm_vec4(buffer, ycorrection); 1309 shader_addline(buffer, ";\n"); 1231 1310 } 1232 1311 shader_addline(buffer, "vec4 vpos;\n"); … … 1262 1341 LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry) 1263 1342 { 1264 const float *value; 1265 value = (const float *)lconst->value; 1266 shader_addline(buffer, "const vec4 %s_lc%u = vec4(%.8e, %.8e, %.8e, %.8e);\n", 1267 prefix, lconst->idx, value[0], value[1], value[2], value[3]); 1343 shader_addline(buffer, "const vec4 %s_lc%u = ", prefix, lconst->idx); 1344 shader_glsl_append_imm_vec4(buffer, (const float *)lconst->value); 1345 shader_addline(buffer, ";\n"); 1268 1346 } 1269 1347 } … … 1389 1467 const char *prefix = shader_glsl_get_prefix(version->type); 1390 1468 struct glsl_src_param rel_param0, rel_param1; 1469 char imm_str[4][16]; 1391 1470 1392 1471 if (reg->idx[0].offset != ~0U && reg->idx[0].rel_addr) … … 1584 1663 { 1585 1664 case WINED3D_DATA_FLOAT: 1586 s printf(register_name, "%.8e", *(const float *)reg->immconst_data);1665 shader_glsl_ftoa(*(const float *)reg->immconst_data, register_name); 1587 1666 break; 1588 1667 case WINED3D_DATA_INT: … … 1604 1683 { 1605 1684 case WINED3D_DATA_FLOAT: 1606 sprintf(register_name, "vec4(%.8e, %.8e, %.8e, %.8e)", 1607 *(const float *)®->immconst_data[0], *(const float *)®->immconst_data[1], 1608 *(const float *)®->immconst_data[2], *(const float *)®->immconst_data[3]); 1685 shader_glsl_ftoa(*(const float *)®->immconst_data[0], imm_str[0]); 1686 shader_glsl_ftoa(*(const float *)®->immconst_data[1], imm_str[1]); 1687 shader_glsl_ftoa(*(const float *)®->immconst_data[2], imm_str[2]); 1688 shader_glsl_ftoa(*(const float *)®->immconst_data[3], imm_str[3]); 1689 sprintf(register_name, "vec4(%s, %s, %s, %s)", 1690 imm_str[0], imm_str[1], imm_str[2], imm_str[3]); 1609 1691 break; 1610 1692 case WINED3D_DATA_INT: … … 2956 3038 shader_glsl_add_src_param(ins, &ins->src[2], write_mask, &src2_param); 2957 3039 2958 /* Fun: The D3DSI_COISSUE flag changes the semantic of the cnd instruction for < 1.4 shaders */ 2959 if (ins->coissue) 2960 { 3040 if (ins->coissue && ins->dst->write_mask != WINED3DSP_WRITEMASK_3) 2961 3041 shader_addline(ins->ctx->buffer, "%s /* COISSUE! */);\n", src1_param.param_str); 2962 } else {3042 else 2963 3043 shader_addline(ins->ctx->buffer, "%s > 0.5 ? %s : %s);\n", 2964 3044 src0_param.param_str, src1_param.param_str, src2_param.param_str); 2965 }2966 3045 return; 2967 3046 } … … 4953 5032 shader_addline(buffer, "vec3 r;\n"); 4954 5033 5034 if (settings->transformed) 5035 { 5036 shader_addline(buffer, "vec4 ec_pos = vec4(gl_Vertex.xyz, 1.0);\n"); 5037 shader_addline(buffer, "gl_Position = gl_ProjectionMatrix * ec_pos;\n"); 5038 shader_addline(buffer, "if (gl_Vertex.w != 0.0) gl_Position /= gl_Vertex.w;\n"); 5039 } 5040 else 5041 { 4955 5042 shader_addline(buffer, "vec4 ec_pos = gl_ModelViewMatrix * gl_Vertex;\n"); 4956 5043 shader_addline(buffer, "gl_Position = gl_ProjectionMatrix * ec_pos;\n"); … … 4958 5045 shader_addline(buffer, "gl_ClipVertex = ec_pos;\n"); 4959 5046 shader_addline(buffer, "ec_pos /= ec_pos.w;\n"); 5047 } 4960 5048 4961 5049 if (!settings->normal) … … 5415 5503 if (settings->sRGB_write) 5416 5504 { 5417 shader_addline(buffer, "const vec4 srgb_const0 = vec4(%.8e, %.8e, %.8e, %.8e);\n", 5418 srgb_pow, srgb_mul_high, srgb_sub_high, srgb_mul_low); 5419 shader_addline(buffer, "const vec4 srgb_const1 = vec4(%.8e, 0.0, 0.0, 0.0);\n", 5420 srgb_cmp); 5505 shader_addline(buffer, "const vec4 srgb_const0 = "); 5506 shader_glsl_append_imm_vec4(buffer, srgb_const0); 5507 shader_addline(buffer, ";\n"); 5508 shader_addline(buffer, "const vec4 srgb_const1 = "); 5509 shader_glsl_append_imm_vec4(buffer, srgb_const1); 5510 shader_addline(buffer, ";\n"); 5421 5511 } 5422 5512 … … 6689 6779 static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps) 6690 6780 { 6781 caps->xyzrhw = TRUE; 6691 6782 caps->max_active_lights = gl_info->limits.lights; 6692 6783 caps->max_vertex_blend_matrices = 0; … … 6851 6942 {STATE_RENDER(WINED3D_RS_LIGHTING), {STATE_VDECL, NULL }, WINED3D_GL_EXT_NONE }, 6852 6943 {STATE_RENDER(WINED3D_RS_AMBIENT), {STATE_RENDER(WINED3D_RS_AMBIENT), state_ambient }, WINED3D_GL_EXT_NONE }, 6853 {STATE_RENDER(WINED3D_RS_COLORVERTEX), {STATE_ VDECL, NULL}, WINED3D_GL_EXT_NONE },6944 {STATE_RENDER(WINED3D_RS_COLORVERTEX), {STATE_RENDER(WINED3D_RS_COLORVERTEX), glsl_vertex_pipe_shader}, WINED3D_GL_EXT_NONE }, 6854 6945 {STATE_RENDER(WINED3D_RS_LOCALVIEWER), {STATE_VDECL, NULL }, WINED3D_GL_EXT_NONE }, 6855 6946 {STATE_RENDER(WINED3D_RS_NORMALIZENORMALS), {STATE_VDECL, NULL }, WINED3D_GL_EXT_NONE }, … … 7036 7127 BOOL use_vshader = use_vs(state); 7037 7128 enum fogsource new_source; 7129 DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART]; 7130 DWORD fogend = state->render_states[WINED3D_RS_FOGEND]; 7038 7131 7039 7132 context->select_shader = 1; … … 7057 7150 } 7058 7151 7059 if (new_source != context->fog_source )7152 if (new_source != context->fog_source || fogstart == fogend) 7060 7153 { 7061 7154 context->fog_source = new_source; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/state.c
r46521 r48073 1048 1048 tmpvalue.d = state->render_states[WINED3D_RS_FOGEND]; 1049 1049 fogend = tmpvalue.f; 1050 /* In GL, fogstart == fogend disables fog, in D3D everything's fogged.*/ 1051 if(fogstart == fogend) { 1050 /* Special handling for fogstart == fogend. In d3d with vertex 1051 * fog, everything is fogged. With table fog, everything with 1052 * fog_coord < fog_start is unfogged, and fog_coord > fog_start 1053 * is fogged. Windows drivers disagree when fog_coord == fog_start. */ 1054 if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE 1055 && fogstart == fogend) 1056 { 1052 1057 fogstart = -INFINITY; 1053 1058 fogend = 0.0f; … … 1077 1082 const struct wined3d_gl_info *gl_info = context->gl_info; 1078 1083 enum fogsource new_source; 1084 DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART]; 1085 DWORD fogend = state->render_states[WINED3D_RS_FOGEND]; 1079 1086 1080 1087 TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id); … … 1222 1229 glEnableWINE(GL_FOG); 1223 1230 checkGLcall("glEnable GL_FOG"); 1224 if (new_source != context->fog_source )1231 if (new_source != context->fog_source || fogstart == fogend) 1225 1232 { 1226 1233 context->fog_source = new_source; … … 4579 4586 transform_world(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0))); 4580 4587 if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_COLORVERTEX))) 4581 state_colormat(context, state, STATE_RENDER(WINED3D_RS_COLORVERTEX));4588 context_apply_state(context, state, STATE_RENDER(WINED3D_RS_COLORVERTEX)); 4582 4589 if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_LIGHTING))) 4583 4590 state_lighting(context, state, STATE_RENDER(WINED3D_RS_LIGHTING)); … … 5646 5653 static void vp_ffp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps) 5647 5654 { 5655 caps->xyzrhw = FALSE; 5648 5656 caps->max_active_lights = gl_info->limits.lights; 5649 5657 caps->max_vertex_blend_matrices = gl_info->limits.blends; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/surface.c
r46886 r48073 141 141 142 142 if (surface->flags & SFLAG_USERPTR) 143 wined3d_surface_set_mem(surface, NULL );143 wined3d_surface_set_mem(surface, NULL, 0); 144 144 if (surface->overlay_dest) 145 145 list_remove(&surface->overlay_entry); … … 2524 2524 dst_data = surface->resource.allocatedMemory; 2525 2525 TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", surface, src_pitch, dst_pitch); 2526 for (y = 1; y < surface->resource.height; ++y)2526 for (y = 0; y < surface->resource.height; ++y) 2527 2527 { 2528 /* skip the first row */2528 memcpy(dst_data, src_data, dst_pitch); 2529 2529 src_data += src_pitch; 2530 2530 dst_data += dst_pitch; 2531 memcpy(dst_data, src_data, dst_pitch);2532 2531 } 2533 2532 … … 3488 3487 TRACE("surface %p.\n", surface); 3489 3488 3489 if (surface->pitch) 3490 return surface->pitch; 3491 3490 3492 if (format->flags & WINED3DFMT_FLAG_BLOCKS) 3491 3493 { … … 3507 3509 } 3508 3510 3509 HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem )3511 HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem, UINT pitch) 3510 3512 { 3511 3513 #ifndef VBOX_WITH_WDDM … … 3576 3578 surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); 3577 3579 } 3580 3581 surface->pitch = pitch; 3578 3582 3579 3583 return WINED3D_OK; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/utils.c
r46521 r48073 3557 3557 memset(settings, 0, sizeof(*settings)); 3558 3558 3559 settings->clipping = state->render_states[WINED3D_RS_CLIPPING] 3560 && state->render_states[WINED3D_RS_CLIPPLANEENABLE]; 3559 settings->transformed = 1; 3561 3560 settings->point_size = state->gl_primitive_type == GL_POINTS; 3562 3561 if (!state->render_states[WINED3D_RS_FOGENABLE]) … … 3578 3577 } 3579 3578 3579 settings->transformed = 0; 3580 3580 settings->clipping = state->render_states[WINED3D_RS_CLIPPING] 3581 3581 && state->render_states[WINED3D_RS_CLIPPLANEENABLE]; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d.spec
r46521 r48073 227 227 @ cdecl wined3d_surface_restore(ptr) 228 228 @ cdecl wined3d_surface_set_color_key(ptr long ptr) 229 @ cdecl wined3d_surface_set_mem(ptr ptr )229 @ cdecl wined3d_surface_set_mem(ptr ptr long) 230 230 @ cdecl wined3d_surface_set_overlay_position(ptr long long) 231 231 @ cdecl wined3d_surface_set_palette(ptr ptr) -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_private.h
r46521 r48073 87 87 #define WINED3D_QUIRK_INFO_LOG_SPAM 0x00000080 88 88 #define WINED3D_QUIRK_LIMITED_TEX_FILTERING 0x00000100 89 #define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200 89 90 #ifdef VBOX_WITH_WINE_FIX_QUIRKS 90 91 #define WINED3D_QUIRK_FULLSIZE_BLIT 0x02000000 … … 1251 1252 struct wined3d_vertex_caps 1252 1253 { 1254 BOOL xyzrhw; 1253 1255 DWORD max_active_lights; 1254 1256 DWORD max_vertex_blend_matrices; … … 1533 1535 CARD_NVIDIA_GEFORCE_GTX660TI = 0x1183, 1534 1536 CARD_NVIDIA_GEFORCE_GTX670 = 0x1189, 1537 CARD_NVIDIA_GEFORCE_GTX670MX = 0x11a1, 1535 1538 CARD_NVIDIA_GEFORCE_GTX680 = 0x1180, 1539 CARD_NVIDIA_GEFORCE_GTX770M = 0x11e0, 1536 1540 1537 1541 CARD_INTEL_830M = 0x3577, … … 1677 1681 { 1678 1682 struct wined3d_d3d_limits limits; 1683 BOOL xyzrhw; 1679 1684 BOOL vs_clipping; 1680 1685 DWORD valid_rt_mask; … … 1799 1804 DWORD specular_source : 2; 1800 1805 1806 DWORD transformed : 1; 1801 1807 DWORD clipping : 1; 1802 1808 DWORD normal : 1; … … 1807 1813 DWORD fog_mode : 2; 1808 1814 DWORD texcoords : 8; /* MAX_TEXTURES */ 1809 DWORD padding : 1 6;1815 DWORD padding : 15; 1810 1816 1811 1817 BYTE texgen[MAX_TEXTURES]; … … 2215 2221 DWORD flags; 2216 2222 2223 UINT pitch; 2217 2224 UINT pow2Width; 2218 2225 UINT pow2Height; … … 3009 3016 #endif 3010 3017 3011 /* sRGB correction constants */3012 static const float srgb_cmp = 0.0031308f;3013 static const float srgb_mul_low = 12.92f;3014 static const float srgb_pow = 0.41666f;3015 static const float srgb_mul_high = 1.055f;3016 static const float srgb_sub_high = 0.055f;3017 3018 3018 struct wined3d_palette 3019 3019 {
Note:
See TracChangeset
for help on using the changeset viewer.