Changeset 51270 in vbox for trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d
- Timestamp:
- May 16, 2014 10:27:20 AM (11 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/arb_program_shader.c
r49419 r51270 49 49 WINE_DECLARE_DEBUG_CHANNEL(d3d); 50 50 51 /* sRGB correction constants */52 static const float srgb_cmp = 0.0031308f;53 static const float srgb_mul_low = 12.92f;54 static const float srgb_pow = 0.41666f;55 static const float srgb_mul_high = 1.055f;56 static const float srgb_sub_high = 0.055f;57 58 51 static BOOL shader_is_pshader_version(enum wined3d_shader_type type) 59 52 { … … 766 759 memset(priv->pshader_const_dirty + start, 1, sizeof(*priv->pshader_const_dirty) * count); 767 760 priv->highest_dirty_ps_const = max(priv->highest_dirty_ps_const, start + count); 761 } 762 763 static void shader_arb_append_imm_vec4(struct wined3d_shader_buffer *buffer, const float *values) 764 { 765 char str[4][16]; 766 767 wined3d_ftoa(values[0], str[0]); 768 wined3d_ftoa(values[1], str[1]); 769 wined3d_ftoa(values[2], str[2]); 770 wined3d_ftoa(values[3], str[3]); 771 shader_addline(buffer, "{%s, %s, %s, %s}", str[0], str[1], str[2], str[3]); 768 772 } 769 773 … … 872 876 const float *value; 873 877 value = (const float *)lconst->value; 874 shader_addline(buffer, "PARAM C%u = {%.8e, %.8e, %.8e, %.8e};\n", lconst->idx, 875 value[0], value[1], value[2], value[3]); 878 shader_addline(buffer, "PARAM C%u = ", lconst->idx); 879 shader_arb_append_imm_vec4(buffer, value); 880 shader_addline(buffer, ";\n"); 876 881 } 877 882 } … … 3446 3451 { 3447 3452 /* Sigh. MOVC CC doesn't work, so use one of the temps as dummy dest */ 3448 shader_addline(buffer, "SUBC %s, %s.x, srgb_consts1. y;\n", tmp1, fragcolor);3453 shader_addline(buffer, "SUBC %s, %s.x, srgb_consts1.x;\n", tmp1, fragcolor); 3449 3454 /* Calculate the > 0.0031308 case */ 3450 shader_addline(buffer, "POW %s.x (GE), %s.x, srgb_consts 1.z;\n", fragcolor, fragcolor);3451 shader_addline(buffer, "POW %s.y (GE), %s.y, srgb_consts 1.z;\n", fragcolor, fragcolor);3452 shader_addline(buffer, "POW %s.z (GE), %s.z, srgb_consts 1.z;\n", fragcolor, fragcolor);3453 shader_addline(buffer, "MUL %s.xyz (GE), %s, srgb_consts 1.w;\n", fragcolor, fragcolor);3454 shader_addline(buffer, "SUB %s.xyz (GE), %s, srgb_consts 2.x;\n", fragcolor, fragcolor);3455 shader_addline(buffer, "POW %s.x (GE), %s.x, srgb_consts0.x;\n", fragcolor, fragcolor); 3456 shader_addline(buffer, "POW %s.y (GE), %s.y, srgb_consts0.x;\n", fragcolor, fragcolor); 3457 shader_addline(buffer, "POW %s.z (GE), %s.z, srgb_consts0.x;\n", fragcolor, fragcolor); 3458 shader_addline(buffer, "MUL %s.xyz (GE), %s, srgb_consts0.y;\n", fragcolor, fragcolor); 3459 shader_addline(buffer, "SUB %s.xyz (GE), %s, srgb_consts0.z;\n", fragcolor, fragcolor); 3455 3460 /* Calculate the < case */ 3456 shader_addline(buffer, "MUL %s.xyz (LT), srgb_consts 1.x, %s;\n", fragcolor, fragcolor);3461 shader_addline(buffer, "MUL %s.xyz (LT), srgb_consts0.w, %s;\n", fragcolor, fragcolor); 3457 3462 } 3458 3463 else 3459 3464 { 3460 3465 /* Calculate the > 0.0031308 case */ 3461 shader_addline(buffer, "POW %s.x, %s.x, srgb_consts 1.z;\n", tmp1, fragcolor);3462 shader_addline(buffer, "POW %s.y, %s.y, srgb_consts 1.z;\n", tmp1, fragcolor);3463 shader_addline(buffer, "POW %s.z, %s.z, srgb_consts 1.z;\n", tmp1, fragcolor);3464 shader_addline(buffer, "MUL %s, %s, srgb_consts 1.w;\n", tmp1, tmp1);3465 shader_addline(buffer, "SUB %s, %s, srgb_consts 2.x;\n", tmp1, tmp1);3466 shader_addline(buffer, "POW %s.x, %s.x, srgb_consts0.x;\n", tmp1, fragcolor); 3467 shader_addline(buffer, "POW %s.y, %s.y, srgb_consts0.x;\n", tmp1, fragcolor); 3468 shader_addline(buffer, "POW %s.z, %s.z, srgb_consts0.x;\n", tmp1, fragcolor); 3469 shader_addline(buffer, "MUL %s, %s, srgb_consts0.y;\n", tmp1, tmp1); 3470 shader_addline(buffer, "SUB %s, %s, srgb_consts0.z;\n", tmp1, tmp1); 3466 3471 /* Calculate the < case */ 3467 shader_addline(buffer, "MUL %s, srgb_consts 1.x, %s;\n", tmp2, fragcolor);3472 shader_addline(buffer, "MUL %s, srgb_consts0.w, %s;\n", tmp2, fragcolor); 3468 3473 /* Get 1.0 / 0.0 masks for > 0.0031308 and < 0.0031308 */ 3469 shader_addline(buffer, "SLT %s, srgb_consts1. y, %s;\n", tmp3, fragcolor);3470 shader_addline(buffer, "SGE %s, srgb_consts1. y, %s;\n", tmp4, fragcolor);3474 shader_addline(buffer, "SLT %s, srgb_consts1.x, %s;\n", tmp3, fragcolor); 3475 shader_addline(buffer, "SGE %s, srgb_consts1.x, %s;\n", tmp4, fragcolor); 3471 3476 /* Store the components > 0.0031308 in the destination */ 3472 3477 shader_addline(buffer, "MUL %s.xyz, %s, %s;\n", fragcolor, tmp1, tmp3); … … 3597 3602 3598 3603 char srgbtmp[4][4]; 3604 char ftoa_tmp[16]; 3599 3605 unsigned int i, found = 0; 3600 3606 … … 3722 3728 shader_addline(buffer, "PARAM coefdiv = { 0.5, 0.25, 0.125, 0.0625 };\n"); 3723 3729 shader_addline(buffer, "PARAM coefmul = { 2, 4, 8, 16 };\n"); 3724 shader_addline(buffer, "PARAM ps_helper_const = { 0.0, 1.0, %1.10f, 0.0 };\n", eps); 3730 wined3d_ftoa(eps, ftoa_tmp); 3731 shader_addline(buffer, "PARAM ps_helper_const = { 0.0, 1.0, %s, 0.0 };\n", ftoa_tmp); 3725 3732 3726 3733 if (reg_maps->shader_version.major < 2) … … 3746 3753 } 3747 3754 3748 if(args->super.srgb_correction) { 3749 shader_addline(buffer, "PARAM srgb_consts1 = {%f, %f, %f, %f};\n", 3750 srgb_mul_low, srgb_cmp, srgb_pow, srgb_mul_high); 3751 shader_addline(buffer, "PARAM srgb_consts2 = {%f, %f, %f, %f};\n", 3752 srgb_sub_high, 0.0, 0.0, 0.0); 3755 if (args->super.srgb_correction) 3756 { 3757 shader_addline(buffer, "PARAM srgb_consts0 = "); 3758 shader_arb_append_imm_vec4(buffer, wined3d_srgb_const0); 3759 shader_addline(buffer, ";\n"); 3760 shader_addline(buffer, "PARAM srgb_consts1 = "); 3761 shader_arb_append_imm_vec4(buffer, wined3d_srgb_const1); 3762 shader_addline(buffer, ";\n"); 3753 3763 } 3754 3764 … … 4207 4217 if (need_helper_const(shader_data, reg_maps, gl_info)) 4208 4218 { 4209 shader_addline(buffer, "PARAM helper_const = { 0.0, 1.0, 2.0, %1.10f};\n", eps); 4219 char ftoa_tmp[16]; 4220 wined3d_ftoa(eps, ftoa_tmp); 4221 shader_addline(buffer, "PARAM helper_const = { 0.0, 1.0, 2.0, %s};\n", ftoa_tmp); 4210 4222 } 4211 4223 if (need_rel_addr_const(shader_data, reg_maps, gl_info)) … … 6169 6181 UINT lowest_disabled_stage; 6170 6182 const char *textype; 6171 const char *instr , *sat;6183 const char *instr; 6172 6184 char colorcor_dst[8]; 6173 6185 GLuint ret; … … 6282 6294 shader_addline(&buffer, "PARAM tfactor = program.env[%u];\n", ARB_FFP_CONST_TFACTOR); 6283 6295 } 6284 shader_addline(&buffer, "PARAM specular_enable = program.env[%u];\n", ARB_FFP_CONST_SPECULAR_ENABLE); 6285 6286 if(settings->sRGB_write) { 6287 shader_addline(&buffer, "PARAM srgb_consts1 = {%f, %f, %f, %f};\n", 6288 srgb_mul_low, srgb_cmp, srgb_pow, srgb_mul_high); 6289 shader_addline(&buffer, "PARAM srgb_consts2 = {%f, %f, %f, %f};\n", 6290 srgb_sub_high, 0.0, 0.0, 0.0); 6296 shader_addline(&buffer, "PARAM specular_enable = program.env[%u];\n", ARB_FFP_CONST_SPECULAR_ENABLE); 6297 6298 if (settings->sRGB_write) 6299 { 6300 shader_addline(&buffer, "PARAM srgb_consts0 = "); 6301 shader_arb_append_imm_vec4(&buffer, wined3d_srgb_const0); 6302 shader_addline(&buffer, ";\n"); 6303 shader_addline(&buffer, "PARAM srgb_consts1 = "); 6304 shader_arb_append_imm_vec4(&buffer, wined3d_srgb_const1); 6305 shader_addline(&buffer, ";\n"); 6291 6306 } 6292 6307 … … 6308 6323 default: textype = "unexpected_textype"; break; 6309 6324 } 6310 6311 if (settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP6312 || settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)6313 sat = "";6314 else6315 sat = "_SAT";6316 6325 6317 6326 if(settings->op[stage].projected == proj_none) { … … 6349 6358 } 6350 6359 6351 shader_addline(&buffer, "%s %stex%u, ret, texture[%u], %s;\n",6352 instr, s at, stage, stage, textype);6360 shader_addline(&buffer, "%s tex%u, ret, texture[%u], %s;\n", 6361 instr, stage, stage, textype); 6353 6362 if (settings->op[stage - 1].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE) 6354 6363 { … … 6360 6369 shader_addline(&buffer, "MOV ret, fragment.texcoord[%u];\n", stage); 6361 6370 shader_addline(&buffer, "MOV ret.w, ret.z;\n"); 6362 shader_addline(&buffer, "%s %stex%u, ret, texture[%u], %s;\n",6363 instr, s at, stage, stage, textype);6371 shader_addline(&buffer, "%s tex%u, ret, texture[%u], %s;\n", 6372 instr, stage, stage, textype); 6364 6373 } else { 6365 shader_addline(&buffer, "%s %stex%u, fragment.texcoord[%u], texture[%u], %s;\n",6366 instr, s at, stage, stage, stage, textype);6374 shader_addline(&buffer, "%s tex%u, fragment.texcoord[%u], texture[%u], %s;\n", 6375 instr, stage, stage, stage, textype); 6367 6376 } 6368 6377 … … 6888 6897 { 6889 6898 const char *tex; 6899 static const float yv12_coef[] 6900 = {2.0f / 3.0f, 1.0f / 6.0f, (2.0f / 3.0f) + (1.0f / 6.0f), 1.0f / 3.0f}; 6890 6901 6891 6902 switch(textype) { … … 6935 6946 * go from 0 to d3d_height, whereas the opengl texture height is 1.5 * d3d_height 6936 6947 */ 6937 shader_addline(buffer, "PARAM yv12_coef = {%f, %f, %f, %f};\n", 6938 2.0f / 3.0f, 1.0f / 6.0f, (2.0f / 3.0f) + (1.0f / 6.0f), 1.0f / 3.0f); 6948 shader_addline(buffer, "PARAM yv12_coef = "); 6949 shader_arb_append_imm_vec4(buffer, yv12_coef); 6950 shader_addline(buffer, ";\n"); 6939 6951 6940 6952 shader_addline(buffer, "MOV texcrd, fragment.texcoord[0];\n"); … … 7453 7465 /* Now load the surface */ 7454 7466 if (wined3d_settings.offscreen_rendering_mode != ORM_FBO 7455 && (src_surface->flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE)) == SFLAG_INDRAWABLE) 7467 && (src_surface->flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE)) == SFLAG_INDRAWABLE 7468 && !surface_is_offscreen(src_surface)) 7456 7469 { 7457 7470 /* Without FBO blits transferring from the drawable to the texture is -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/buffer.c
r48345 r51270 659 659 { 660 660 ULONG refcount = InterlockedDecrement(&buffer->resource.ref); 661 struct wined3d_context *context; 661 662 662 663 TRACE("%p decreasing refcount to %u.\n", buffer, refcount); … … 664 665 if (!refcount) 665 666 { 666 buffer_unload(&buffer->resource); 667 if (buffer->buffer_object) 668 { 669 context = context_acquire(buffer->resource.device, NULL); 670 delete_gl_buffer(buffer, context->gl_info); 671 context_release(context); 672 673 HeapFree(GetProcessHeap(), 0, buffer->conversion_map); 674 } 675 667 676 resource_cleanup(&buffer->resource); 668 677 buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/context.c
r48999 r51270 842 842 return FALSE; 843 843 } 844 845 ctx->valid = 1; 844 846 #else 845 847 return FALSE; … … 1030 1032 1031 1033 if (context->valid) 1032 { 1033 /* You'd figure ReleaseDC() would fail if the DC doesn't match the 1034 * window. However, that's not what actually happens, and there are 1035 * user32 tests that confirm ReleaseDC() with the wrong window is 1036 * supposed to succeed. So explicitly check that the DC belongs to 1037 * the window, since we want to avoid releasing a DC that belongs to 1038 * some other window if the original window was already destroyed. */ 1039 if (WindowFromDC(context->hdc) != context->win_handle) 1040 { 1041 WARN("DC %p does not belong to window %p.\n", 1042 context->hdc, context->win_handle); 1043 } 1044 #ifndef VBOX 1045 else if (!ReleaseDC(context->win_handle, context->hdc)) 1046 #else 1047 else if (!VBoxExtReleaseDC(context->win_handle, context->hdc)) 1048 #endif 1049 { 1050 ERR("Failed to release device context %p, last error %#x.\n", 1051 context->hdc, GetLastError()); 1052 } 1053 } 1054 else context->valid = 1; 1034 wined3d_release_dc(context->win_handle, context->hdc); 1035 else 1036 context->valid = 1; 1055 1037 1056 1038 context->win_handle = context->swapchain->win_handle; … … 1211 1193 # ifndef VBOX_WINE_WITH_SINGLE_CONTEXT 1212 1194 # ifndef VBOX 1213 ReleaseDC(context->win_handle, context->hdc);1195 wined3d_release_dc(context->win_handle, context->hdc); 1214 1196 # else 1215 1197 VBoxExtReleaseDC(context->win_handle, context->hdc); -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/device.c
r49170 r51270 1379 1379 device->blitter->free_private(device); 1380 1380 device->shader_backend->shader_free_private(device); 1381 destroy_dummy_textures(device, gl_info); 1381 1382 1382 1383 /* Release the buffers (with sanity checks)*/ … … 5120 5121 else if (swapchain_desc->windowed) 5121 5122 { 5122 m.width = swapchain->orig_width; 5123 m.height = swapchain->orig_height; 5124 m.refresh_rate = 0; 5125 m.format_id = swapchain->desc.backbuffer_format; 5126 m.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; 5123 m = swapchain->original_mode; 5127 5124 } 5128 5125 else -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/directx.c
r48999 r51270 146 146 {"GL_ARB_texture_float", ARB_TEXTURE_FLOAT }, 147 147 {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT }, 148 {"GL_ARB_texture_mirror_clamp_to_edge", ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE}, 148 149 #ifdef VBOX_WITH_WINE_FIX_IBMTMR 149 150 {"GL_IBM_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT }, … … 194 195 {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC}, 195 196 {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS }, 197 {"GL_EXT_texture_mirror_clamp", EXT_TEXTURE_MIRROR_CLAMP }, 196 198 {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB }, 197 199 {"GL_EXT_texture_sRGB_decode", EXT_TEXTURE_SRGB_DECODE }, … … 307 309 } 308 310 309 ReleaseDC(ctx->wnd, ctx->dc);311 wined3d_release_dc(ctx->wnd, ctx->dc); 310 312 DestroyWindow(ctx->wnd); 311 313 … … 1370 1372 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX650TI, "NVIDIA GeForce GTX 650 Ti", DRIVER_NVIDIA_GEFORCE6, 1024}, 1371 1373 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660, "NVIDIA GeForce GTX 660", DRIVER_NVIDIA_GEFORCE6, 2048}, 1374 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660M, "NVIDIA GeForce GTX 660M", DRIVER_NVIDIA_GEFORCE6, 2048}, 1372 1375 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX660TI, "NVIDIA GeForce GTX 660 Ti", DRIVER_NVIDIA_GEFORCE6, 2048}, 1373 1376 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE6, 2048}, … … 1375 1378 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX680, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE6, 2048}, 1376 1379 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX770M, "NVIDIA GeForce GTX 770M", DRIVER_NVIDIA_GEFORCE6, 3072}, 1380 {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX770, "NVIDIA GeForce GTX 770", DRIVER_NVIDIA_GEFORCE6, 2048}, 1377 1381 1378 1382 /* AMD cards */ … … 1786 1790 { 1787 1791 {"GTX 770M", CARD_NVIDIA_GEFORCE_GTX770M}, /* Geforce 700 - midend high mobile */ 1792 {"GTX 770", CARD_NVIDIA_GEFORCE_GTX770}, /* Geforce 700 - highend */ 1788 1793 {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680}, /* Geforce 600 - highend */ 1789 1794 {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX}, /* Geforce 600 - highend */ 1790 1795 {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670}, /* Geforce 600 - midend high */ 1791 1796 {"GTX 660 Ti", CARD_NVIDIA_GEFORCE_GTX660TI}, /* Geforce 600 - midend high */ 1797 {"GTX 660M", CARD_NVIDIA_GEFORCE_GTX660M}, /* Geforce 600 - midend high mobile */ 1792 1798 {"GTX 660", CARD_NVIDIA_GEFORCE_GTX660}, /* Geforce 600 - midend high */ 1793 1799 {"GTX 650 Ti", CARD_NVIDIA_GEFORCE_GTX650TI}, /* Geforce 600 - lowend */ … … 3111 3117 gl_info->supported[ARB_OCCLUSION_QUERY] = FALSE; 3112 3118 } 3119 if (!gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] && gl_info->supported[EXT_TEXTURE_MIRROR_CLAMP]) 3120 { 3121 TRACE(" IMPLIED: ATI_texture_mirror_once support (by EXT_texture_mirror_clamp).\n"); 3122 gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] = TRUE; 3123 } 3124 if (!gl_info->supported[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE] && gl_info->supported[ATI_TEXTURE_MIRROR_ONCE]) 3125 { 3126 TRACE(" IMPLIED: ARB_texture_mirror_clamp_to_edge support (by ATI_texture_mirror_once).\n"); 3127 gl_info->supported[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE] = TRUE; 3128 } 3113 3129 3114 3130 wined3d_adapter_init_limits(gl_info); … … 3228 3244 gl_info->supported[ARB_TEXTURE_BORDER_CLAMP] ? GL_CLAMP_TO_BORDER_ARB : GL_REPEAT; 3229 3245 gl_info->wrap_lookup[WINED3D_TADDRESS_MIRROR_ONCE - WINED3D_TADDRESS_WRAP] = 3230 gl_info->supported[A TI_TEXTURE_MIRROR_ONCE] ? GL_MIRROR_CLAMP_TO_EDGE_ATI: GL_REPEAT;3246 gl_info->supported[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE] ? GL_MIRROR_CLAMP_TO_EDGE : GL_REPEAT; 3231 3247 3232 3248 adapter->d3d_info.valid_rt_mask = 0; … … 4582 4598 caps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRROR; 4583 4599 } 4584 if (gl_info->supported[A TI_TEXTURE_MIRROR_ONCE])4600 if (gl_info->supported[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE]) 4585 4601 { 4586 4602 caps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRRORONCE; … … 4600 4616 caps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRROR; 4601 4617 } 4602 if (gl_info->supported[A TI_TEXTURE_MIRROR_ONCE])4618 if (gl_info->supported[ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE]) 4603 4619 { 4604 4620 caps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRRORONCE; -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/drawprim.c
r49170 r51270 62 62 if (instance_count) 63 63 { 64 if (!gl_info->supported[ARB_DRAW_INSTANCED] )64 if (!gl_info->supported[ARB_DRAW_INSTANCED] && !gl_info->supported[ARB_INSTANCED_ARRAYS]) 65 65 { 66 66 FIXME("Instanced drawing not supported.\n"); … … 70 70 if (start_instance) 71 71 FIXME("Start instance (%u) not supported.\n", start_instance); 72 if (gl_info->supported[ARB_DRAW_ELEMENTS_BASE_VERTEX]) 73 { 72 74 GL_EXTCALL(glDrawElementsInstancedBaseVertex(primitive_type, count, idxtype, 73 75 (const char *)idx_data + (idx_size * start_idx), instance_count, base_vertex_index)); 74 76 checkGLcall("glDrawElementsInstancedBaseVertex"); 77 } 78 else 79 { 80 GL_EXTCALL(glDrawElementsInstancedARB(primitive_type, count, idxtype, 81 (const char *)idx_data + (idx_size * start_idx), instance_count)); 82 checkGLcall("glDrawElementsInstancedARB"); 83 } 75 84 } 76 85 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/glsl_shader.c
r48509 r51270 47 47 #include "wined3d_private.h" 48 48 49 #if defined(VBOX)50 # if defined(RT_ARCH_AMD64)51 # define copysignf _copysignf52 # else53 # define _VBOX_BITVAL_CAST(_t, _f) (*((const _t*)((const void*)(&(_f)))))54 # define _VBOX_BITVAL_TO_FLOATL(_f) _VBOX_BITVAL_CAST(float, _f)55 # define _VBOX_BITVAL_FROM_FLOAT(_f) _VBOX_BITVAL_CAST(uint32_t, _f)56 DECLINLINE(float) copysignf(float val, float sign)57 {58 uint32_t u32Val = ((_VBOX_BITVAL_FROM_FLOAT(val) & 0x7fffffff) | (_VBOX_BITVAL_FROM_FLOAT(sign) & 0x80000000));59 return _VBOX_BITVAL_TO_FLOATL(u32Val);60 }61 # endif62 #endif63 64 49 WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); 65 50 WINE_DECLARE_DEBUG_CHANNEL(d3d_constants); … … 71 56 #define WINED3D_GLSL_SAMPLE_LOD 0x4 72 57 #define WINED3D_GLSL_SAMPLE_GRAD 0x8 73 74 static const float srgb_const0[] = {0.41666f, 1.055f, 0.055f, 12.92f}; /* pow, mul_high, sub_high, mul_low */75 static const float srgb_const1[] = {0.0031308f, 0.0f, 0.0f, 0.0f}; /* cmp */76 58 77 59 struct glsl_dst_param … … 273 255 } 274 256 275 /* This should be equivalent to using the %.8e format specifier, but always276 * using '.' as decimal separator. This doesn't handle +/-INF or NAN, since277 * the GLSL parser wouldn't be able to handle those anyway. */278 static void shader_glsl_ftoa(float value, char *s)279 {280 int x, frac, exponent;281 const char *sign = "";282 double d;283 284 d = value;285 if (copysignf(1.0f, value) < 0.0f)286 {287 d = -d;288 sign = "-";289 }290 291 if (d == 0.0f)292 {293 x = 0;294 frac = 0;295 exponent = 0;296 }297 else298 {299 double t, diff;300 301 exponent = floorf(log10f(d));302 d /= pow(10.0, exponent);303 304 x = d;305 t = (d - x) * 100000000;306 frac = t;307 diff = t - frac;308 309 if ((diff > 0.5) || (diff == 0.5 && (frac & 1)))310 {311 if (++frac >= 100000000)312 {313 frac = 0;314 ++x;315 }316 }317 }318 319 sprintf(s, "%s%d.%08de%+03d", sign, x, frac, exponent);320 }321 322 257 static void shader_glsl_append_imm_vec4(struct wined3d_shader_buffer *buffer, const float *values) 323 258 { 324 259 char str[4][16]; 325 260 326 shader_glsl_ftoa(values[0], str[0]);327 shader_glsl_ftoa(values[1], str[1]);328 shader_glsl_ftoa(values[2], str[2]);329 shader_glsl_ftoa(values[3], str[3]);261 wined3d_ftoa(values[0], str[0]); 262 wined3d_ftoa(values[1], str[1]); 263 wined3d_ftoa(values[2], str[2]); 264 wined3d_ftoa(values[3], str[3]); 330 265 shader_addline(buffer, "vec4(%s, %s, %s, %s)", str[0], str[1], str[2], str[3]); 331 266 } … … 534 469 const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, DWORD version) 535 470 { 471 unsigned int start = ~0U, end = 0; 536 472 int stack_idx = 0; 537 473 unsigned int heap_idx = 1; … … 541 477 542 478 idx = heap->entries[heap_idx].idx; 543 if (constant_locations[idx] != -1) GL_EXTCALL(glUniform4fvARB(constant_locations[idx], 1, &constants[idx * 4])); 479 if (constant_locations[idx] != -1) 480 start = end = idx; 544 481 stack[stack_idx] = HEAP_NODE_TRAVERSE_LEFT; 545 482 … … 557 494 idx = heap->entries[heap_idx].idx; 558 495 if (constant_locations[idx] != -1) 559 GL_EXTCALL(glUniform4fvARB(constant_locations[idx], 1, &constants[idx * 4])); 496 { 497 if (start > idx) 498 start = idx; 499 if (end < idx) 500 end = idx; 501 } 560 502 561 503 stack[stack_idx++] = HEAP_NODE_TRAVERSE_RIGHT; … … 573 515 idx = heap->entries[heap_idx].idx; 574 516 if (constant_locations[idx] != -1) 575 GL_EXTCALL(glUniform4fvARB(constant_locations[idx], 1, &constants[idx * 4])); 517 { 518 if (start > idx) 519 start = idx; 520 if (end < idx) 521 end = idx; 522 } 576 523 577 524 stack[stack_idx++] = HEAP_NODE_POP; … … 587 534 } 588 535 } 536 if (start <= end) 537 GL_EXTCALL(glUniform4fvARB(constant_locations[start], end - start + 1, &constants[start * 4])); 589 538 checkGLcall("walk_constant_heap()"); 590 539 } … … 936 885 for (i = 0; i < MAX_TEXTURES; ++i) 937 886 { 887 if (prog->ps.bumpenv_mat_location[i] == -1) 888 continue; 889 938 890 GL_EXTCALL(glUniformMatrix2fvARB(prog->ps.bumpenv_mat_location[i], 1, 0, 939 891 (const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_MAT00])); 940 GL_EXTCALL(glUniform1fARB(prog->ps.bumpenv_lum_scale_location[i], 941 *(const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE])); 942 GL_EXTCALL(glUniform1fARB(prog->ps.bumpenv_lum_offset_location[i], 943 *(const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET])); 944 } 945 892 893 if (prog->ps.bumpenv_lum_scale_location[i] != -1) 894 { 895 GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_scale_location[i], 1, 896 (const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LSCALE])); 897 GL_EXTCALL(glUniform1fvARB(prog->ps.bumpenv_lum_offset_location[i], 1, 898 (const float *)&state->texture_states[i][WINED3D_TSS_BUMPENV_LOFFSET])); 899 } 900 } 901 902 if (prog->ps.tex_factor_location != -1) 903 { 946 904 D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col); 947 GL_EXTCALL(glUniform4fARB(prog->ps.tex_factor_location, col[0], col[1], col[2], col[3])); 905 GL_EXTCALL(glUniform4fvARB(prog->ps.tex_factor_location, 1, col)); 906 } 948 907 949 908 if (state->render_states[WINED3D_RS_SPECULARENABLE]) … … 1296 1255 { 1297 1256 shader_addline(buffer, "const vec4 srgb_const0 = "); 1298 shader_glsl_append_imm_vec4(buffer, srgb_const0);1257 shader_glsl_append_imm_vec4(buffer, wined3d_srgb_const0); 1299 1258 shader_addline(buffer, ";\n"); 1300 1259 shader_addline(buffer, "const vec4 srgb_const1 = "); 1301 shader_glsl_append_imm_vec4(buffer, srgb_const1);1260 shader_glsl_append_imm_vec4(buffer, wined3d_srgb_const1); 1302 1261 shader_addline(buffer, ";\n"); 1303 1262 } … … 1682 1641 { 1683 1642 case WINED3D_DATA_FLOAT: 1684 shader_glsl_ftoa(*(const float *)reg->immconst_data, register_name);1643 wined3d_ftoa(*(const float *)reg->immconst_data, register_name); 1685 1644 break; 1686 1645 case WINED3D_DATA_INT: … … 1702 1661 { 1703 1662 case WINED3D_DATA_FLOAT: 1704 shader_glsl_ftoa(*(const float *)®->immconst_data[0], imm_str[0]);1705 shader_glsl_ftoa(*(const float *)®->immconst_data[1], imm_str[1]);1706 shader_glsl_ftoa(*(const float *)®->immconst_data[2], imm_str[2]);1707 shader_glsl_ftoa(*(const float *)®->immconst_data[3], imm_str[3]);1663 wined3d_ftoa(*(const float *)®->immconst_data[0], imm_str[0]); 1664 wined3d_ftoa(*(const float *)®->immconst_data[1], imm_str[1]); 1665 wined3d_ftoa(*(const float *)®->immconst_data[2], imm_str[2]); 1666 wined3d_ftoa(*(const float *)®->immconst_data[3], imm_str[3]); 1708 1667 sprintf(register_name, "vec4(%s, %s, %s, %s)", 1709 1668 imm_str[0], imm_str[1], imm_str[2], imm_str[3]); … … 4977 4936 break; 4978 4937 shader_addline(buffer, "dir = normalize(dir);\n"); 4979 shader_addline(buffer, "diffuse += ( max(0.0, dot(dir, normal))"4938 shader_addline(buffer, "diffuse += (clamp(dot(dir, normal), 0.0, 1.0)" 4980 4939 " * gl_LightSource[%u].diffuse.xyz) / att;\n", i); 4981 4940 if (settings->localviewer) … … 5002 4961 if (!settings->normal) 5003 4962 break; 5004 shader_addline(buffer, "diffuse += ( max(0.0, dot(dir, normal))"4963 shader_addline(buffer, "diffuse += (clamp(dot(dir, normal), 0.0, 1.0)" 5005 4964 " * gl_LightSource[%u].diffuse.xyz) * att;\n", i); 5006 4965 if (settings->localviewer) … … 5017 4976 break; 5018 4977 shader_addline(buffer, "dir = normalize(gl_LightSource[%u].position.xyz);\n", i); 5019 shader_addline(buffer, "diffuse += max(0.0, dot(dir, normal)) * gl_LightSource[%u].diffuse.xyz;\n", i); 4978 shader_addline(buffer, "diffuse += clamp(dot(dir, normal), 0.0, 1.0)" 4979 " * gl_LightSource[%u].diffuse.xyz;\n", i); 5020 4980 shader_addline(buffer, "t = dot(normal, gl_LightSource[%u].halfVector.xyz);\n", i); 5021 4981 shader_addline(buffer, "if (t > 0.0) specular += pow(t, gl_FrontMaterial.shininess)" … … 5125 5085 5126 5086 case WINED3D_FFP_VS_FOG_DEPTH: 5087 if (settings->ortho_fog) 5088 /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ 5089 shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); 5090 else 5127 5091 shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); 5128 5092 break; … … 5523 5487 { 5524 5488 shader_addline(buffer, "const vec4 srgb_const0 = "); 5525 shader_glsl_append_imm_vec4(buffer, srgb_const0);5489 shader_glsl_append_imm_vec4(buffer, wined3d_srgb_const0); 5526 5490 shader_addline(buffer, ";\n"); 5527 5491 shader_addline(buffer, "const vec4 srgb_const1 = "); 5528 shader_glsl_append_imm_vec4(buffer, srgb_const1);5492 shader_glsl_append_imm_vec4(buffer, wined3d_srgb_const1); 5529 5493 shader_addline(buffer, ";\n"); 5530 5494 } … … 5540 5504 const char *texture_function, *coord_mask; 5541 5505 char tex_reg_name[8]; 5542 BOOL proj , clamp;5506 BOOL proj; 5543 5507 5544 5508 if (!(tex_map & (1 << stage))) … … 5559 5523 proj = TRUE; 5560 5524 } 5561 5562 if (settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP5563 || settings->op[stage].cop == WINED3D_TOP_BUMPENVMAP_LUMINANCE)5564 clamp = FALSE;5565 else5566 clamp = TRUE;5567 5525 5568 5526 switch (settings->op[stage].tex_type) … … 5657 5615 } 5658 5616 5659 if (clamp)5660 shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, ret.%s), 0.0, 1.0);\n",5661 stage, texture_function, stage, coord_mask);5662 else5663 5617 shader_addline(buffer, "tex%u = %s(ps_sampler%u, ret.%s);\n", 5664 5618 stage, texture_function, stage, coord_mask); … … 5670 5624 else if (settings->op[stage].projected == proj_count3) 5671 5625 { 5672 if (clamp)5673 shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, gl_TexCoord[%u].xyz), 0.0, 1.0);\n",5674 stage, texture_function, stage, stage);5675 else5676 5626 shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].xyz);\n", 5677 5627 stage, texture_function, stage, stage); … … 5679 5629 else 5680 5630 { 5681 if (clamp)5682 shader_addline(buffer, "tex%u = clamp(%s(ps_sampler%u, gl_TexCoord[%u].%s), 0.0, 1.0);\n",5683 stage, texture_function, stage, stage, coord_mask);5684 else5685 5631 shader_addline(buffer, "tex%u = %s(ps_sampler%u, gl_TexCoord[%u].%s);\n", 5686 5632 stage, texture_function, stage, stage, coord_mask); … … 6800 6746 caps->xyzrhw = TRUE; 6801 6747 caps->max_active_lights = gl_info->limits.lights; 6802 caps->max_vertex_blend_matrices = 0;6748 caps->max_vertex_blend_matrices = 1; 6803 6749 caps->max_vertex_blend_matrix_index = 0; 6804 6750 caps->vertex_processing_caps = WINED3DVTXPCAPS_TEXGEN … … 6874 6820 { 6875 6821 context->select_shader = 1; 6822 } 6823 6824 static void glsl_vertex_pipe_projection(struct wined3d_context *context, 6825 const struct wined3d_state *state, DWORD state_id) 6826 { 6827 /* Table fog behavior depends on the projection matrix. */ 6828 if (state->render_states[WINED3D_RS_FOGENABLE] 6829 && state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) 6830 context->select_shader = 1; 6831 transform_projection(context, state, state_id); 6876 6832 } 6877 6833 … … 6929 6885 /* Transform states */ 6930 6886 {STATE_TRANSFORM(WINED3D_TS_VIEW), {STATE_TRANSFORM(WINED3D_TS_VIEW), transform_view }, WINED3D_GL_EXT_NONE }, 6931 {STATE_TRANSFORM(WINED3D_TS_PROJECTION), {STATE_TRANSFORM(WINED3D_TS_PROJECTION), transform_projection }, WINED3D_GL_EXT_NONE},6887 {STATE_TRANSFORM(WINED3D_TS_PROJECTION), {STATE_TRANSFORM(WINED3D_TS_PROJECTION), glsl_vertex_pipe_projection}, WINED3D_GL_EXT_NONE }, 6932 6888 {STATE_TRANSFORM(WINED3D_TS_TEXTURE0), {STATE_TEXTURESTAGE(0, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE }, 6933 6889 {STATE_TRANSFORM(WINED3D_TS_TEXTURE1), {STATE_TEXTURESTAGE(1, WINED3D_TSS_TEXTURE_TRANSFORM_FLAGS), NULL }, WINED3D_GL_EXT_NONE }, -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/nvidia_texture_shader.c
r48345 r51270 593 593 } 594 594 595 static void nvrc_resultarg(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) 596 { 597 DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); 598 599 TRACE("Setting result arg for stage %u.\n", stage); 600 601 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP))) 602 { 603 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP)); 604 } 605 if (!isStateDirty(context, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP))) 606 { 607 context_apply_state(context, state, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP)); 608 } 609 } 610 595 611 static void nvts_texdim(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) 596 612 { … … 782 798 { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 783 799 { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 784 { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(0, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },800 { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(0, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 785 801 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE }, 786 802 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, … … 795 811 { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 796 812 { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 797 { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(1, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },813 { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(1, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 798 814 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE }, 799 815 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, … … 808 824 { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 809 825 { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 810 { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(2, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },826 { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(2, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 811 827 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE }, 812 828 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, … … 821 837 { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 822 838 { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 823 { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(3, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },839 { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(3, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 824 840 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE }, 825 841 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, … … 834 850 { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 835 851 { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 836 { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(4, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },852 { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(4, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 837 853 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE }, 838 854 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, … … 847 863 { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 848 864 { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 849 { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(5, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },865 { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(5, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 850 866 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE }, 851 867 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, … … 860 876 { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 861 877 { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 862 { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(6, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },878 { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(6, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 863 879 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), nvrc_colorop }, WINED3D_GL_EXT_NONE }, 864 880 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG1), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, … … 873 889 { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_COLOR_OP), NULL }, WINED3D_GL_EXT_NONE }, 874 890 { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_ARG0), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ALPHA_OP), NULL }, WINED3D_GL_EXT_NONE }, 875 { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(7, WINED3D_TSS_ COLOR_OP), NULL}, WINED3D_GL_EXT_NONE },891 { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), { STATE_TEXTURESTAGE(7, WINED3D_TSS_RESULT_ARG), nvrc_resultarg }, WINED3D_GL_EXT_NONE }, 876 892 { STATE_PIXELSHADER, { STATE_PIXELSHADER, apply_pixelshader }, WINED3D_GL_EXT_NONE }, 877 893 { STATE_RENDER(WINED3D_RS_SRGBWRITEENABLE), { STATE_PIXELSHADER, NULL }, WINED3D_GL_EXT_NONE }, -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/shader.c
r48345 r51270 46 46 static void shader_chache_put(PVBOXEXT_HASHCACHE pCache, struct wined3d_shader *shader); 47 47 #endif 48 49 /* pow, mul_high, sub_high, mul_low */ 50 const float wined3d_srgb_const0[] = {0.41666f, 1.055f, 0.055f, 12.92f}; 51 /* cmp */ 52 const float wined3d_srgb_const1[] = {0.0031308f, 0.0f, 0.0f, 0.0f}; 48 53 49 54 static const char * const shader_opcode_names[] = -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/state.c
r49170 r51270 4755 4755 vp.width, vp.height); 4756 4756 } 4757 4758 if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE)))4759 state_pscale(context, state, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE));4760 4761 4757 checkGLcall("glViewport"); 4762 4758 } … … 4766 4762 if (!isStateDirty(context, STATE_TRANSFORM(WINED3D_TS_PROJECTION))) 4767 4763 transform_projection(context, state, STATE_TRANSFORM(WINED3D_TS_PROJECTION)); 4768 if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE))) 4764 if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE)) 4765 && state->render_states[WINED3D_RS_POINTSCALEENABLE]) 4769 4766 state_pscale(context, state, STATE_RENDER(WINED3D_RS_POINTSCALEENABLE)); 4770 4767 /* Update the position fixup. */ -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/surface.c
r48611 r51270 4392 4392 { 4393 4393 ERR("Not supported on swapchain surfaces.\n"); 4394 return WINEDDERR_NOTFLIPPABLE;4395 }4396 4397 /* Flipping is only supported on render targets and overlays. */4398 if (!(surface->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_OVERLAY)))4399 {4400 WARN("Tried to flip a non-render target, non-overlay surface.\n");4401 4394 return WINEDDERR_NOTFLIPPABLE; 4402 4395 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/swapchain.c
r48345 r51270 158 158 { 159 159 #ifndef VBOX_WITH_WDDM 160 struct wined3d_display_mode mode;161 160 HRESULT hr; 162 161 #endif … … 213 212 if (!swapchain->desc.windowed && swapchain->desc.auto_restore_display_mode) 214 213 { 215 mode.width = swapchain->orig_width;216 mode.height = swapchain->orig_height;217 mode.refresh_rate = 0;218 mode.format_id = swapchain->orig_fmt;219 mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN;220 214 if (FAILED(hr = wined3d_set_adapter_display_mode(swapchain->device->wined3d, 221 swapchain->device->adapter->ordinal, & mode)))215 swapchain->device->adapter->ordinal, &swapchain->original_mode))) 222 216 ERR("Failed to restore display mode, hr %#x.\n", hr); 223 217 } … … 227 221 TRACE("Destroying backup wined3d window %p, dc %p.\n", swapchain->backup_wnd, swapchain->backup_dc); 228 222 229 ReleaseDC(swapchain->backup_wnd, swapchain->backup_dc);223 wined3d_release_dc(swapchain->backup_wnd, swapchain->backup_dc); 230 224 DestroyWindow(swapchain->backup_wnd); 231 225 } … … 1020 1014 const struct wined3d_adapter *adapter = device->adapter; 1021 1015 struct wined3d_resource_desc surface_desc; 1022 const struct wined3d_format *format;1023 struct wined3d_display_mode mode;1024 1016 #ifndef VBOX_WITH_WDDM 1025 1017 BOOL displaymode_set = FALSE; … … 1101 1093 #endif 1102 1094 1103 wined3d_get_adapter_display_mode(device->wined3d, adapter->ordinal, &mode, NULL);1104 1095 #ifndef VBOX_WITH_WDDM 1105 swapchain->orig_width = mode.width; 1106 swapchain->orig_height = mode.height; 1107 swapchain->orig_fmt = mode.format_id; 1108 #endif 1109 format = wined3d_get_format(&adapter->gl_info, mode.format_id); 1096 if (FAILED(hr = wined3d_get_adapter_display_mode(device->wined3d, 1097 adapter->ordinal, &swapchain->original_mode, NULL))) 1098 { 1099 ERR("Failed to get current display mode, hr %#x.\n", hr); 1100 goto err; 1101 } 1102 #endif 1110 1103 1111 1104 GetClientRect(window, &client_rect); … … 1129 1122 if (desc->backbuffer_format == WINED3DFMT_UNKNOWN) 1130 1123 { 1131 desc->backbuffer_format = swapchain->orig _fmt;1132 TRACE("Updating format to %s.\n", debug_d3dformat(swapchain->orig _fmt));1124 desc->backbuffer_format = swapchain->original_mode.format_id; 1125 TRACE("Updating format to %s.\n", debug_d3dformat(swapchain->original_mode.format_id)); 1133 1126 } 1134 1127 #endif … … 1177 1170 mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; 1178 1171 1179 if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, device->adapter->ordinal, &mode)))1172 if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, adapter->ordinal, &mode))) 1180 1173 { 1181 1174 WARN("Failed to set display mode, hr %#x.\n", hr); … … 1198 1191 }; 1199 1192 1200 const struct wined3d_gl_info *gl_info = & device->adapter->gl_info;1193 const struct wined3d_gl_info *gl_info = &adapter->gl_info; 1201 1194 1202 1195 swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); … … 1312 1305 if (displaymode_set) 1313 1306 { 1314 DEVMODEW devmode; 1315 1307 if (FAILED(wined3d_set_adapter_display_mode(device->wined3d, 1308 adapter->ordinal, &swapchain->original_mode))) 1309 ERR("Failed to restore display mode.\n"); 1316 1310 ClipCursor(NULL); 1317 1318 /* Change the display settings */1319 memset(&devmode, 0, sizeof(devmode));1320 devmode.dmSize = sizeof(devmode);1321 devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;1322 devmode.dmBitsPerPel = format->byte_count * CHAR_BIT;1323 devmode.dmPelsWidth = swapchain->orig_width;1324 devmode.dmPelsHeight = swapchain->orig_height;1325 ChangeDisplaySettingsExW(adapter->DeviceName, &devmode, NULL, CDS_FULLSCREEN, NULL);1326 1311 } 1327 1312 #endif -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/utils.c
r48345 r51270 36 36 #include "config.h" 37 37 #include "wine/port.h" 38 39 #include <stdio.h> 38 40 39 41 #include "wined3d_private.h" … … 847 849 NV_TEXTURE_SHADER, NULL}, 848 850 /* Depth stencil formats */ 851 {WINED3DFMT_D16_LOCKABLE, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0, 852 GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, 853 WINED3DFMT_FLAG_DEPTH, 854 WINED3D_GL_EXT_NONE, NULL}, 849 855 {WINED3DFMT_D16_LOCKABLE, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, 850 856 GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, 851 857 WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_SHADOW, 852 858 ARB_DEPTH_TEXTURE, NULL}, 859 {WINED3DFMT_D32_UNORM, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0, 860 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, 861 WINED3DFMT_FLAG_DEPTH, 862 WINED3D_GL_EXT_NONE, NULL}, 853 863 {WINED3DFMT_D32_UNORM, GL_DEPTH_COMPONENT32_ARB, GL_DEPTH_COMPONENT32_ARB, 0, 854 864 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, … … 882 892 | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, 883 893 ARB_FRAMEBUFFER_OBJECT, NULL}, 894 {WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0, 895 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, 896 WINED3DFMT_FLAG_DEPTH, 897 WINED3D_GL_EXT_NONE, NULL}, 884 898 {WINED3DFMT_X8D24_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, 885 899 GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, 0, … … 899 913 WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, 900 914 ARB_FRAMEBUFFER_OBJECT, convert_s4x4_uint_d24_unorm}, 915 {WINED3DFMT_D16_UNORM, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, 0, 916 GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, 917 WINED3DFMT_FLAG_DEPTH, 918 WINED3D_GL_EXT_NONE, NULL}, 901 919 {WINED3DFMT_D16_UNORM, GL_DEPTH_COMPONENT24_ARB, GL_DEPTH_COMPONENT24_ARB, 0, 902 920 GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, 0, … … 3628 3646 } 3629 3647 3648 settings->ortho_fog = 0; 3630 3649 if (!state->render_states[WINED3D_RS_FOGENABLE]) 3631 3650 settings->fog_mode = WINED3D_FFP_VS_FOG_OFF; 3632 3651 else if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) 3652 { 3633 3653 settings->fog_mode = WINED3D_FFP_VS_FOG_DEPTH; 3654 3655 if (state->transforms[WINED3D_TS_PROJECTION].u.m[0][3] == 0.0f 3656 && state->transforms[WINED3D_TS_PROJECTION].u.m[1][3] == 0.0f 3657 && state->transforms[WINED3D_TS_PROJECTION].u.m[2][3] == 0.0f 3658 && state->transforms[WINED3D_TS_PROJECTION].u.m[3][3] == 1.0f) 3659 settings->ortho_fog = 1; 3660 } 3634 3661 else if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE) 3635 3662 settings->fog_mode = WINED3D_FFP_VS_FOG_FOGCOORD; … … 3717 3744 IntersectRect(rect, rect, &state->scissor_rect); 3718 3745 } 3746 3747 /* Print a floating point value with the %.8e format specifier, always using 3748 * '.' as decimal separator. */ 3749 void wined3d_ftoa(float value, char *s) 3750 { 3751 int idx = 1; 3752 #ifdef VBOX_WITH_WINE_FIX_FTOA 3753 const char * pszFormat = "%.8e"; 3754 #endif 3755 3756 if (copysignf(1.0f, value) < 0.0f) 3757 { 3758 #ifdef VBOX_WITH_WINE_FIX_FTOA 3759 /* s passed here is char[16]*/ 3760 pszFormat = "%.7e"; 3761 #endif 3762 ++idx; 3763 } 3764 3765 #ifdef VBOX_WITH_WINE_FIX_FTOA 3766 sprintf(s, pszFormat, value); 3767 #else 3768 sprintf(s, "%.8e", value); 3769 #endif 3770 if (isfinite(value)) 3771 s[idx] = '.'; 3772 } 3773 3774 void wined3d_release_dc(HWND window, HDC dc) 3775 { 3776 /* You'd figure ReleaseDC() would fail if the DC doesn't match the window. 3777 * However, that's not what actually happens, and there are user32 tests 3778 * that confirm ReleaseDC() with the wrong window is supposed to succeed. 3779 * So explicitly check that the DC belongs to the window, since we want to 3780 * avoid releasing a DC that belongs to some other window if the original 3781 * window was already destroyed. */ 3782 if (WindowFromDC(dc) != window) 3783 WARN("DC %p does not belong to window %p.\n", dc, window); 3784 else if (!ReleaseDC(window, dc)) 3785 ERR("Failed to release device context %p, last error %#x.\n", dc, GetLastError()); 3786 } -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_gl.h
r48999 r51270 94 94 ARB_TEXTURE_FLOAT, 95 95 ARB_TEXTURE_MIRRORED_REPEAT, 96 ARB_TEXTURE_MIRROR_CLAMP_TO_EDGE, 96 97 ARB_TEXTURE_NON_POWER_OF_TWO, 97 98 ARB_TEXTURE_RECTANGLE, … … 137 138 EXT_TEXTURE_FILTER_ANISOTROPIC, 138 139 EXT_TEXTURE_LOD_BIAS, 140 EXT_TEXTURE_MIRROR_CLAMP, 139 141 EXT_TEXTURE_SRGB, 140 142 EXT_TEXTURE_SRGB_DECODE, -
trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_private.h
r49170 r51270 1542 1542 CARD_NVIDIA_GEFORCE_GTX650TI = 0x11c6, 1543 1543 CARD_NVIDIA_GEFORCE_GTX660 = 0x11c0, 1544 CARD_NVIDIA_GEFORCE_GTX660M = 0x0fd4, 1544 1545 CARD_NVIDIA_GEFORCE_GTX660TI = 0x1183, 1545 1546 CARD_NVIDIA_GEFORCE_GTX670 = 0x1189, … … 1547 1548 CARD_NVIDIA_GEFORCE_GTX680 = 0x1180, 1548 1549 CARD_NVIDIA_GEFORCE_GTX770M = 0x11e0, 1550 CARD_NVIDIA_GEFORCE_GTX770 = 0x1184, 1549 1551 1550 1552 CARD_INTEL_830M = 0x3577, … … 1790 1792 void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc) DECLSPEC_HIDDEN; 1791 1793 void wined3d_get_draw_rect(const struct wined3d_state *state, RECT *rect) DECLSPEC_HIDDEN; 1794 void wined3d_ftoa(float value, char *s) DECLSPEC_HIDDEN; 1795 1796 extern const float wined3d_srgb_const0[] DECLSPEC_HIDDEN; 1797 extern const float wined3d_srgb_const1[] DECLSPEC_HIDDEN; 1792 1798 1793 1799 enum wined3d_ffp_vs_fog_mode … … 1822 1828 DWORD fog_mode : 2; 1823 1829 DWORD texcoords : 8; /* MAX_TEXTURES */ 1824 DWORD padding : 15; 1830 DWORD ortho_fog : 1; 1831 DWORD padding : 14; 1825 1832 1826 1833 BYTE texgen[MAX_TEXTURES]; … … 2701 2708 struct wined3d_swapchain_desc desc; 2702 2709 #ifndef VBOX_WITH_WDDM 2703 DWORD orig_width, orig_height; 2704 enum wined3d_format_id orig_fmt; 2710 struct wined3d_display_mode original_mode; 2705 2711 struct wined3d_gamma_ramp orig_gamma; 2706 2712 #endif … … 2837 2843 unsigned int count_bits(unsigned int mask) DECLSPEC_HIDDEN; 2838 2844 2845 void wined3d_release_dc(HWND window, HDC dc) DECLSPEC_HIDDEN; 2846 2839 2847 struct wined3d_shader_lconst 2840 2848 { … … 3185 3193 #endif 3186 3194 3187 #endif 3195 #if defined(VBOX) 3196 # if defined(RT_ARCH_AMD64) 3197 # define copysignf _copysignf 3198 # else 3199 # define _VBOX_BITVAL_CAST(_t, _f) (*((const _t*)((const void*)(&(_f))))) 3200 # define _VBOX_BITVAL_TO_FLOATL(_f) _VBOX_BITVAL_CAST(float, _f) 3201 # define _VBOX_BITVAL_FROM_FLOAT(_f) _VBOX_BITVAL_CAST(uint32_t, _f) 3202 DECLINLINE(float) copysignf(float val, float sign) 3203 { 3204 uint32_t u32Val = ((_VBOX_BITVAL_FROM_FLOAT(val) & 0x7fffffff) | (_VBOX_BITVAL_FROM_FLOAT(sign) & 0x80000000)); 3205 return _VBOX_BITVAL_TO_FLOATL(u32Val); 3206 } 3207 # endif 3208 3209 # define isfinite _finite 3210 3211 #endif 3212 3213 #endif
Note:
See TracChangeset
for help on using the changeset viewer.