Changeset 1234


Ignore:
Timestamp:
Apr 18, 2012, 1:20:55 AM (9 years ago)
Author:
sam
Message:

gpu: fix a nasty bug in the D3D9 vertex declaration code that caused
wrong offset computations.

Location:
trunk/src
Files:
3 edited

Legend:

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

    r1231 r1234  
    304304        elements[n].Offset = 0;
    305305        for (int i = 0; i < n; i++)
    306             elements[n].Offset += m_streams[n].size;
     306            if (m_streams[i].index == m_streams[n].index)
     307                elements[n].Offset += m_streams[i].size;
    307308
    308309        if (m_streams[n].stream_type >= 0
  • trunk/src/gradient.cpp

    r1233 r1234  
    155155            "    int x = (int)in_FragCoord.x;"
    156156            "    int y = (int)in_FragCoord.y;"
     157#if defined USE_D3D9 || defined _XBOX
     158            "    float t = bayer[int(frac(x * 0.25) * 4.0)]"
     159            "                   [int(frac(y * 0.25) * 4.0)];\n"
     160#else
    157161            // FIXME: we cannot address this matrix directly on the PS3
    158162            "    float t = bayer[0][0];\n"
    159             "    t = (t + 0.5) / 17.0 + z - x;\n"
     163#endif
     164            "    t = (t + 0.5) / 17.0;\n"
    160165            "    col.x += frac(t - col.x) - t;\n"
    161166            "    col.y += frac(t - col.y) - t;\n"
  • trunk/src/scene.cpp

    r1233 r1234  
    101101Scene::~Scene()
    102102{
    103 #if defined USE_D3D9 || defined _XBOX
    104     /* FIXME: TODO */
    105 #else
    106103    /* FIXME: this must be done while the GL context is still active.
    107104     * Change the code architecture to make sure of that. */
     
    110107        delete data->bufs[i];
    111108    free(data->bufs);
    112 #endif
    113109    delete data->m_vdecl;
    114110    delete data;
     
    382378        data->bufs[buf + 1]->Unlock();
    383379
    384         stdshader->Bind();
    385 
    386380        /* Bind texture */
    387381        data->tiles[i].tileset->Bind();
     
    393387
    394388        /* Draw arrays */
    395 #if 0
    396389        data->m_vdecl->DrawElements(MeshPrimitive::Triangles, 0, (n - i) * 2);
    397 #endif
    398390        data->m_vdecl->Unbind();
    399391        data->tiles[i].tileset->Unbind();
Note: See TracChangeset for help on using the changeset viewer.