Bläddra i källkod

gpu: fix a nasty bug in the D3D9 vertex declaration code that caused

wrong offset computations.
legacy
Sam Hocevar sam 12 år sedan
förälder
incheckning
0d49891632
3 ändrade filer med 8 tillägg och 10 borttagningar
  1. +2
    -1
      src/gpu/vertexbuffer.cpp
  2. +6
    -1
      src/gradient.cpp
  3. +0
    -8
      src/scene.cpp

+ 2
- 1
src/gpu/vertexbuffer.cpp Visa fil

@@ -303,7 +303,8 @@ void VertexDeclaration::Initialize()
elements[n].Stream = m_streams[n].index;
elements[n].Offset = 0;
for (int i = 0; i < n; i++)
elements[n].Offset += m_streams[n].size;
if (m_streams[i].index == m_streams[n].index)
elements[n].Offset += m_streams[i].size;

if (m_streams[n].stream_type >= 0
&& m_streams[n].stream_type < sizeof(tlut) / sizeof(*tlut))


+ 6
- 1
src/gradient.cpp Visa fil

@@ -154,9 +154,14 @@ void Gradient::TickDraw(float deltams)
#if 1
" int x = (int)in_FragCoord.x;"
" int y = (int)in_FragCoord.y;"
#if defined USE_D3D9 || defined _XBOX
" float t = bayer[int(frac(x * 0.25) * 4.0)]"
" [int(frac(y * 0.25) * 4.0)];\n"
#else
// FIXME: we cannot address this matrix directly on the PS3
" float t = bayer[0][0];\n"
" t = (t + 0.5) / 17.0 + z - x;\n"
#endif
" t = (t + 0.5) / 17.0;\n"
" col.x += frac(t - col.x) - t;\n"
" col.y += frac(t - col.y) - t;\n"
" col.z += frac(t - col.z) - t;\n"


+ 0
- 8
src/scene.cpp Visa fil

@@ -100,16 +100,12 @@ Scene::Scene(float angle)

Scene::~Scene()
{
#if defined USE_D3D9 || defined _XBOX
/* FIXME: TODO */
#else
/* FIXME: this must be done while the GL context is still active.
* Change the code architecture to make sure of that. */
/* XXX: The test is necessary because of a crash with PSGL. */
for (int i = 0; i < data->nbufs; i++)
delete data->bufs[i];
free(data->bufs);
#endif
delete data->m_vdecl;
delete data;
}
@@ -381,8 +377,6 @@ void Scene::Render() // XXX: rename to Blit()
data->bufs[buf]->Unlock();
data->bufs[buf + 1]->Unlock();

stdshader->Bind();

/* Bind texture */
data->tiles[i].tileset->Bind();

@@ -392,9 +386,7 @@ void Scene::Render() // XXX: rename to Blit()
data->m_vdecl->SetStream(data->bufs[buf + 1], attr_tex);

/* Draw arrays */
#if 0
data->m_vdecl->DrawElements(MeshPrimitive::Triangles, 0, (n - i) * 2);
#endif
data->m_vdecl->Unbind();
data->tiles[i].tileset->Unbind();
}


Laddar…
Avbryt
Spara