VirtualBox

Changeset 48073 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
Aug 26, 2013 9:24:22 PM (11 years ago)
Author:
vboxsync
Message:

wined3d: update to wine 1.6

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  
    988988        resource = wined3d_texture_get_sub_resource(object->wined3d_texture, 0);
    989989        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);
    991991    }
    992992
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/vbox/libWineStub/include/wine/port.h

    r46521 r48073  
    237237#endif
    238238
    239 #ifndef HAVE_GETOPT_LONG
     239#ifndef HAVE_GETOPT_LONG_ONLY
    240240extern char *optarg;
    241241extern int optind;
     
    260260                             const char *__shortopts,
    261261                             const struct option *__longopts, int *__longind);
    262 #endif  /* HAVE_GETOPT_LONG */
     262#endif  /* HAVE_GETOPT_LONG_ONLY */
    263263
    264264#ifndef HAVE_FFS
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/vbox/libWineStub/include/wine/wined3d.h

    r46966 r48073  
    23632363HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface,
    23642364        DWORD flags, const struct wined3d_color_key *color_key);
    2365 HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem);
     2365HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem, UINT pitch);
    23662366HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y);
    23672367void __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  
    4040WINE_DECLARE_DEBUG_CHANNEL(d3d);
    4141
     42/* sRGB correction constants */
     43static const float srgb_cmp = 0.0031308f;
     44static const float srgb_mul_low = 12.92f;
     45static const float srgb_pow = 0.41666f;
     46static const float srgb_mul_high = 1.055f;
     47static const float srgb_sub_high = 0.055f;
     48
    4249static BOOL shader_is_pshader_version(enum wined3d_shader_type type)
    4350{
     
    272279    unsigned int                        num_loops, loop_depth, num_ifcs;
    273280    int                                 aL;
     281    BOOL                                ps_post_process;
    274282
    275283    unsigned int                        vs_clipplanes;
     
    11541162
    11551163        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)
    11571165            {
    11581166                strcpy(register_name, "TMP_COLOR");
     
    16231631    shader_arb_get_src_param(ins, &ins->src[1], 1, src_name[1]);
    16241632
    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)
    16271635    {
    16281636        shader_addline(buffer, "MOV%s %s, %s;\n", shader_arb_get_modifier(ins), dst_name, src_name[1]);
     
    18441852    else if (ins->dst[0].reg.type == WINED3DSPR_COLOROUT && !ins->dst[0].reg.idx[0].offset && pshader)
    18451853    {
    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");
    18491857            return;
    18501858        }
     
    35533561}
    35543562
     3563static 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
    35553571/* Context activation is done by the caller. */
    35563572static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
     
    35693585    GLint errPos;
    35703586    DWORD map;
     3587    BOOL custom_linear_fog = FALSE;
    35713588
    35723589    char srgbtmp[4][4];
     
    36163633    init_ps_input(shader, args, &priv_ctx);
    36173634    list_init(&priv_ctx.control_frames);
     3635    priv_ctx.ps_post_process = args->super.srgb_correction;
    36183636
    36193637    /* Avoid enabling NV_fragment_program* if we do not need it.
     
    36683686                break;
    36693687            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                }
    36703694                shader_addline(buffer, "OPTION ARB_fog_linear;\n");
    36713695                break;
     
    36973721    else
    36983722    {
    3699         if (args->super.srgb_correction)
     3723        if (priv_ctx.ps_post_process)
    37003724        {
    37013725            if (shader->u.ps.color0_mov)
     
    38473871                                  priv_ctx.target_version >= NV2);
    38483872    }
     3873
     3874    if (custom_linear_fog)
     3875        arbfp_add_linear_fog(buffer, fragcolor, "TA");
    38493876
    38503877    if(strcmp(fragcolor, "result.color")) {
     
    61416168    const char *final_combiner_src = "ret";
    61426169    GLint pos;
     6170    BOOL custom_linear_fog = FALSE;
    61436171
    61446172    /* Find out which textures are read */
     
    62136241    {
    62146242        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
    62166252        case WINED3D_FFP_PS_FOG_EXP:    shader_addline(&buffer, "OPTION ARB_fog_exp;\n");    break;
    62176253        case WINED3D_FFP_PS_FOG_EXP2:   shader_addline(&buffer, "OPTION ARB_fog_exp2;\n");   break;
     
    63786414    }
    63796415
    6380     if(settings->sRGB_write) {
     6416    if (settings->sRGB_write || custom_linear_fog)
     6417    {
    63816418        shader_addline(&buffer, "MAD ret, fragment.color.secondary, specular_enable, %s;\n", final_combiner_src);
     6419        if (settings->sRGB_write)
    63826420        arbfp_add_sRGB_correction(&buffer, "ret", "arg0", "arg1", "arg2", "tempreg", FALSE);
     6421        if (custom_linear_fog)
     6422            arbfp_add_linear_fog(&buffer, "ret", "arg0");
    63836423        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);
    63866429    }
    63876430
     
    65076550{
    65086551    enum fogsource new_source;
     6552    DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
     6553    DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
    65096554
    65106555    TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
     
    65356580    }
    65366581
    6537     if (new_source != context->fog_source)
     6582    if (new_source != context->fog_source || fogstart == fogend)
    65386583    {
    65396584        context->fog_source = new_source;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/buffer.c

    r46521 r48073  
    298298
    299299static 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,
    301301        DWORD *stride_this_run
    302302#ifdef VBOX_WITH_WINE_FIX_BUFOFFSET
     
    328328        if (!is_ffp_color) FIXME("Test for non-color fixed function WINED3DFMT_B8G8R8A8_UNORM format\n");
    329329    }
    330     else if (is_ffp_position && si->position_transformed)
     330    else if (check_position && si->position_transformed)
    331331    {
    332332        if (format != WINED3DFMT_R32G32B32A32_FLOAT)
     
    357357{
    358358    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;
    360360    const struct wined3d_stream_info *si = &device->stream_info;
    361361    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;
    362364    UINT stride_this_run = 0;
    363365#ifdef VBOX_WITH_WINE_FIX_BUFOFFSET
     
    365367#endif
    366368    BOOL ret = FALSE;
    367     BOOL support_d3dcolor = gl_info->supported[ARB_VERTEX_ARRAY_BGRA];
    368369
    369370    /* In d3d7 the vertex buffer declaration NEVER changes because it is stored in the d3d7 vertex buffer.
     
    437438
    438439    ret = buffer_check_attribute(This, si, WINED3D_FFP_POSITION,
    439             TRUE, TRUE,  FALSE, &stride_this_run
     440            TRUE, !support_xyzrhw,  FALSE, &stride_this_run
    440441#ifdef VBOX_WITH_WINE_FIX_BUFOFFSET
    441442                , &offset_this_run
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/device.c

    r46966 r48073  
    341341                & ((1 << WINED3D_FFP_DIFFUSE) | (1 << WINED3D_FFP_SPECULAR));
    342342
    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)
    345345            device->useDrawStridedSlow = TRUE;
    346         }
    347346        else
    348         {
    349347            device->useDrawStridedSlow = FALSE;
    350348        }
    351     }
    352349
    353350    if (prev_all_vbo != stream_info->all_vbo)
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/directx.c

    r46593 r48073  
    813813}
    814814
     815static 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
    815910static void quirk_apple_glsl_constants(struct wined3d_gl_info *gl_info)
    816911{
     
    9361031}
    9371032
     1033static void quirk_broken_arb_fog(struct wined3d_gl_info *gl_info)
     1034{
     1035    gl_info->quirks |= WINED3D_QUIRK_BROKEN_ARB_FOG;
     1036}
     1037
    9381038#ifdef VBOX_WITH_WINE_FIX_QUIRKS
    9391039static BOOL match_ati_hd4800(const struct wined3d_gl_info *gl_info, const char *gl_renderer,
     
    10701170        quirk_r200_constants,
    10711171        "r200 vertex shader constants"
     1172    },
     1173    {
     1174        match_broken_arb_fog,
     1175        quirk_broken_arb_fog,
     1176        "ARBfp fogstart == fogend workaround"
    10721177    },
    10731178#ifdef VBOX_WITH_WINE_FIX_QUIRKS
     
    12541359    {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX660TI,   "NVIDIA GeForce GTX 660 Ti",        DRIVER_NVIDIA_GEFORCE6,  2048},
    12551360    {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},
    12561362    {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},
    12571364
    12581365    /* AMD cards */
     
    16651772        cards[] =
    16661773        {
     1774            {"GTX 770M",    CARD_NVIDIA_GEFORCE_GTX770M},   /* Geforce 700 - midend high mobile */
    16671775            {"GTX 680",     CARD_NVIDIA_GEFORCE_GTX680},    /* Geforce 600 - highend */
     1776            {"GTX 670MX",   CARD_NVIDIA_GEFORCE_GTX670MX},  /* Geforce 600 - highend */
    16681777            {"GTX 670",     CARD_NVIDIA_GEFORCE_GTX670},    /* Geforce 600 - midend high */
    16691778            {"GTX 660 Ti",  CARD_NVIDIA_GEFORCE_GTX660TI},  /* Geforce 600 - midend high */
     
    21642273    {
    21652274        /* Kepler */
     2275        {"NVE6",    CARD_NVIDIA_GEFORCE_GTX770M},
    21662276        {"NVE4",    CARD_NVIDIA_GEFORCE_GTX680},
    21672277        /* Fermi */
     
    27902900    const char *gl_vendor_str, *gl_renderer_str, *gl_version_str;
    27912901    struct wined3d_gl_info *gl_info = &adapter->gl_info;
     2902    struct wined3d_vertex_caps vertex_caps;
    27922903    enum wined3d_pci_vendor card_vendor;
    27932904    struct fragment_caps fragment_caps;
     
    30193130    adapter->d3d_info.limits.vs_uniform_count = shader_caps.vs_uniform_count;
    30203131    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;
    30213135
    30223136    adapter->fragment_pipe->get_caps(gl_info, &fragment_caps);
     
    48704984}
    48714985
    4872 static void fillGLAttribFuncs(const struct wined3d_gl_info *gl_info)
    4873 {
     4986static 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
    48744991    position_funcs[WINED3D_FFP_EMIT_FLOAT1]      = invalid_func;
    48754992    position_funcs[WINED3D_FFP_EMIT_FLOAT2]      = invalid_func;
    48764993    position_funcs[WINED3D_FFP_EMIT_FLOAT3]      = (glAttribFunc)gl_info->gl_ops.gl.p_glVertex3fv;
     4994    if (!d3d_info->xyzrhw)
    48774995    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;
    48784998    position_funcs[WINED3D_FFP_EMIT_D3DCOLOR]    = position_d3dcolor;
    48794999    position_funcs[WINED3D_FFP_EMIT_UBYTE4]      = invalid_func;
     
    52975417    WineD3D_ReleaseFakeGLContext(&fake_gl_ctx);
    52985418
    5299     fillGLAttribFuncs(&adapter->gl_info);
     5419    wined3d_adapter_init_ffp_attrib_ops(adapter);
    53005420
    53015421#ifdef VBOX_WITH_WDDM
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/glsl_shader.c

    r47061 r48073  
    3838#include "wined3d_private.h"
    3939
     40#if defined(VBOX) && defined(RT_ARCH_AMD64)
     41# define copysignf _copysignf
     42#endif
     43
    4044WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
    4145WINE_DECLARE_DEBUG_CHANNEL(d3d_constants);
     
    4751#define WINED3D_GLSL_SAMPLE_LOD         0x4
    4852#define WINED3D_GLSL_SAMPLE_GRAD        0x8
     53
     54static const float srgb_const0[] = {0.41666f, 1.055f, 0.055f, 12.92f};  /* pow, mul_high, sub_high, mul_low */
     55static const float srgb_const1[] = {0.0031308f, 0.0f, 0.0f, 0.0f};      /* cmp */
    4956
    5057struct glsl_dst_param
     
    241248            return "unknown";
    242249    }
     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. */
     255static 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
     303static 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]);
    243312}
    244313
     
    12071276        if (ps_args->srgb_correction)
    12081277        {
    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");
    12131284        }
    12141285        if (reg_maps->vpos || reg_maps->usesdsy)
     
    12221293            else
    12231294            {
    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. */
    12271306                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");
    12311310            }
    12321311            shader_addline(buffer, "vec4 vpos;\n");
     
    12621341        LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, struct wined3d_shader_lconst, entry)
    12631342        {
    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");
    12681346        }
    12691347    }
     
    13891467    const char *prefix = shader_glsl_get_prefix(version->type);
    13901468    struct glsl_src_param rel_param0, rel_param1;
     1469    char imm_str[4][16];
    13911470
    13921471    if (reg->idx[0].offset != ~0U && reg->idx[0].rel_addr)
     
    15841663                    {
    15851664                        case WINED3D_DATA_FLOAT:
    1586                             sprintf(register_name, "%.8e", *(const float *)reg->immconst_data);
     1665                            shader_glsl_ftoa(*(const float *)reg->immconst_data, register_name);
    15871666                            break;
    15881667                        case WINED3D_DATA_INT:
     
    16041683                    {
    16051684                        case WINED3D_DATA_FLOAT:
    1606                             sprintf(register_name, "vec4(%.8e, %.8e, %.8e, %.8e)",
    1607                                     *(const float *)&reg->immconst_data[0], *(const float *)&reg->immconst_data[1],
    1608                                     *(const float *)&reg->immconst_data[2], *(const float *)&reg->immconst_data[3]);
     1685                            shader_glsl_ftoa(*(const float *)&reg->immconst_data[0], imm_str[0]);
     1686                            shader_glsl_ftoa(*(const float *)&reg->immconst_data[1], imm_str[1]);
     1687                            shader_glsl_ftoa(*(const float *)&reg->immconst_data[2], imm_str[2]);
     1688                            shader_glsl_ftoa(*(const float *)&reg->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]);
    16091691                            break;
    16101692                        case WINED3D_DATA_INT:
     
    29563038        shader_glsl_add_src_param(ins, &ins->src[2], write_mask, &src2_param);
    29573039
    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)
    29613041            shader_addline(ins->ctx->buffer, "%s /* COISSUE! */);\n", src1_param.param_str);
    2962         } else {
     3042        else
    29633043            shader_addline(ins->ctx->buffer, "%s > 0.5 ? %s : %s);\n",
    29643044                    src0_param.param_str, src1_param.param_str, src2_param.param_str);
    2965         }
    29663045        return;
    29673046    }
     
    49535032    shader_addline(buffer, "vec3 r;\n");
    49545033
     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    {
    49555042    shader_addline(buffer, "vec4 ec_pos = gl_ModelViewMatrix * gl_Vertex;\n");
    49565043    shader_addline(buffer, "gl_Position = gl_ProjectionMatrix * ec_pos;\n");
     
    49585045        shader_addline(buffer, "gl_ClipVertex = ec_pos;\n");
    49595046    shader_addline(buffer, "ec_pos /= ec_pos.w;\n");
     5047    }
    49605048
    49615049    if (!settings->normal)
     
    54155503    if (settings->sRGB_write)
    54165504    {
    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");
    54215511    }
    54225512
     
    66896779static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps)
    66906780{
     6781    caps->xyzrhw = TRUE;
    66916782    caps->max_active_lights = gl_info->limits.lights;
    66926783    caps->max_vertex_blend_matrices = 0;
     
    68516942    {STATE_RENDER(WINED3D_RS_LIGHTING),                          {STATE_VDECL,                                                NULL                   }, WINED3D_GL_EXT_NONE          },
    68526943    {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          },
    68546945    {STATE_RENDER(WINED3D_RS_LOCALVIEWER),                       {STATE_VDECL,                                                NULL                   }, WINED3D_GL_EXT_NONE          },
    68556946    {STATE_RENDER(WINED3D_RS_NORMALIZENORMALS),                  {STATE_VDECL,                                                NULL                   }, WINED3D_GL_EXT_NONE          },
     
    70367127    BOOL use_vshader = use_vs(state);
    70377128    enum fogsource new_source;
     7129    DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
     7130    DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
    70387131
    70397132    context->select_shader = 1;
     
    70577150    }
    70587151
    7059     if (new_source != context->fog_source)
     7152    if (new_source != context->fog_source || fogstart == fogend)
    70607153    {
    70617154        context->fog_source = new_source;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/state.c

    r46521 r48073  
    10481048            tmpvalue.d = state->render_states[WINED3D_RS_FOGEND];
    10491049            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            {
    10521057                fogstart = -INFINITY;
    10531058                fogend = 0.0f;
     
    10771082    const struct wined3d_gl_info *gl_info = context->gl_info;
    10781083    enum fogsource new_source;
     1084    DWORD fogstart = state->render_states[WINED3D_RS_FOGSTART];
     1085    DWORD fogend = state->render_states[WINED3D_RS_FOGEND];
    10791086
    10801087    TRACE("context %p, state %p, state_id %#x.\n", context, state, state_id);
     
    12221229    glEnableWINE(GL_FOG);
    12231230    checkGLcall("glEnable GL_FOG");
    1224     if (new_source != context->fog_source)
     1231    if (new_source != context->fog_source || fogstart == fogend)
    12251232    {
    12261233        context->fog_source = new_source;
     
    45794586            transform_world(context, state, STATE_TRANSFORM(WINED3D_TS_WORLD_MATRIX(0)));
    45804587        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));
    45824589        if (!isStateDirty(context, STATE_RENDER(WINED3D_RS_LIGHTING)))
    45834590            state_lighting(context, state, STATE_RENDER(WINED3D_RS_LIGHTING));
     
    56465653static void vp_ffp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps)
    56475654{
     5655    caps->xyzrhw = FALSE;
    56485656    caps->max_active_lights = gl_info->limits.lights;
    56495657    caps->max_vertex_blend_matrices = gl_info->limits.blends;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/surface.c

    r46886 r48073  
    141141
    142142    if (surface->flags & SFLAG_USERPTR)
    143         wined3d_surface_set_mem(surface, NULL);
     143        wined3d_surface_set_mem(surface, NULL, 0);
    144144    if (surface->overlay_dest)
    145145        list_remove(&surface->overlay_entry);
     
    25242524            dst_data = surface->resource.allocatedMemory;
    25252525            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)
    25272527            {
    2528                 /* skip the first row */
     2528                memcpy(dst_data, src_data, dst_pitch);
    25292529                src_data += src_pitch;
    25302530                dst_data += dst_pitch;
    2531                 memcpy(dst_data, src_data, dst_pitch);
    25322531            }
    25332532
     
    34883487    TRACE("surface %p.\n", surface);
    34893488
     3489    if (surface->pitch)
     3490        return surface->pitch;
     3491
    34903492    if (format->flags & WINED3DFMT_FLAG_BLOCKS)
    34913493    {
     
    35073509}
    35083510
    3509 HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem)
     3511HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem, UINT pitch)
    35103512{
    35113513#ifndef VBOX_WITH_WDDM
     
    35763578        surface_modify_location(surface, SFLAG_INSYSMEM, TRUE);
    35773579    }
     3580
     3581    surface->pitch = pitch;
    35783582
    35793583    return WINED3D_OK;
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/utils.c

    r46521 r48073  
    35573557        memset(settings, 0, sizeof(*settings));
    35583558
    3559         settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
    3560                 && state->render_states[WINED3D_RS_CLIPPLANEENABLE];
     3559        settings->transformed = 1;
    35613560        settings->point_size = state->gl_primitive_type == GL_POINTS;
    35623561        if (!state->render_states[WINED3D_RS_FOGENABLE])
     
    35783577    }
    35793578
     3579    settings->transformed = 0;
    35803580    settings->clipping = state->render_states[WINED3D_RS_CLIPPING]
    35813581            && state->render_states[WINED3D_RS_CLIPPLANEENABLE];
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d.spec

    r46521 r48073  
    227227@ cdecl wined3d_surface_restore(ptr)
    228228@ 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)
    230230@ cdecl wined3d_surface_set_overlay_position(ptr long long)
    231231@ cdecl wined3d_surface_set_palette(ptr ptr)
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine_new/wined3d/wined3d_private.h

    r46521 r48073  
    8787#define WINED3D_QUIRK_INFO_LOG_SPAM             0x00000080
    8888#define WINED3D_QUIRK_LIMITED_TEX_FILTERING     0x00000100
     89#define WINED3D_QUIRK_BROKEN_ARB_FOG            0x00000200
    8990#ifdef VBOX_WITH_WINE_FIX_QUIRKS
    9091#define WINED3D_QUIRK_FULLSIZE_BLIT             0x02000000
     
    12511252struct wined3d_vertex_caps
    12521253{
     1254    BOOL xyzrhw;
    12531255    DWORD max_active_lights;
    12541256    DWORD max_vertex_blend_matrices;
     
    15331535    CARD_NVIDIA_GEFORCE_GTX660TI    = 0x1183,
    15341536    CARD_NVIDIA_GEFORCE_GTX670      = 0x1189,
     1537    CARD_NVIDIA_GEFORCE_GTX670MX    = 0x11a1,
    15351538    CARD_NVIDIA_GEFORCE_GTX680      = 0x1180,
     1539    CARD_NVIDIA_GEFORCE_GTX770M     = 0x11e0,
    15361540
    15371541    CARD_INTEL_830M                 = 0x3577,
     
    16771681{
    16781682    struct wined3d_d3d_limits limits;
     1683    BOOL xyzrhw;
    16791684    BOOL vs_clipping;
    16801685    DWORD valid_rt_mask;
     
    17991804    DWORD specular_source : 2;
    18001805
     1806    DWORD transformed     : 1;
    18011807    DWORD clipping        : 1;
    18021808    DWORD normal          : 1;
     
    18071813    DWORD fog_mode        : 2;
    18081814    DWORD texcoords       : 8;  /* MAX_TEXTURES */
    1809     DWORD padding         : 16;
     1815    DWORD padding         : 15;
    18101816
    18111817    BYTE texgen[MAX_TEXTURES];
     
    22152221    DWORD flags;
    22162222
     2223    UINT pitch;
    22172224    UINT                      pow2Width;
    22182225    UINT                      pow2Height;
     
    30093016#endif
    30103017
    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 
    30183018struct wined3d_palette
    30193019{
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette