VirtualBox

Changeset 43333 in vbox


Ignore:
Timestamp:
Sep 14, 2012 5:23:08 PM (12 years ago)
Author:
vboxsync
Message:

wined3d: fix glsl shader generation

File:
1 edited

Legend:

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

    r41821 r43333  
    340340static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_info, GLhandleARB program)
    341341{
    342     GLint i, object_count, source_size;
     342    GLint i, object_count;
    343343    GLhandleARB *objects;
    344344    char *source = NULL;
     
    39663966}
    39673967
     3968static void generate_texcoord_assignment(struct wined3d_shader_buffer *buffer, IWineD3DVertexShaderImpl *vs, IWineD3DPixelShaderImpl *ps)
     3969{
     3970    DWORD map;
     3971    unsigned int i;
     3972    char reg_mask[6];
     3973
     3974    for (i = 0, map = ps->baseShader.reg_maps.texcoord; map && i < min(8, MAX_REG_TEXCRD); map >>= 1, ++i)
     3975    {
     3976        if (!map & 1)
     3977            continue;
     3978
     3979        /* so far we assume that if texcoord_mask has any write flags, they are assigned appropriately with pixel shader */
     3980        if ((vs->baseShader.reg_maps.texcoord_mask[i]) & WINED3DSP_WRITEMASK_ALL)
     3981            continue;
     3982
     3983        shader_glsl_write_mask_to_str(WINED3DSP_WRITEMASK_ALL, reg_mask);
     3984        shader_addline(buffer, "gl_TexCoord[%u]%s = gl_MultiTexCoord%u%s;\n", i, reg_mask, i, reg_mask);
     3985    }
     3986}
     3987
    39683988/* GL locking is done by the caller */
    39693989static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer,
     
    40034023            shader_addline(buffer, "}\n");
    40044024        } else {
    4005             shader_addline(buffer, "void order_ps_input() { /* do nothing */ }\n");
     4025            shader_addline(buffer, "void order_ps_input() {\n");
     4026            generate_texcoord_assignment(buffer, vs, ps);
     4027            shader_addline(buffer, "}\n");
    40064028        }
    40074029    } else if(ps_major < 3 && vs_major >= 3) {
     
    46374659    GL_EXTCALL(glUseProgramObjectARB(programId));
    46384660    checkGLcall("glUseProgramObjectARB(programId)");
     4661
     4662#ifdef DEBUG_misha
     4663    {
     4664        GLint programIdTest = -1;
     4665        glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
     4666        Assert(programIdTest == programId);
     4667    }
     4668#endif
    46394669
    46404670    /* Load the vertex and pixel samplers now. The function that finds the mappings makes sure
     
    47734803    GL_EXTCALL(glUseProgramObjectARB(program_id));
    47744804    checkGLcall("glUseProgramObjectARB");
     4805#ifdef DEBUG_misha
     4806    {
     4807        GLint programIdTest = -1;
     4808        glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
     4809        Assert(programIdTest == program_id);
     4810    }
     4811#endif
    47754812
    47764813    /* In case that NP2 texcoord fixup data is found for the selected program, trigger a reload of the
     
    47954832        loc = GL_EXTCALL(glGetUniformLocationARB(*blt_program, "sampler"));
    47964833        GL_EXTCALL(glUseProgramObjectARB(*blt_program));
     4834#ifdef DEBUG_misha
     4835        {
     4836            GLint programIdTest = -1;
     4837            glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
     4838            Assert(programIdTest == *blt_program);
     4839        }
     4840#endif
    47974841        GL_EXTCALL(glUniform1iARB(loc, 0));
    47984842    } else {
    47994843        GL_EXTCALL(glUseProgramObjectARB(*blt_program));
     4844#ifdef DEBUG_misha
     4845        {
     4846            GLint programIdTest = -1;
     4847            glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
     4848            Assert(programIdTest == *blt_program);
     4849        }
     4850#endif
    48004851    }
    48014852}
     
    48134864    GL_EXTCALL(glUseProgramObjectARB(program_id));
    48144865    checkGLcall("glUseProgramObjectARB");
     4866#ifdef DEBUG_misha
     4867    {
     4868        GLint programIdTest = -1;
     4869        glGetIntegerv(GL_CURRENT_PROGRAM,  &programIdTest);
     4870        Assert(programIdTest == program_id);
     4871    }
     4872#endif
    48154873}
    48164874
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