VirtualBox

Ignore:
Timestamp:
Jul 16, 2010 5:11:31 PM (14 years ago)
Author:
vboxsync
Message:

wddm/3d: Aero working cleanly!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Wine/wined3d/glsl_shader.c

    r28475 r30885  
    126126    struct ps_compile_args      ps_args;
    127127    UINT                        constant_version;
     128#ifdef VBOXWDDM
     129    UINT                        inp2Fixup_info;
     130#else
    128131    const struct ps_np2fixup_info *np2Fixup_info;
     132#endif
    129133};
     134
     135#ifdef VBOXWDDM
     136#define WINEFIXUPINFO_NOINDEX (~0UL)
     137#define WINEFIXUPINFO_GET(_p) get_fixup_info((const IWineD3DPixelShaderImpl*)(_p)->pshader, (_p)->inp2Fixup_info)
     138#define WINEFIXUPINFO_ISVALID(_p) ((_p)->inp2Fixup_info != WINEFIXUPINFO_NOINDEX)
     139#define WINEFIXUPINFO_INIT(_p) ((_p)->inp2Fixup_info == WINEFIXUPINFO_NOINDEX)
     140#else
     141#define WINEFIXUPINFO_GET(_p) ((_p)->np2Fixup_info)
     142#define WINEFIXUPINFO_ISVALID(_p) (!!(_p)->np2Fixup_info)
     143#define WINEFIXUPINFO_INIT(_p) ((_p)->np2Fixup_info == NULL)
     144#endif
    130145
    131146typedef struct {
     
    673688}
    674689
     690#ifdef VBOXWDDM
     691static const struct ps_np2fixup_info * get_fixup_info(const IWineD3DPixelShaderImpl *shader, UINT inp2fixup_info)
     692{
     693    struct glsl_pshader_private    *shader_data = shader->baseShader.backend_data;
     694
     695    if (inp2fixup_info == WINEFIXUPINFO_NOINDEX)
     696        return NULL;
     697
     698    if (!shader->baseShader.backend_data)
     699    {
     700        ERR("no backend data\n");
     701        return NULL;
     702    }
     703    shader_data = shader->baseShader.backend_data;
     704
     705    if (inp2fixup_info >= shader_data->num_gl_shaders)
     706    {
     707        ERR("invalid index\n");
     708        return NULL;
     709    }
     710
     711    return &shader_data->gl_shaders[inp2fixup_info].np2fixup;
     712}
     713#endif
     714
    675715/**
    676716 * Loads the texture dimensions for NP2 fixup into the currently set GLSL program.
     
    702742        GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS];
    703743
     744        const struct ps_np2fixup_info *np2Fixup_info = WINEFIXUPINFO_GET(prog);
     745
    704746        for (i = 0; fixup; fixup >>= 1, ++i) {
    705             const unsigned char idx = prog->np2Fixup_info->idx[i];
     747            const unsigned char idx = np2Fixup_info->idx[i];
    706748            const IWineD3DBaseTextureImpl* const tex = (const IWineD3DBaseTextureImpl*) stateBlock->textures[i];
    707749            GLfloat* tex_dim = &np2fixup_constants[(idx >> 1) * 4];
     
    719761        }
    720762
    721         GL_EXTCALL(glUniform4fvARB(prog->np2Fixup_location, prog->np2Fixup_info->num_consts, np2fixup_constants));
     763        GL_EXTCALL(glUniform4fvARB(prog->np2Fixup_location, np2Fixup_info->num_consts, np2fixup_constants));
    722764    }
    723765}
     
    41364178static GLhandleARB find_glsl_pshader(const struct wined3d_context *context,
    41374179        struct wined3d_shader_buffer *buffer, IWineD3DPixelShaderImpl *shader,
    4138         const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info)
     4180        const struct ps_compile_args *args,
     4181#ifdef VBOXWDDM
     4182        UINT *inp2fixup_info
     4183#else
     4184        const struct ps_np2fixup_info **np2fixup_info
     4185#endif
     4186        )
    41394187{
    41404188    UINT i;
     
    41624210    for(i = 0; i < shader_data->num_gl_shaders; i++) {
    41634211        if(memcmp(&shader_data->gl_shaders[i].args, args, sizeof(*args)) == 0) {
    4164             if(args->np2_fixup) *np2fixup_info = &shader_data->gl_shaders[i].np2fixup;
     4212            if(args->np2_fixup) {
     4213#ifdef VBOXWDDM
     4214                *inp2fixup_info = i;
     4215#else
     4216                *np2fixup_info = &shader_data->gl_shaders[i].np2fixup;
     4217#endif
     4218            }
    41654219            return shader_data->gl_shaders[i].prgId;
    41664220        }
     
    41974251    shader_buffer_clear(buffer);
    41984252    ret = shader_glsl_generate_pshader(context, buffer, shader, args, np2fixup);
     4253#ifdef VBOXWDDM
     4254    *inp2fixup_info = shader_data->num_gl_shaders;
     4255#else
     4256    *np2fixup_info = np2fixup;
     4257#endif
    41994258    shader_data->gl_shaders[shader_data->num_gl_shaders++].prgId = ret;
    4200     *np2fixup_info = np2fixup;
    42014259
    42024260    return ret;
     
    43184376    entry->ps_args = ps_compile_args;
    43194377    entry->constant_version = 0;
    4320     entry->np2Fixup_info = NULL;
     4378    WINEFIXUPINFO_INIT(entry);
    43214379    /* Add the hash table entry */
    43224380    add_glsl_program_entry(priv, entry);
     
    43714429    {
    43724430        GLhandleARB pshader_id = find_glsl_pshader(context, &priv->shader_buffer,
    4373                 (IWineD3DPixelShaderImpl *)pshader, &ps_compile_args, &entry->np2Fixup_info);
     4431                (IWineD3DPixelShaderImpl *)pshader, &ps_compile_args,
     4432#ifdef VBOXWDDM
     4433                &entry->inp2Fixup_info
     4434#else
     4435                &entry->np2Fixup_info
     4436#endif
     4437                );
    43744438        TRACE("Attaching GLSL shader object %u to program %u\n", pshader_id, programId);
    43754439        GL_EXTCALL(glAttachObjectARB(programId, pshader_id));
     
    44224486
    44234487        if (ps_compile_args.np2_fixup) {
    4424             if (entry->np2Fixup_info) {
     4488            if (WINEFIXUPINFO_ISVALID(entry)) {
    44254489                entry->np2Fixup_location = GL_EXTCALL(glGetUniformLocationARB(programId, "PsamplerNP2Fixup"));
    44264490            } else {
     
    45854649     * constants. This has to be done because it can't be guaranteed that sampler() (from state.c) is
    45864650     * called between selecting the shader and using it, which results in wrong fixup for some frames. */
    4587     if (priv->glsl_program && priv->glsl_program->np2Fixup_info)
     4651    if (priv->glsl_program && WINEFIXUPINFO_ISVALID(priv->glsl_program))
    45884652    {
    45894653        shader_glsl_load_np2fixup_constants((IWineD3DDevice *)device, usePS, useVS);
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