Browse Source

gpu: fix missing #if blocks in vertex buffer code.

undefined
Sam Hocevar 10 years ago
parent
commit
d0e9447ac0
3 changed files with 9 additions and 4 deletions
  1. +5
    -1
      src/gpu/vertexbuffer.cpp
  2. +2
    -0
      src/lol/gpu/vertexbuffer.h
  3. +2
    -3
      src/scene.cpp

+ 5
- 1
src/gpu/vertexbuffer.cpp View File

@@ -399,7 +399,7 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attribs[])
if (attr_index == m_count)
{
Log::Error("stream #%d with usage %x not found in declaration\n",
index, usage);
index, usage.ToScalar());
attr_index = 0;
}

@@ -423,7 +423,9 @@ void VertexDeclaration::SetStream(VertexBuffer *vb, ShaderAttrib attribs[])
static struct { GLint size; GLenum type; } const tlut[] =
{
{ 0, 0 },
#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
{ 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 }, /* half */
#endif
{ 1, GL_FLOAT }, { 2, GL_FLOAT }, { 3, GL_FLOAT },
{ 4, GL_FLOAT }, /* float */
{ 1, GL_DOUBLE }, { 2, GL_DOUBLE }, { 3, GL_DOUBLE },
@@ -514,7 +516,9 @@ void VertexDeclaration::Initialize()
static D3DDECLTYPE const tlut[] =
{
D3DDECLTYPE_UNUSED,
#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
X, D3DDECLTYPE_FLOAT16_2, X, D3DDECLTYPE_FLOAT16_4, /* half */
#endif
D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT2, D3DDECLTYPE_FLOAT3,
D3DDECLTYPE_FLOAT4, /* float */
X, X, X, X, /* double */


+ 2
- 0
src/lol/gpu/vertexbuffer.h View File

@@ -55,6 +55,8 @@ class VertexStreamBase
public:
enum
{
/* XXX: be sure to fix all appropriate places in vertexbuffer.cpp
* when modifying this list. */
Typevoid = 0,
#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
Typehalf, Typef16vec2, Typef16vec3, Typef16vec4,


+ 2
- 3
src/scene.cpp View File

@@ -455,10 +455,9 @@ void Scene::RenderLines(float seconds) // XXX: rename to Blit()
linecount--;
}
}
int vb_size = sizeof(vec4) * 4 * real_linecount;
VertexBuffer *vb = new VertexBuffer(vb_size);
VertexBuffer *vb = new VertexBuffer(buff.Bytes());
float *vertex = (float *)vb->Lock(0, 0);
memcpy(vertex, buff.Data(), vb_size);
memcpy(vertex, buff.Data(), buff.Bytes());
vb->Unlock();

data->m_line_shader->Bind();


Loading…
Cancel
Save