VirtualBox

Ignore:
Timestamp:
Nov 9, 2014 8:53:41 PM (10 years ago)
Author:
vboxsync
Message:

glsl_shader.c: Corrected return value of shader_glsl_generate_vshader and shader_glsl_generate_pshader. Corrected WINEFIXUPINFO_NOINDEX and WINEFIXUPINFO_INIT (both made sure the NOINDEX stuff never worked). Fixed printf format warnings on logging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/shaderlib/glsl_shader.c

    r53222 r53277  
    139139};
    140140
     141#ifdef VBOX_WITH_VMSVGA
     142# define WINEFIXUPINFO_NOINDEX (~0U)
     143#else
    141144#define WINEFIXUPINFO_NOINDEX (~0UL)
     145#endif
    142146#define WINEFIXUPINFO_GET(_p) get_fixup_info((const IWineD3DPixelShaderImpl*)(_p)->pshader, (_p)->inp2Fixup_info)
    143147#define WINEFIXUPINFO_ISVALID(_p) ((_p)->inp2Fixup_info != WINEFIXUPINFO_NOINDEX)
     148#ifdef VBOX_WITH_VMSVGA
     149# define WINEFIXUPINFO_INIT(_p) do { (_p)->inp2Fixup_info = WINEFIXUPINFO_NOINDEX; } while (0)
     150#else
    144151#define WINEFIXUPINFO_INIT(_p) ((_p)->inp2Fixup_info == WINEFIXUPINFO_NOINDEX)
     152#endif
    145153
    146154typedef struct {
     
    394402        if (!tmp)
    395403        {
    396             ERR("Program %u link status invalid.\n", program);
     404            ERR("Program %p link status invalid.\n", (void *)(uintptr_t)program);
    397405#ifndef VBOXWINEDBG_SHADERS
    398406            shader_glsl_dump_program_source(gl_info, program);
     
    413421        if (!tmp)
    414422        {
    415             ERR("Shader %u compile status invalid.\n", program);
     423            ERR("Shader %p compile status invalid.\n", (void *)(uintptr_t)program);
    416424            shader_glsl_dump_shader_source(gl_info, program);
    417425        }
     
    38033811    if (context_get_current() == entry->context)
    38043812    {
    3805         TRACE("deleting program %u\n", entry->programId);
     3813        TRACE("deleting program %p\n", (void *)(uintptr_t)entry->programId);
    38063814        GL_EXTCALL(glDeleteObjectARB(entry->programId));
    38073815        checkGLcall("glDeleteObjectARB");
     
    38093817    else
    38103818    {
    3811         WARN("Attempting to delete program %u created in ctx %p from ctx %p\n", entry->programId, entry->context, context_get_current());
     3819        WARN("Attempting to delete program %p created in ctx %p from ctx %p\n", (void *)(uintptr_t)entry->programId, entry->context, context_get_current());
    38123820    }
    38133821   
     
    40054013/* GL locking is done by the caller */
    40064014static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer,
    4007         IWineD3DVertexShader *vertexshader, IWineD3DPixelShader *pixelshader, const struct wined3d_gl_info *gl_info)
     4015        IWineD3DVertexShader *a_vertexshader, IWineD3DPixelShader *pixelshader, const struct wined3d_gl_info *gl_info)
    40084016{
    40094017    GLhandleARB ret = 0;
    4010     IWineD3DVertexShaderImpl *vs = (IWineD3DVertexShaderImpl *) vertexshader;
     4018    IWineD3DVertexShaderImpl *vs = (IWineD3DVertexShaderImpl *) a_vertexshader;
    40114019    IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) pixelshader;
    40124020    IWineD3DDeviceImpl *device;
     
    41724180
    41734181/* GL locking is done by the caller */
     4182#ifdef VBOX_WITH_VMSVGA
     4183static GLhandleARB shader_glsl_generate_pshader(const struct wined3d_context *context,
     4184#else
    41744185static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context,
     4186#endif
    41754187        struct wined3d_shader_buffer *buffer, IWineD3DPixelShaderImpl *This,
    41764188        const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info)
     
    42684280    shader_addline(buffer, "}\n");
    42694281
    4270     TRACE("Compiling shader object %u\n", shader_obj);
     4282    TRACE("Compiling shader object %p\n", (void *)(uintptr_t)shader_obj);
    42714283    GL_EXTCALL(glShaderSourceARB(shader_obj, 1, (const char**)&buffer->buffer, NULL));
    42724284    GL_EXTCALL(glCompileShaderARB(shader_obj));
     
    42784290
    42794291/* GL locking is done by the caller */
     4292#ifdef VBOX_WITH_VMSVGA
     4293static GLhandleARB shader_glsl_generate_vshader(const struct wined3d_context *context,
     4294#else
    42804295static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context,
     4296#endif
    42814297        struct wined3d_shader_buffer *buffer, IWineD3DVertexShaderImpl *This,
    42824298        const struct vs_compile_args *args)
     
    43444360    shader_addline(buffer, "}\n");
    43454361
    4346     TRACE("Compiling shader object %u\n", shader_obj);
     4362    TRACE("Compiling shader object %p\n", (void *)(uintptr_t)shader_obj);
    43474363    GL_EXTCALL(glShaderSourceARB(shader_obj, 1, (const char**)&buffer->buffer, NULL));
    43484364    GL_EXTCALL(glCompileShaderARB(shader_obj));
     
    45094525/* GL locking is done by the caller */
    45104526static void set_glsl_shader_program(const struct wined3d_context *context,
    4511         IWineD3DDeviceImpl *device, BOOL use_ps, BOOL use_vs)
    4512 {
    4513     IWineD3DVertexShader *vshader = use_vs ? device->stateBlock->vertexShader : NULL;
    4514     IWineD3DPixelShader *pshader = use_ps ? device->stateBlock->pixelShader : NULL;
     4527        IWineD3DDeviceImpl *device, BOOL a_use_ps, BOOL a_use_vs)
     4528{
     4529    IWineD3DVertexShader *vshader = a_use_vs ? device->stateBlock->vertexShader : NULL;
     4530    IWineD3DPixelShader *pshader = a_use_ps ? device->stateBlock->pixelShader : NULL;
    45154531    const struct wined3d_gl_info *gl_info = context->gl_info;
    45164532    struct shader_glsl_priv *priv = device->shader_priv;
     
    45344550    /* If we get to this point, then no matching program exists, so we create one */
    45354551    programId = GL_EXTCALL(glCreateProgramObjectARB());
    4536     TRACE("Created new GLSL shader program %u\n", programId);
     4552    TRACE("Created new GLSL shader program %p\n", (void *)(uintptr_t)programId);
    45374553
    45384554    /* Create the entry */
     
    45614577
    45624578        reorder_shader_id = generate_param_reorder_function(&priv->shader_buffer, vshader, pshader, gl_info);
    4563         TRACE("Attaching GLSL shader object %u to program %u\n", reorder_shader_id, programId);
     4579        TRACE("Attaching GLSL shader object %p to program %p\n", (void *)(uintptr_t)reorder_shader_id, (void *)(uintptr_t)programId);
    45644580        GL_EXTCALL(glAttachObjectARB(programId, reorder_shader_id));
    45654581        checkGLcall("glAttachObjectARB");
     
    45694585        GL_EXTCALL(glDeleteObjectARB(reorder_shader_id));
    45704586
    4571         TRACE("Attaching GLSL shader object %u to program %u\n", vshader_id, programId);
     4587        TRACE("Attaching GLSL shader object %p to program %p\n", (void *)(uintptr_t)vshader_id, (void *)(uintptr_t)programId);
    45724588        GL_EXTCALL(glAttachObjectARB(programId, vshader_id));
    45734589        checkGLcall("glAttachObjectARB");
     
    46014617                &entry->inp2Fixup_info
    46024618                );
    4603         TRACE("Attaching GLSL shader object %u to program %u\n", pshader_id, programId);
     4619        TRACE("Attaching GLSL shader object %p to program %p\n", (void *)(uintptr_t)pshader_id, (void *)(uintptr_t)programId);
    46044620        GL_EXTCALL(glAttachObjectARB(programId, pshader_id));
    46054621        checkGLcall("glAttachObjectARB");
     
    46094625
    46104626    /* Link the program */
    4611     TRACE("Linking GLSL shader program %u\n", programId);
     4627    TRACE("Linking GLSL shader program %p\n", (void *)(uintptr_t)programId);
    46124628    GL_EXTCALL(glLinkProgramARB(programId));
    46134629    shader_glsl_validate_compile_link(gl_info, programId, TRUE);
     
    46674683            && ((IWineD3DPixelShaderImpl *)pshader)->declared_in_count > vec4_varyings(3, gl_info))
    46684684    {
    4669         TRACE("Shader %d needs vertex color clamping disabled\n", programId);
     4685        TRACE("Shader %p needs vertex color clamping disabled\n", (void *)(uintptr_t)programId);
    46704686        entry->vertex_color_clamp = GL_FALSE;
    46714687    } else {
     
    48174833
    48184834    program_id = priv->glsl_program ? priv->glsl_program->programId : 0;
    4819     if (program_id) TRACE("Using GLSL program %u\n", program_id);
     4835    if (program_id) TRACE("Using GLSL program %p\n", (void *)(uintptr_t)program_id);
    48204836    GL_EXTCALL(glUseProgramObjectARB(program_id));
    48214837    checkGLcall("glUseProgramObjectARB");
     
    48774893
    48784894    program_id = priv->glsl_program ? priv->glsl_program->programId : 0;
    4879     if (program_id) TRACE("Using GLSL program %u\n", program_id);
     4895    if (program_id) TRACE("Using GLSL program %p\n", (void *)(uintptr_t)program_id);
    48804896
    48814897    GL_EXTCALL(glUseProgramObjectARB(program_id));
     
    49704986            if (shader_data->gl_shaders[i].context==context_get_current())
    49714987            {
    4972                 TRACE("deleting pshader %u\n", shader_data->gl_shaders[i].prgId);
     4988                TRACE("deleting pshader %p\n", (void *)(uintptr_t)shader_data->gl_shaders[i].prgId);
    49734989                GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId));
    49744990                checkGLcall("glDeleteObjectARB");
     
    49764992            else
    49774993            {
    4978                 WARN("Attempting to delete pshader %u created in ctx %p from ctx %p\n",
    4979                      shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current());
     4994                WARN("Attempting to delete pshader %p created in ctx %p from ctx %p\n",
     4995                     (void *)(uintptr_t)shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current());
    49804996            }
    49814997        }
     
    49925008            if (shader_data->gl_shaders[i].context==context_get_current())
    49935009            {
    4994                 TRACE("deleting vshader %u\n", shader_data->gl_shaders[i].prgId);
     5010                TRACE("deleting vshader %p\n", (void *)(uintptr_t)shader_data->gl_shaders[i].prgId);
    49955011                GL_EXTCALL(glDeleteObjectARB(shader_data->gl_shaders[i].prgId));
    49965012                checkGLcall("glDeleteObjectARB");
     
    49985014            else
    49995015            {
    5000                 WARN("Attempting to delete vshader %u created in ctx %p from ctx %p\n",
    5001                      shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current());
     5016                WARN("Attempting to delete vshader %p created in ctx %p from ctx %p\n",
     5017                     (void *)(uintptr_t)shader_data->gl_shaders[i].prgId, shader_data->gl_shaders[i].context, context_get_current());
    50025018            }
    50035019        }
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