Changeset 1226


Ignore:
Timestamp:
Apr 14, 2012, 3:35:55 PM (11 years ago)
Author:
sam
Message:

gpu: refactor the vertex declaration code to allow several vertex streams.

Location:
trunk
Files:
5 edited

Legend:

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

    r1225 r1226  
    1616#include "lolgl.h"
    1717
     18#if defined _WIN32 && defined USE_D3D9
     19#   define FAR
     20#   define NEAR
     21#   include <d3d9.h>
     22#endif
     23
    1824using namespace std;
     25
     26#if defined USE_D3D9
     27extern IDirect3DDevice9 *g_d3ddevice;
     28#elif defined _XBOX
     29extern D3DDevice *g_d3ddevice;
     30#endif
    1931
    2032namespace lol
    2133{
    2234
    23 /* For some reason defining this in the .h leads to duplicate definitions
    24  * between the executable and the static library. */
    25 template<> void VertexBuffer::AddStream<void>(int n, int index)
     35VertexStreamBase const VertexStreamBase::Empty;
     36
     37void VertexDeclaration::Initialize()
    2638{
    27     (void)index;
    28     m_streams[n].size = 0;
     39#if defined _XBOX || defined USE_D3D9
     40    static D3DVERTEXELEMENT9 const end_element[] = { D3DDECL_END() };
     41    static D3DECLTYPE const X = D3DDECLTYPE_UNUSED;
     42    static D3DECLTYPE const tlut[] =
     43    {
     44        D3DDECLTYPE_UNUSED,
     45        X, D3DDECLTYPE_FLOAT16_2, X, D3DDECLTYPE_FLOAT16_4, /* half */
     46        D3DDECLTYPE_FLOAT1, D3DDECLTYPE_FLOAT2, D3DDECLTYPE_FLOAT3,
     47            D3DDECLTYPE_FLOAT4, /* float */
     48        X, X, X, X, /* double */
     49        X, X, X, X, /* int8_t */
     50        X, X, X, D3DDECLTYPE_UBYTE4, /* uint8_t */
     51        X, D3DDECLTYPE_SHORT2N, X, D3DDECLTYPE_SHORT4N, /* int16_t */
     52        X, D3DDECLTYPE_USHORT2N, X, D3DDECLTYPE_USHORT4N, /* uint16_t */
     53        X, X, X, X, /* int32_t */
     54        X, X, X, X, /* int64_t */
     55    };
     56    static D3DDECLUSAGE const ulut[] =
     57    {
     58        D3DDECLUSAGE_POSITION,
     59        D3DDECLUSAGE_BLENDWEIGHT,
     60        D3DDECLUSAGE_BLENDINDICES,
     61        D3DDECLUSAGE_NORMAL,
     62        D3DDECLUSAGE_PSIZE,
     63        D3DDECLUSAGE_TEXCOORD,
     64        D3DDECLUSAGE_TANGENT,
     65        D3DDECLUSAGE_BINORMAL,
     66        D3DDECLUSAGE_TESSFACTOR,
     67        D3DDECLUSAGE_POSITIONT,
     68        D3DDECLUSAGE_COLOR,
     69        D3DDECLUSAGE_FOG,
     70        D3DDECLUSAGE_DEPTH,
     71        D3DDECLUSAGE_SAMPLE,
     72    };
     73
     74    D3DVERTEXELEMENT9 elements[12 + 1];
     75    int nstreams = 0;
     76    while (m_streams[nstreams].size)
     77    {
     78        elements[nstreams].Stream = m_streams[nstreams].index;
     79        elements[nstreams].Offset = 0;
     80        for (int i = 0; i < nstreams; i++)
     81            elements[nstreams].Offset += m_streams[nstreams].size;
     82
     83        if (m_streams[nstreams].type >= 0
     84             && m_streams[nstreams].type < sizeof(tlut) / sizeof(*tlut))
     85            elements[nstreams].Type = tlut[m_streams[nstreams].type];
     86        else
     87            elements[nstreams].Type = D3DDECLTYPE_UNUSED;
     88
     89        elements[nstreams].Method = D3DDECLMETHOD_DEFAULT;
     90
     91        if (m_streams[nstreams].usage >= 0
     92             && m_streams[nstreams].usage < sizeof(ulut) / sizeof(*ulut))
     93            elements[nstreams].Type = ulut[m_streams[nstreams].usage];
     94        else
     95            elements[nstreams].Type = D3DDECLUSAGE_POSITION;
     96
     97        elements[nstreams].UsageIndex = 0;
     98        for (int i = 0; i < nstreams; i++)
     99            if (elements[i].Stream == elements[nstreams].Stream
     100                 && elements[i].Usage == elements[nstreams].Usage)
     101                elements[nstreams].UsageIndex++;
     102
     103        nstreams++;
     104    }
     105    elements[nstreams] = end_element[0];
     106
     107#   if defined USE_D3D9
     108    IDirect3DVertexDeclaration9 *vdecl;
     109#   elif defined _XBOX
     110    D3DVertexDeclaration *vdecl;
     111#   endif
     112
     113    g_d3ddevice->CreateVertexDeclaration(elements, &vdecl);
     114
     115    m_data = vdecl;
     116#else
     117
     118#endif
    29119}
    30120
    31 void VertexBuffer::Initialize()
     121VertexDeclaration::~VertexDeclaration()
    32122{
    33123#if defined _XBOX || defined USE_D3D9
    34    
     124#   if defined USE_D3D9
     125    IDirect3DVertexDeclaration9 *vdecl = (IDirect3DVertexDeclaration9 *)m_data;
     126#   elif defined _XBOX
     127    D3DVertexDeclaration *vdecl = (D3DVertexDeclaration *)m_data;
     128#   endif
     129
     130    vdecl->Release();
     131#else
     132
    35133#endif
     134}
     135
     136void VertexDeclaration::Bind()
     137{
     138#if defined _XBOX || defined USE_D3D9
     139#   if defined USE_D3D9
     140    IDirect3DVertexDeclaration9 *vdecl = (IDirect3DVertexDeclaration9 *)m_data;
     141#   elif defined _XBOX
     142    D3DVertexDeclaration *vdecl = (D3DVertexDeclaration *)m_data;
     143#   endif
     144
     145    g_d3ddevice->SetVertexDeclaration(vdecl);
     146#else
     147
     148#endif
     149}
     150
     151VertexDeclaration::VertexDeclaration(VertexStreamBase const &s1,
     152                                     VertexStreamBase const &s2,
     153                                     VertexStreamBase const &s3,
     154                                     VertexStreamBase const &s4,
     155                                     VertexStreamBase const &s5,
     156                                     VertexStreamBase const &s6,
     157                                     VertexStreamBase const &s7,
     158                                     VertexStreamBase const &s8,
     159                                     VertexStreamBase const &s9,
     160                                     VertexStreamBase const &s10,
     161                                     VertexStreamBase const &s11,
     162                                     VertexStreamBase const &s12) : m_count(0)
     163{
     164    if (&s1 != &VertexStreamBase::Empty) AddStream(s1);
     165    if (&s2 != &VertexStreamBase::Empty) AddStream(s2);
     166    if (&s3 != &VertexStreamBase::Empty) AddStream(s3);
     167    if (&s4 != &VertexStreamBase::Empty) AddStream(s4);
     168    if (&s5 != &VertexStreamBase::Empty) AddStream(s5);
     169    if (&s6 != &VertexStreamBase::Empty) AddStream(s6);
     170    if (&s7 != &VertexStreamBase::Empty) AddStream(s7);
     171    if (&s8 != &VertexStreamBase::Empty) AddStream(s8);
     172    if (&s9 != &VertexStreamBase::Empty) AddStream(s9);
     173    if (&s10 != &VertexStreamBase::Empty) AddStream(s10);
     174    if (&s11 != &VertexStreamBase::Empty) AddStream(s11);
     175    if (&s12 != &VertexStreamBase::Empty) AddStream(s12);
     176    Initialize();
     177}
     178
     179void VertexDeclaration::AddStream(VertexStreamBase const &s)
     180{
     181    int index = m_count ? m_streams[m_count - 1].index + 1 : 0;
     182
     183    for (int i = 0; s.m_streams[i].size; i++)
     184    {
     185        m_streams[m_count].stream_type = s.m_streams[i].stream_type;
     186        m_streams[m_count].usage = s.m_streams[i].usage;
     187        m_streams[m_count].size = s.m_streams[i].size;
     188        m_streams[m_count].index = index;
     189        m_count++;
     190    }
    36191}
    37192
  • trunk/src/gpu/vertexbuffer.h

    r1225 r1226  
    2222{
    2323
    24 #if 0
    25 VertexBuffer(0, LOL_TYPE_VEC2 | LOL_USAGE_TEXTURE(0),
    26                 LOL_TYPE_FLOAT | LOL_USAGE_POSITION(0),
    27              1, LOL_TYPE_FLOAT | LOL_USAGE_TEXCOORD(0),
    28              2, LOL_TYPE_FLOAT | LOL_USAGE_TEXCOORD(1));
     24struct VertexUsage
     25{
     26    enum Value
     27    {
     28        Position = 0,
     29        BlendWeight,
     30        BlendIndices,
     31        Normal,
     32        PSize,
     33        TexCoord,
     34        Tangent,
     35        Binormal,
     36        TessFactor,
     37        PositionT,
     38        Color,
     39        Fog,
     40        Depth,
     41        Sample,
     42    }
     43    m_value;
    2944
    30 VertexBuffer(VertexStream<vec2, LOL_USAGE_TEXTURE(0)
    31                           float, Texture(
    32 #endif
     45    inline VertexUsage(Value v) { m_value = v; }
     46    inline operator Value() { return m_value; }
     47};
    3348
    34 class VertexBuffer
     49class VertexStreamBase
    3550{
    36 public:
    37     VertexBuffer(VertexBuffer const& that)
    38     {
    39         memcpy(this, &that, sizeof(*this));
    40 
    41         /* Now call the platform-specific initialisation code */
    42         Initialize();
    43     }
    44 
    45     ~VertexBuffer() {}
     51    friend class VertexDeclaration;
    4652
    4753protected:
    48     VertexBuffer() {}
    49 
    5054    enum
    5155    {
    52         VBO_TYPE_VOID = 0,
    53         VBO_TYPE_FLOAT,
    54         VBO_TYPE_VEC2,
    55         VBO_TYPE_VEC3,
    56         VBO_TYPE_VEC4,
    57         VBO_TYPE_I16VEC4,
    58         VBO_TYPE_U8VEC4,
     56        Typevoid = 0,
     57        Typehalf,     Typef16vec2, Typef16vec3, Typef16vec4,
     58        Typefloat,    Typevec2,    Typevec3,    Typevec4,
     59        Typedouble,   Typef64vec2, Typef64vec3, Typef64vec4,
     60        Typeuint8_t,  Typeu8vec2,  Typeu8vec3,  Typeu8vec4,
     61        Typeint8_t,   Typei8vec2,  Typei8vec3,  Typei8vec4,
     62        Typeuint16_t, Typeu16vec2, Typeu16vec3, Typeu16vec4,
     63        Typeint16_t,  Typei16vec2, Typei16vec3, Typei16vec4,
     64        Typeuint32_t, Typeuvec2,   Typeuvec3,   Typeuvec4,
     65        Typeint32_t,  Typeivec2,   Typeivec3,   Typeivec4,
    5966    };
    6067
    61     static uint8_t GetType(void *x) { (void)x; return VBO_TYPE_VOID; }
    62     static uint8_t GetType(float *x) { (void)x; return VBO_TYPE_FLOAT; }
    63     static uint8_t GetType(vec2 *x) { (void)x; return VBO_TYPE_VEC2; }
    64     static uint8_t GetType(vec3 *x) { (void)x; return VBO_TYPE_VEC3; }
    65     static uint8_t GetType(vec4 *x) { (void)x; return VBO_TYPE_VEC4; }
    66     static uint8_t GetType(i16vec4 *x) { (void)x; return VBO_TYPE_I16VEC4; }
    67     static uint8_t GetType(u8vec4 *x) { (void)x; return VBO_TYPE_U8VEC4; }
     68#define LOL_TYPE(T) \
     69    static uint8_t GetType(T *x) { (void)x; return Type##T; }
    6870
    69     struct { uint8_t stream_type, index, size; } m_streams[12 + 1];
     71    LOL_TYPE(void)
     72    LOL_TYPE(half)     LOL_TYPE(f16vec2) LOL_TYPE(f16vec3) LOL_TYPE(f16vec4)
     73    LOL_TYPE(float)    LOL_TYPE(vec2)    LOL_TYPE(vec3)    LOL_TYPE(vec4)
     74    LOL_TYPE(double)   LOL_TYPE(f64vec2) LOL_TYPE(f64vec3) LOL_TYPE(f64vec4)
     75    LOL_TYPE(uint8_t)  LOL_TYPE(u8vec2)  LOL_TYPE(u8vec3)  LOL_TYPE(u8vec4)
     76    LOL_TYPE(int8_t)   LOL_TYPE(i8vec2)  LOL_TYPE(i8vec3)  LOL_TYPE(i8vec4)
     77    LOL_TYPE(uint16_t) LOL_TYPE(u16vec2) LOL_TYPE(u16vec3) LOL_TYPE(u16vec4)
     78    LOL_TYPE(int16_t)  LOL_TYPE(i16vec2) LOL_TYPE(i16vec3) LOL_TYPE(i16vec4)
     79    LOL_TYPE(uint32_t) LOL_TYPE(uvec2)   LOL_TYPE(uvec3)   LOL_TYPE(uvec4)
     80    LOL_TYPE(int32_t)  LOL_TYPE(ivec2)   LOL_TYPE(ivec3)   LOL_TYPE(ivec4)
     81#undef LOL_TYPE
    7082
    71     template<typename T> void AddStream(int n, int index)
     83    template<typename T> inline void AddStream(int n, int usage)
    7284    {
    7385        m_streams[n].stream_type = GetType((T *)NULL);
    74         m_streams[n].index = index;
     86        m_streams[n].usage = usage;
    7587        m_streams[n].size = sizeof(T);
    7688    }
    7789
     90    VertexStreamBase() {}
     91
    7892private:
    79     void Initialize();
     93    struct { uint8_t stream_type, usage, size; } m_streams[12 + 1];
     94
     95    static VertexStreamBase const Empty;
    8096};
    8197
    82 template<> void VertexBuffer::AddStream<void>(int n, int index);
     98template<>
     99inline void VertexStreamBase::AddStream<void>(int n, int usage)
     100{
     101    (void)usage;
     102    m_streams[n].size = 0;
     103}
    83104
    84105template<typename T1 = void,  typename T2 = void,  typename T3 = void,
     
    86107         typename T7 = void,  typename T8 = void,  typename T9 = void,
    87108         typename T10 = void, typename T11 = void, typename T12 = void>
    88 class VertexDeclaration : public VertexBuffer
     109class VertexStream : public VertexStreamBase
    89110{
    90111public:
    91     /* Arguments are the stream index; default to zero */
    92     VertexDeclaration(int s1 = 0,  int s2 = 0,  int s3 = 0,
    93                       int s4 = 0,  int s5 = 0,  int s6 = 0,
    94                       int s7 = 0,  int s8 = 0,  int s9 = 0,
    95                       int s10 = 0, int s11 = 0, int s12 = 0)
     112    inline VertexStream(VertexUsage u1,
     113                        VertexUsage u2 = VertexUsage::Position,
     114                        VertexUsage u3 = VertexUsage::Position,
     115                        VertexUsage u4 = VertexUsage::Position,
     116                        VertexUsage u5 = VertexUsage::Position,
     117                        VertexUsage u6 = VertexUsage::Position,
     118                        VertexUsage u7 = VertexUsage::Position,
     119                        VertexUsage u8 = VertexUsage::Position,
     120                        VertexUsage u9 = VertexUsage::Position,
     121                        VertexUsage u10 = VertexUsage::Position,
     122                        VertexUsage u11 = VertexUsage::Position,
     123                        VertexUsage u12 = VertexUsage::Position)
    96124    {
    97         for (int i = 0; i < 12 + 1; i++)
    98             m_streams[i].stream_type = VBO_TYPE_VOID;
     125        AddStream<T1>(0, u1);    AddStream<T2>(1, u2);
     126        AddStream<T3>(2, u3);    AddStream<T4>(3, u4);
     127        AddStream<T5>(4, u5);    AddStream<T6>(5, u6);
     128        AddStream<T7>(6, u7);    AddStream<T8>(7, u8);
     129        AddStream<T9>(8, u9);    AddStream<T10>(9, u10);
     130        AddStream<T11>(10, u11); AddStream<T12>(11, u12);
     131    }
     132};
    99133
    100         AddStream<T1>(0, s1); AddStream<T2>(1, s2); AddStream<T3>(2, s3);
    101         AddStream<T4>(3, s4); AddStream<T5>(4, s5); AddStream<T6>(5, s6);
    102         AddStream<T7>(6, s7); AddStream<T8>(7, s8); AddStream<T9>(8, s9);
    103         AddStream<T10>(9, s10); AddStream<T11>(10, s11); AddStream<T12>(11, s12);
    104     }
     134class VertexDeclaration
     135{
     136public:
     137    VertexDeclaration(VertexStreamBase const &s1,
     138                      VertexStreamBase const &s2 = VertexStreamBase::Empty,
     139                      VertexStreamBase const &s3 = VertexStreamBase::Empty,
     140                      VertexStreamBase const &s4 = VertexStreamBase::Empty,
     141                      VertexStreamBase const &s5 = VertexStreamBase::Empty,
     142                      VertexStreamBase const &s6 = VertexStreamBase::Empty,
     143                      VertexStreamBase const &s7 = VertexStreamBase::Empty,
     144                      VertexStreamBase const &s8 = VertexStreamBase::Empty,
     145                      VertexStreamBase const &s9 = VertexStreamBase::Empty,
     146                      VertexStreamBase const &s10 = VertexStreamBase::Empty,
     147                      VertexStreamBase const &s11 = VertexStreamBase::Empty,
     148                      VertexStreamBase const &s12 = VertexStreamBase::Empty);
     149    ~VertexDeclaration();
     150
     151    void Bind();
    105152
    106153private:
     154    void Initialize();
     155    void AddStream(VertexStreamBase const &);
     156
     157    struct { uint8_t stream_type, index, usage, size; } m_streams[12 + 1];
     158    int m_count;
     159
     160    void *m_data;
    107161};
    108162
  • trunk/test/tutorial/tut01.cpp

    r1224 r1226  
    6262        if (!m_ready)
    6363        {
    64             VertexBuffer vb(VertexDeclaration<vec2, float, ivec3>(0, 0, 1));
    6564
    6665
     
    115114            /* Method 2: upload vertex information at each frame */
    116115#elif defined _XBOX || defined USE_D3D9
    117             D3DVERTEXELEMENT9 const elements[2] =
    118             {
    119                 { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
    120                 D3DDECL_END()
    121             };
    122             g_d3ddevice->CreateVertexDeclaration(elements, &m_vdecl);
     116            m_vdecl =
     117              new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position));
     118
    123119            if (FAILED(g_d3ddevice->CreateVertexBuffer(sizeof(m_vertices), D3DUSAGE_WRITEONLY, NULL, D3DPOOL_MANAGED, &m_vbo, NULL)))
    124120                exit(0);
     
    136132
    137133        m_shader->Bind();
     134        m_vdecl->Bind();
    138135#if defined _XBOX || defined USE_D3D9
    139136        g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
    140         g_d3ddevice->SetVertexDeclaration(m_vdecl);
    141137        g_d3ddevice->SetStreamSource(0, m_vbo, 0, sizeof(*m_vertices));
    142138#elif !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__
     
    175171    vec2 m_vertices[3];
    176172    Shader *m_shader;
     173    VertexDeclaration *m_vdecl;
    177174#if defined USE_D3D9
    178     IDirect3DVertexDeclaration9 *m_vdecl;
    179175    IDirect3DVertexBuffer9 *m_vbo;
    180176#elif defined _XBOX
    181     D3DVertexDeclaration *m_vdecl;
    182177    D3DVertexBuffer *m_vbo;
    183178#else
  • trunk/test/tutorial/tut02.cpp

    r1214 r1226  
    146146            m_ready = true;
    147147
     148            m_vdecl =
     149              new VertexDeclaration(VertexStream<vec3>(VertexUsage::Position),
     150                                    VertexStream<vec3>(VertexUsage::Color));
    148151#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined __APPLE__ && !defined _XBOX && !defined USE_D3D9
    149152            /* Method 1: store vertex buffer on the GPU memory */
     
    161164                         GL_STATIC_DRAW);
    162165#elif defined _XBOX || defined USE_D3D9
    163             D3DVERTEXELEMENT9 const elements[] =
    164             {
    165                 { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
    166                 { 1, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 },
    167                 D3DDECL_END()
    168             };
    169             g_d3ddevice->CreateVertexDeclaration(elements, &m_vdecl);
    170 
    171166            if (FAILED(g_d3ddevice->CreateVertexBuffer(sizeof(m_vertices), D3DUSAGE_WRITEONLY, NULL, D3DPOOL_MANAGED, &m_vbo, NULL)))
    172167                exit(0);
     
    203198        m_shader->Bind();
    204199        m_shader->SetUniform(m_mvp, m_matrix);
     200        m_vdecl->Bind();
    205201#if defined _XBOX || defined USE_D3D9
    206202        g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
    207         g_d3ddevice->SetVertexDeclaration(m_vdecl);
    208203        g_d3ddevice->SetStreamSource(0, m_vbo, 0, sizeof(*m_vertices));
    209204        g_d3ddevice->SetStreamSource(1, m_cbo, 0, sizeof(*m_colors));
     
    243238    i16vec3 m_indices[12];
    244239    Shader *m_shader;
     240    VertexDeclaration *m_vdecl;
    245241#if defined USE_D3D9
    246     IDirect3DVertexDeclaration9 *m_vdecl;
    247242    IDirect3DVertexBuffer9 *m_vbo, *m_cbo;
    248243    IDirect3DIndexBuffer9 *m_ibo;
    249244#elif defined _XBOX
    250     D3DVertexDeclaration *m_vdecl;
    251245    D3DVertexBuffer *m_vbo, *m_cbo;
    252246    D3DIndexBuffer *m_ibo;
  • trunk/test/tutorial/tut03.cpp

    r1218 r1226  
    676676            m_ready = true;
    677677
     678            m_vdecl =
     679              new VertexDeclaration(VertexStream<vec2>(VertexUsage::Position),
     680                                    VertexStream<vec2>(VertexUsage::TexCoord));
    678681#if !defined __CELLOS_LV2__ && !defined __ANDROID__ && !defined _XBOX && !defined USE_D3D9
    679682            /* Method 1: store vertex buffer on the GPU memory */
     
    689692            /* Method 2: upload vertex information at each frame */
    690693#elif defined _XBOX || defined USE_D3D9
    691             D3DVERTEXELEMENT9 const elements[] =
    692             {
    693                 { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
    694                 { 1, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },
    695                 D3DDECL_END()
    696             };
    697             g_d3ddevice->CreateVertexDeclaration(elements, &m_vdecl);
    698 
    699694            if (FAILED(g_d3ddevice->CreateVertexBuffer(sizeof(vertices), D3DUSAGE_WRITEONLY, NULL, D3DPOOL_MANAGED, &m_vbo, NULL)))
    700695                exit(0);
     
    767762        m_shader->SetUniform(m_screenuni, m_screen_settings);
    768763        m_shader->SetUniform(m_zoomuni, m_zoom_settings);
     764        m_vdecl->Bind();
    769765#if defined _XBOX || defined USE_D3D9
    770766        g_d3ddevice->SetTexture(0, m_tex);
    771767        //g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
    772768        g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
    773         g_d3ddevice->SetVertexDeclaration(m_vdecl);
    774769        g_d3ddevice->SetStreamSource(0, m_vbo, 0, sizeof(*vertices));
    775770        g_d3ddevice->SetStreamSource(1, m_tbo, 0, sizeof(*texcoords));
     
    827822    u8vec4 *m_pixels, *m_tmppixels, *m_palette;
    828823    Shader *m_shader;
     824    VertexDeclaration *m_vdecl;
    829825#if defined USE_D3D9
    830826    IDirect3DTexture9 *m_tex;
    831     IDirect3DVertexDeclaration9 *m_vdecl;
    832827    IDirect3DVertexBuffer9 *m_vbo, *m_tbo;
    833828#elif defined _XBOX
    834829    D3DTexture *m_tex;
    835     D3DVertexDeclaration *m_vdecl;
    836830    D3DVertexBuffer *m_vbo, *m_tbo;
    837831#else
Note: See TracChangeset for help on using the changeset viewer.