Changeset 2156


Ignore:
Timestamp:
Dec 20, 2012, 2:01:32 AM (7 years ago)
Author:
sam
Message:

gpu: warn when a vertex shader attribute isn’t found and do not crash
when a stream is not found in the vertex declaration at bind time.

Location:
trunk/src/gpu
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gpu/shader.cpp

    r2097 r2156  
    327327#if defined USE_D3D9 || defined _XBOX
    328328#elif !defined __CELLOS_LV2__
    329     ret.m_flags |= (uint64_t)
    330                   (uint32_t)glGetAttribLocation(data->prog_id, attr) << 32;
     329    GLint l = glGetAttribLocation(data->prog_id, attr);
     330    if (l < 0)
     331    {
     332        Log::Warn("tried to query invalid attribute: %s\n", attr);
     333        l = 0;
     334    }
     335    ret.m_flags |= (uint64_t)(uint32_t)l << 32;
    331336#else
    332337    /* FIXME: can we do this at all on the PS3? */
  • trunk/src/gpu/vertexbuffer.cpp

    r2082 r2156  
    374374                if (usage_index++ == index)
    375375                    break;
     376
     377        if (attr_index == m_count)
     378        {
     379            Log::Error("stream #%d with usage %x not found in declaration\n",
     380                       index, usage);
     381            attr_index = 0;
     382        }
    376383
    377384        /* Now compute the stride and offset up to this stream index */
Note: See TracChangeset for help on using the changeset viewer.