Changeset 2097 for trunk


Ignore:
Timestamp:
Nov 20, 2012, 1:23:15 AM (7 years ago)
Author:
sam
Message:

core: refactor the Hash class so that we can hash base types, too.

Location:
trunk/src
Files:
3 added
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Makefile.am

    r2096 r2097  
    77
    88liblol_a_SOURCES = \
    9     core.h tiler.cpp tiler.h dict.cpp dict.h array.h \
     9    core.h tiler.cpp tiler.h dict.cpp dict.h \
    1010    audio.cpp audio.h scene.cpp scene.h font.cpp font.h layer.cpp layer.h \
    1111    map.cpp map.h entity.cpp entity.h ticker.cpp ticker.h lolgl.h \
     
    1313    timer.cpp timer.h bitfield.h profiler.cpp profiler.h \
    1414    world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \
    15     text.cpp text.h emitter.cpp emitter.h numeric.h hash.cpp hash.h \
     15    text.cpp text.h emitter.cpp emitter.h numeric.h \
    1616    worldentity.cpp worldentity.h gradient.cpp gradient.h gradient.lolfx \
    1717    platform.cpp platform.h sprite.cpp sprite.h camera.cpp camera.h \
    1818    \
    1919    lol/unit.h lol/debug.h \
    20     lol/core/array.h lol/core/string.h \
     20    lol/core/array.h lol/core/string.h lol/core/hash.h \
    2121    lol/math/vector.h lol/math/half.h lol/math/real.h lol/math/remez.h \
    2222    lol/math/math.h \
     
    4040    $(android_sources) \
    4141    $(bullet_sources) \
     42    \
     43    core/hash.cpp \
    4244    \
    4345    thread/threadbase.h thread/thread.h \
  • trunk/src/core.h

    r2086 r2097  
    7878#include <lol/core/array.h>
    7979#include <lol/core/string.h>
     80#include <lol/core/hash.h>
    8081#include <lol/math/math.h>
    8182#include <lol/math/half.h>
     
    112113
    113114// Other objects
    114 #include "hash.h"
    115115#include "dict.h"
    116116#include "map.h"
  • trunk/src/gpu/shader.cpp

    r1928 r2097  
    7272    /* Global shader cache */
    7373    static Shader *shaders[];
     74    static Hash<char const *> hash;
    7475    static int nshaders;
    7576};
    7677
    7778Shader *ShaderData::shaders[256];
     79Hash<char const *> ShaderData::hash;
    7880int ShaderData::nshaders = 0;
    7981
     
    138140        Log::Error("no fragment shader found… sorry, I’m gonna crash now.\n");
    139141
    140     uint32_t new_vert_crc = Hash::Crc32(vert);
    141     uint32_t new_frag_crc = Hash::Crc32(frag);
     142    uint32_t new_vert_crc = ShaderData::hash(vert);
     143    uint32_t new_frag_crc = ShaderData::hash(frag);
    142144
    143145    for (int n = 0; n < ShaderData::nshaders; n++)
     
    190192
    191193    /* Compile vertex shader */
    192     data->vert_crc = Hash::Crc32(vert);
     194    data->vert_crc = ShaderData::hash(vert);
    193195#if defined USE_D3D9 || defined _XBOX
    194196    hr = D3DXCompileShader(vert, (UINT)strlen(vert), macros, NULL, "main",
     
    234236
    235237    /* Compile fragment shader */
    236     data->frag_crc = Hash::Crc32(frag);
     238    data->frag_crc = ShaderData::hash(frag);
    237239#if defined USE_D3D9 || defined _XBOX
    238240    hr = D3DXCompileShader(frag, (UINT)strlen(frag), macros, NULL, "main",
  • trunk/src/lolcore.vcxproj

    r2086 r2097  
    235235    <ClCompile Include="bullet\LinearMath\btSerializer.cpp" />
    236236    <ClCompile Include="camera.cpp" />
     237    <ClCompile Include="core\hash.cpp" />
    237238    <ClCompile Include="debug\fps.cpp" />
    238239    <ClCompile Include="debug\record.cpp" />
     
    258259    <ClCompile Include="gpu\vertexbuffer.cpp" />
    259260    <ClCompile Include="gradient.cpp" />
    260     <ClCompile Include="hash.cpp" />
    261261    <ClCompile Include="image\codec\android-image.cpp" />
    262262    <ClCompile Include="image\codec\dummy-image.cpp" />
     
    573573    <ClInclude Include="gpu\vertexbuffer.h" />
    574574    <ClInclude Include="gradient.h" />
    575     <ClInclude Include="hash.h" />
    576575    <ClInclude Include="image\image-private.h" />
    577576    <ClInclude Include="image\image.h" />
     
    584583    <ClInclude Include="lolgl.h" />
    585584    <ClInclude Include="lol\core\array.h" />
     585    <ClInclude Include="lol\core\hash.h" />
     586    <ClInclude Include="lol\core\string.h" />
    586587    <ClInclude Include="lol\debug.h" />
    587588    <ClInclude Include="lol\math\half.h" />
Note: See TracChangeset for help on using the changeset viewer.