Changeset 1265


Ignore:
Timestamp:
Apr 21, 2012, 9:45:15 PM (8 years ago)
Author:
sam
Message:

gpu: fix Direct3D handling of float3x3 uniforms; they need padding.

File:
1 edited

Legend:

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

    r1259 r1265  
    399399{
    400400#if defined USE_D3D9 || defined _XBOX
     401    /* FIXME: do we need padding here like for the mat3 version? */
    401402    if (uni.flags & 1)
    402403        g_d3ddevice->SetPixelShaderConstantF((UINT)uni.frag, &m[0][0], 1);
     
    406407    glUniformMatrix2fv(uni.frag, 1, GL_FALSE, &m[0][0]);
    407408#else
    408     /* Not implemented */
     409    /* FIXME: not implemented */
    409410    Abort();
    410411#endif
     
    414415{
    415416#if defined USE_D3D9 || defined _XBOX
    416     /* FIXME: does this work at all? */
     417    /* Padding matrix columns is necessary on DirectX. We need to create
     418     * a new data structure; a 4×4 matrix will do. */
     419    mat4 tmp(m, 1.0f);
    417420    if (uni.flags & 1)
    418         g_d3ddevice->SetPixelShaderConstantF((UINT)uni.frag, &m[0][0], 3);
     421        g_d3ddevice->SetPixelShaderConstantF((UINT)uni.frag, &tmp[0][0], 3);
    419422    if (uni.flags & 2)
    420         g_d3ddevice->SetVertexShaderConstantF((UINT)uni.vert, &m[0][0], 3);
     423        g_d3ddevice->SetVertexShaderConstantF((UINT)uni.vert, &tmp[0][0], 3);
    421424#elif !defined __CELLOS_LV2__
    422425    glUniformMatrix3fv(uni.frag, 1, GL_FALSE, &m[0][0]);
Note: See TracChangeset for help on using the changeset viewer.