VirtualBox

Changeset 46236 in vbox for trunk/src/VBox/Additions/WINNT


Ignore:
Timestamp:
May 23, 2013 2:15:40 PM (12 years ago)
Author:
vboxsync
Message:

d3d: debugging stuff

Location:
trunk/src/VBox/Additions/WINNT/Graphics/Video/disp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/Makefile.kmk

    r43589 r46236  
    212212tstMvWnd_SOURCES  = \
    213213        wddm/dbg/tstMvWnd.cpp
    214 tstMvWnd_LIBS     = $(LIB_RUNTIME)
     214tstMvWnd_LIBS     = $(VBOX_LIB_IPRT_GUEST_R3)
    215215tstMvWnd_LDFLAGS.win = /SUBSYSTEM:windows
    216216
     
    221221DumpD3DCaps9_SOURCES  = \
    222222        wddm/dbg/DumpD3DCaps9.cpp
    223 DumpD3DCaps9_LIBS     = $(LIB_RUNTIME)
     223DumpD3DCaps9_LIBS     = $(VBOX_LIB_IPRT_GUEST_R3) d3d9.lib
    224224DumpD3DCaps9_LDFLAGS.win = /SUBSYSTEM:CONSOLE
    225225
  • trunk/src/VBox/Additions/WINNT/Graphics/Video/disp/wddm/dbg/DumpD3DCaps9.cpp

    r39330 r46236  
    1515#include <d3d9types.h>
    1616#include <d3d9caps.h>
     17#include <d3d9.h>
    1718#include <stdio.h>
     19
     20#define MAX(_v1, _v2) ((_v1) > (_v2) ? (_v1) : (_v2))
     21#define MIN(_v1, _v2) ((_v1) < (_v2) ? (_v1) : (_v2))
    1822
    1923#define MISSING_FLAGS(_dw1, _dw2) ((_dw2) & ((_dw1) ^ (_dw2)))
     
    497501static void diffCaps(D3DCAPS9 *pCaps1, D3DCAPS9 *pCaps2)
    498502{
     503    if (!memcmp(pCaps1, pCaps2, sizeof (D3DCAPS9)))
     504    {
     505        Log(("caps are identical!\n"));
     506        return;
     507    }
     508
     509    Log(("caps differ, doing detailed diff..\n"));
     510
    499511    if (pCaps1->DeviceType != pCaps2->DeviceType)
    500512    {
     
    561573    DUMP_DIFF_VAL(MaxStreams, "%d");
    562574    DUMP_DIFF_VAL(MaxStreamStride, "%d");
    563     DUMP_DIFF_VAL(VertexShaderVersion, "%d");
     575    DUMP_DIFF_VAL(VertexShaderVersion, "0x%x");
    564576    DUMP_DIFF_VAL(MaxVertexShaderConst, "%d");
    565     DUMP_DIFF_VAL(PixelShaderVersion, "%d");
     577    DUMP_DIFF_VAL(PixelShaderVersion, "0x%x");
    566578    DUMP_DIFF_VAL(PixelShader1xMaxValue, "%f");
    567579
     
    606618
    607619static DWORD g_aCaps1[] = {
    608         0x00000001, 0x00000000, 0x00000000, 0xe00a0000,
    609         0x00000320, 0x80000001, 0x00000003, 0x0059aff1,
    610         0x000e6ff2, 0x077363b1, 0x000000ff, 0x00003fff,
    611         0x000023ff, 0x000000ff, 0x00084208, 0x0007eccd,
    612         0x07030700, 0x07030700, 0x03030300, 0x0000003f,
    613         0x0000003f, 0x0000001f, 0x00002000, 0x00002000,
    614         0x00000800, 0x00008000, 0x00002000, 0x00000010,
    615         0x3f800000, 0xc6000000, 0xc6000000, 0x46000000,
    616         0x46000000, 0x00000000, 0x000001ff, 0x00100008,
    617         0x03feffff, 0x00000008, 0x00000008, 0x0000003b,
    618         0x00000008, 0x00000006, 0x00000001, 0x00000000,
    619         0x427c0000, 0x000fffff, 0x000fffff, 0x00000010,
    620         0x00000400, 0xfffe0200, 0x00000100, 0xffff0200,
    621         0x41000000, 0x00000051, 0x00000000, 0x00000000,
    622         0x00000000, 0x00000000, 0x00000001, 0x0000030f,
    623         0x00000001, 0x03000300, 0x00000000, 0x00000018,
    624         0x00000020, 0x00000001, 0x00000000, 0x00000018,
    625         0x00000020, 0x00000000, 0x00000060, 0x01000100,
    626         0x0000ffff, 0x00000200, 0x00000000, 0x00000000
     620          0x00000001, 0x00000000, 0x00000000, 0x60020000,
     621          0x00000320, 0x80000001, 0x00000003, 0x0059aff0,
     622          0x000a0ff2, 0x07322191, 0x000000ff, 0x00003fff,
     623          0x000023ff, 0x000000ff, 0x00084208, 0x0007ec85,
     624          0x07030700, 0x07030700, 0x03030300, 0x0000001f,
     625          0x0000001f, 0x0000001f, 0x00001000, 0x00001000,
     626          0x00000100, 0x00008000, 0x00001000, 0x00000010,
     627          0x3f800000, 0x00000000, 0x00000000, 0x00000000,
     628          0x00000000, 0x00000000, 0x000001ff, 0x00100008,
     629          0x03feffff, 0x00000008, 0x00000008, 0x0000003b,
     630          0x00000008, 0x00000006, 0x00000001, 0x00000000,
     631          0x437f0000, 0x000fffff, 0x000fffff, 0x00000010,
     632          0x00000400, 0xfffe0200, 0x00000080, 0xffff0200,
     633          0x41000000, 0x00000051, 0x00000000, 0x00000000,
     634          0x00000000, 0x00000000, 0x00000001, 0x0000000f,
     635          0x00000001, 0x03000300, 0x00000000, 0x00000000,
     636          0x0000001f, 0x00000001, 0x00000000, 0x00000000,
     637          0x00000100, 0x00000000, 0x00000060, 0x00000000,
     638          0x0000ffff, 0x00000200, 0x00000000, 0x00000000
    627639};
    628640
    629641
    630642static DWORD g_aCaps2[] = {
    631         0x00000001, 0x00000000, 0x00020000, 0xe00a0000,
    632         0x00000320, 0x80000001, 0x00000003, 0x0059aff1,
    633         0x000e6ff2, 0x077263b1, 0x000000ff, 0x00003fff,
    634         0x000023ff, 0x000000ff, 0x00084208, 0x0007eccd,
    635         0x07030700, 0x07030700, 0x03030300, 0x0000003f,
    636         0x0000003f, 0x0000001f, 0x00002000, 0x00002000,
    637         0x00002000, 0x00008000, 0x00002000, 0x00000010,
    638         0x3f800000, 0xc6000000, 0xc6000000, 0x46000000,
    639         0x46000000, 0x00000000, 0x000001ff, 0x00100008,
    640         0x03feffff, 0x00000008, 0x00000008, 0x0000003b,
    641         0x00000008, 0x00000008, 0x00000001, 0x00000000,
    642         0x46000000, 0x000fffff, 0x000fffff, 0x00000010,
    643         0x00000400, 0xfffe0300, 0x00000100, 0xffff0300,
    644         0x41000000, 0x00000051, 0x00000000, 0x00000000,
    645         0x00000000, 0x00000000, 0x00000001, 0x0000030f,
    646         0x00000001, 0x03000300, 0x00000001, 0x00000018,
    647         0x00000020, 0x00000004, 0x0000001f, 0x00000018,
    648         0x00000020, 0x00000004, 0x00000200, 0x01000100,
    649         0x0000ffff, 0x0000ffff, 0x00008000, 0x00008000
     643          0x00000001, 0x00000000, 0x00000000, 0x60020000,
     644          0x00000320, 0x80000001, 0x00000003, 0x0019aff0,
     645          0x000a0ff2, 0x07322191, 0x000000ff, 0x00003fff,
     646          0x000023ff, 0x000000ff, 0x00084208, 0x0001ec85,
     647          0x07030700, 0x07030700, 0x03030300, 0x0000001f,
     648          0x0000001f, 0x0000001f, 0x00001000, 0x00001000,
     649          0x00000100, 0x00008000, 0x00001000, 0x00000010,
     650          0x3f800000, 0x00000000, 0x00000000, 0x00000000,
     651          0x00000000, 0x00000000, 0x000001ff, 0x00100008,
     652          0x03feffff, 0x00000008, 0x00000008, 0x0000003b,
     653          0x00000008, 0x00000006, 0x00000001, 0x00000000,
     654          0x437f0000, 0x000fffff, 0x000fffff, 0x00000010,
     655          0x00000400, 0xfffe0200, 0x00000080, 0xffff0200,
     656          0x41000000, 0x00000051, 0x00000000, 0x00000000,
     657          0x00000000, 0x00000000, 0x00000001, 0x0000000f,
     658          0x00000001, 0x03000300, 0x00000000, 0x00000000,
     659          0x0000001f, 0x00000001, 0x00000000, 0x00000000,
     660          0x00000100, 0x00000000, 0x00000060, 0x00000000,
     661          0x0000ffff, 0x00000200, 0x00000000, 0x00000000
    650662};
    651663
     664
     665/* ogl stuff */
     666static const char * strNext(const char * pcszStr)
     667{
     668    pcszStr = strchr(pcszStr, ' ');
     669    if (!pcszStr)
     670        return NULL;
     671
     672    do
     673    {
     674        ++pcszStr;
     675        if (*pcszStr == '\0')
     676            return NULL;
     677        else if (*pcszStr != ' ')
     678            return pcszStr;
     679    } while (1);
     680
     681    Log(("WARNING: should NOT be here!\n"));
     682    return NULL;
     683}
     684
     685static int strLength(const char * pcszStr, char sep)
     686{
     687    if (sep == '\0')
     688        return (int)strlen(pcszStr);
     689    const char * pcszNext = strchr(pcszStr, sep);
     690    if (pcszNext)
     691        return (int)(pcszNext - pcszStr);
     692    return (int)strlen(pcszStr);
     693}
     694
     695static int strCmp(const char * pcszStr1, const char * pcszStr2, char sep)
     696{
     697    if (sep == '\0')
     698        return strcmp(pcszStr1, pcszStr2);
     699
     700    int cStr1 = strLength(pcszStr1, sep);
     701    int cStr2 = strLength(pcszStr2, sep);
     702    int iCmp = strncmp(pcszStr1, pcszStr2, MIN(cStr1, cStr2));
     703    if (iCmp)
     704        return iCmp;
     705    return cStr1 - cStr2;
     706}
     707
     708static char * strDupCur(const char * pcszStr, char sep)
     709{
     710    int cStr = strLength(pcszStr, sep);
     711    char * newStr = (char *)malloc(cStr+1);
     712    if (!newStr)
     713    {
     714        Log(("malloc failed!\n"));
     715        return NULL;
     716    }
     717    memcpy(newStr, pcszStr, cStr);
     718    newStr[cStr] = '\0';
     719    return newStr;
     720}
     721
     722static char * strDupTotal(const char * pcszStr)
     723{
     724    int cStr = (int)strlen(pcszStr);
     725    char * newStr = (char *)malloc(cStr+1+1);
     726    if (!newStr)
     727    {
     728        Log(("malloc failed!\n"));
     729        return NULL;
     730    }
     731    memcpy(newStr, pcszStr, cStr);
     732    newStr[cStr] = '\0';
     733    newStr[cStr+1] = '\0';
     734    return newStr;
     735}
     736
     737static char * strDupSort(const char * pcszStr)
     738{
     739    int cStr = (int)strlen(pcszStr);
     740    char * pNewStr = (char *)malloc(cStr+1+1+1);
     741    if (!pNewStr)
     742    {
     743        Log(("malloc failed!\n"));
     744        return NULL;
     745    }
     746    char *pCurNew = pNewStr;
     747    const char *pPrevCmp = NULL;
     748    const char * pCmp = "\001";
     749    const char * pCur;
     750    int cLength, cPrevLength;
     751
     752    do
     753    {
     754        cLength = 0;
     755        for (pCur = pcszStr; pCur; pCur = strNext(pCur))
     756        {
     757            int cCur = strLength(pCur, ' ');
     758            int cCmp = strLength(pCmp, ' ');
     759            int iCmp = strncmp(pCur, pCmp, MIN(cCur, cCmp));
     760            if (!iCmp)
     761                iCmp = cCur - cCmp;
     762            if (iCmp > 0)
     763            {
     764                if (!cLength)
     765                {
     766                    pCmp = pCur;
     767                    cLength = cCur;
     768                }
     769            }
     770            else if (iCmp < 0)
     771            {
     772                if (cLength)
     773                {
     774                    if (pPrevCmp)
     775                    {
     776                        int iCmp = strncmp(pCur, pPrevCmp, MIN(cCur, cPrevLength));
     777                        if (!iCmp)
     778                            iCmp = cCur - cPrevLength;
     779                        if (iCmp > 0)
     780                        {
     781                            pCmp = pCur;
     782                            cLength = cCur;
     783                        }
     784                    }
     785                    else
     786                    {
     787                        pCmp = pCur;
     788                        cLength = cCur;
     789                    }
     790                }
     791            }
     792        }
     793
     794        if (!cLength)
     795            break;
     796
     797        pPrevCmp = pCmp;
     798        cPrevLength = cLength;
     799        memcpy(pCurNew, pCmp, cLength);
     800        pCurNew += cLength;
     801        *pCurNew = ' ';
     802        ++pCurNew;
     803    } while (1);
     804
     805    *pCurNew = '\0';
     806    ++pCurNew;
     807
     808    return pNewStr;
     809}
     810
     811
     812#define DUMP_DIFF_STR_ADDED(_pStr) do { \
     813        char * pszCopy = strDupCur(_pStr, ' '); \
     814        Log(("+ %s\n", pszCopy)); \
     815        if (pszCopy) free(pszCopy); \
     816    } while (0)
     817
     818#define DUMP_DIFF_STR_REMOVED(_pStr) do { \
     819        char * pszCopy = strDupCur(_pStr, ' '); \
     820        Log(("- %s\n", pszCopy)); \
     821        if (pszCopy) free(pszCopy); \
     822    } while (0)
     823
     824#define DIFF_STR_ADDED(_ppStr) do { \
     825        DUMP_DIFF_STR_ADDED(*(_ppStr)); \
     826        *(_ppStr) = strNext(*(_ppStr)); \
     827    } while (0)
     828
     829#define DIFF_STR_REMOVED(_ppStr) do { \
     830        DUMP_DIFF_STR_REMOVED(*(_ppStr)); \
     831        *(_ppStr) = strNext(*(_ppStr)); \
     832    } while (0)
     833
     834#define DIFF_STR_MATCHED(_ppStr1, _ppStr2) do { \
     835        *(_ppStr1) = strNext(*(_ppStr1)); \
     836        *(_ppStr2) = strNext(*(_ppStr2)); \
     837    } while (0)
     838
     839static void diffStrOrderedLists(const char * pcszStr1, const char * pcszStr2)
     840{
     841    while (pcszStr1 || pcszStr2)
     842    {
     843        if (pcszStr1 && pcszStr2)
     844        {
     845            int iCmp = strCmp(pcszStr1, pcszStr2, ' ');
     846//            int cStr1 = strLength(pcszStr1, ' ');
     847//            int cStr2 = strLength(pcszStr2, ' ');
     848//            int iCmp = strncmp(pcszStr1, pcszStr2, MAX(cStr1, cStr2));
     849            if (iCmp > 0)
     850                DIFF_STR_ADDED(&pcszStr2);
     851            else if (iCmp < 0)
     852                DIFF_STR_REMOVED(&pcszStr1);
     853            else
     854                DIFF_STR_MATCHED(&pcszStr1, &pcszStr2);
     855        }
     856        else if (pcszStr1)
     857            DIFF_STR_REMOVED(&pcszStr1);
     858        else
     859            DIFF_STR_ADDED(&pcszStr2);
     860    }
     861}
     862
     863static void diffGlExts(const char * pcszExts1, const char * pcszExts2)
     864{
     865    pcszExts1 = strDupSort(pcszExts1);
     866    pcszExts2 = strDupSort(pcszExts2);
     867
     868    if (!strcmp(pcszExts1, pcszExts2))
     869    {
     870        Log(("GL Exts identical!\n"));
     871        Log(("%s\n", pcszExts1));
     872        return;
     873    }
     874
     875    Log(("%s\n", pcszExts1));
     876
     877    Log(("Diffing GL Exts..\n"));
     878    diffStrOrderedLists(pcszExts1, pcszExts2);
     879}
     880
     881static char *g_GlExts1 =
     882        "GL_ARB_multisample GL_EXT_abgr GL_EXT_bgra GL_EXT_blend_color GL_EXT_blend_logic_op GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_copy_texture "
     883        "GL_EXT_polygon_offset GL_EXT_subtexture GL_EXT_texture_object GL_EXT_vertex_array GL_EXT_compiled_vertex_array GL_EXT_texture GL_EXT_texture3D "
     884        "GL_IBM_rasterpos_clip GL_ARB_point_parameters GL_EXT_draw_range_elements GL_EXT_packed_pixels GL_EXT_point_parameters GL_EXT_rescale_normal "
     885        "GL_EXT_separate_specular_color GL_EXT_texture_edge_clamp GL_SGIS_generate_mipmap GL_SGIS_texture_border_clamp GL_SGIS_texture_edge_clamp "
     886        "GL_SGIS_texture_lod GL_ARB_framebuffer_sRGB GL_ARB_multitexture GL_EXT_framebuffer_sRGB GL_IBM_multimode_draw_arrays GL_IBM_texture_mirrored_repeat "
     887        "GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_transpose_matrix GL_EXT_blend_func_separate GL_EXT_fog_coord GL_EXT_multi_draw_arrays "
     888        "GL_EXT_secondary_color GL_EXT_texture_env_add GL_EXT_texture_filter_anisotropic GL_EXT_texture_lod_bias GL_INGR_blend_func_separate GL_NV_blend_square "
     889        "GL_NV_light_max_exponent GL_NV_texgen_reflection GL_NV_texture_env_combine4 GL_SUN_multi_draw_arrays GL_ARB_texture_border_clamp GL_ARB_texture_compression GL_EXT_framebuffer_object "
     890        "GL_EXT_texture_env_dot3 GL_MESA_window_pos GL_NV_packed_depth_stencil GL_NV_texture_rectangle GL_ARB_depth_texture GL_ARB_occlusion_query GL_ARB_shadow GL_ARB_texture_env_combine "
     891        "GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_mirrored_repeat GL_ARB_window_pos GL_EXT_stencil_two_side GL_EXT_texture_cube_map GL_NV_depth_clamp GL_APPLE_packed_pixels "
     892        "GL_APPLE_vertex_array_object GL_ARB_draw_buffers GL_ARB_fragment_program GL_ARB_fragment_shader GL_ARB_shader_objects GL_ARB_vertex_program GL_ARB_vertex_shader GL_ATI_draw_buffers GL_ATI_texture_env_combine3 "
     893        "GL_EXT_shadow_funcs GL_EXT_stencil_wrap GL_MESA_pack_invert GL_NV_primitive_restart GL_ARB_depth_clamp GL_ARB_fragment_program_shadow GL_ARB_half_float_pixel GL_ARB_occlusion_query2 GL_ARB_point_sprite "
     894        "GL_ARB_shading_language_100 GL_ARB_sync GL_ARB_texture_non_power_of_two GL_ARB_vertex_buffer_object GL_ATI_blend_equation_separate GL_EXT_blend_equation_separate GL_OES_read_format GL_ARB_color_buffer_float "
     895        "GL_ARB_pixel_buffer_object GL_ARB_texture_compression_rgtc GL_ARB_texture_rectangle GL_EXT_packed_float GL_EXT_pixel_buffer_object GL_EXT_texture_compression_rgtc GL_EXT_texture_mirror_clamp GL_EXT_texture_rectangle "
     896        "GL_EXT_texture_sRGB GL_EXT_texture_shared_exponent GL_ARB_framebuffer_object GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXT_packed_depth_stencil GL_ARB_vertex_array_object GL_ATI_separate_stencil "
     897        "GL_ATI_texture_mirror_once GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_gpu_program_parameters GL_EXT_texture_env_combine GL_EXT_texture_sRGB_decode GL_EXT_timer_query GL_OES_EGL_image GL_ARB_copy_buffer "
     898        "GL_ARB_draw_instanced GL_ARB_half_float_vertex GL_ARB_instanced_arrays GL_ARB_map_buffer_range GL_ARB_texture_rg GL_ARB_texture_swizzle GL_ARB_vertex_array_bgra GL_EXT_separate_shader_objects GL_EXT_texture_swizzle "
     899        "GL_EXT_vertex_array_bgra GL_NV_conditional_render GL_ARB_ES2_compatibility GL_ARB_draw_elements_base_vertex GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_provoking_vertex "
     900        "GL_ARB_sampler_objects GL_ARB_shader_texture_lod GL_EXT_provoking_vertex GL_EXT_texture_snorm GL_MESA_texture_signed_rgba GL_NV_texture_barrier GL_ARB_robustness"
     901        ;
     902static char *g_GlExts2 = "GL_ARB_blend_func_extended GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_copy_buffer GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers "
     903        "GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_ES2_compatibility GL_ARB_explicit_attrib_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_program GL_ARB_fragment_program_shadow "
     904        "GL_ARB_fragment_shader GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays "
     905        "GL_ARB_map_buffer_range GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_provoking_vertex "
     906        "GL_ARB_robustness GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_separate_shader_objects GL_ARB_shader_bit_encoding GL_ARB_shader_objects GL_ARB_shading_language_100 GL_ARB_shading_language_include "
     907        "GL_ARB_shadow GL_ARB_sync GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_compression GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_env_add GL_ARB_texture_env_combine "
     908        "GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_rectangle GL_ARB_texture_rg "
     909        "GL_ARB_texture_rgb10_a2ui GL_ARB_texture_swizzle GL_ARB_timer_query GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_buffer_object GL_ARB_vertex_program "
     910        "GL_ARB_vertex_shader GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra "
     911        "GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_depth_bounds_test "
     912        "GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXTX_framebuffer_mixed_formats "
     913        "GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels "
     914        "GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_shader_objects GL_EXT_separate_specular_color GL_EXT_shadow_funcs "
     915        "GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc "
     916        "GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_format_BGRA8888 GL_EXT_texture_integer "
     917        "GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_shared_exponent GL_EXT_texture_sRGB GL_EXT_texture_swizzle GL_EXT_texture_type_2_10_10_10_REV GL_EXT_timer_query "
     918        "GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_EXT_x11_sync_object GL_EXT_import_sync_object GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KTX_buffer_region GL_NV_alpha_test GL_NV_blend_minmax GL_NV_blend_square "
     919        "GL_NV_complex_primitives GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_copy_image GL_NV_depth_buffer_float GL_NV_depth_clamp GL_NV_explicit_multisample GL_NV_fbo_color_attachments "
     920        "GL_NV_fence GL_NV_float_buffer GL_NV_fog_distance GL_NV_fragdepth GL_NV_fragment_program GL_NV_fragment_program_option GL_NV_fragment_program2 GL_NV_framebuffer_multisample_coverage GL_NV_geometry_shader4 "
     921        "GL_NV_gpu_program4 GL_NV_half_float GL_NV_light_max_exponent GL_NV_multisample_coverage GL_NV_multisample_filter_hint GL_NV_occlusion_query GL_NV_packed_depth_stencil GL_NV_parameter_buffer_object "
     922        "GL_NV_parameter_buffer_object2 GL_NV_path_rendering GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_primitive_restart GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_shader_buffer_load GL_NV_texgen_reflection "
     923        "GL_NV_texture_barrier GL_NV_texture_compression_vtc GL_NV_texture_env_combine4 GL_NV_texture_expand_normal GL_NV_texture_lod_clamp GL_NV_texture_multisample GL_NV_texture_rectangle GL_NV_texture_shader GL_NV_texture_shader2 "
     924        "GL_NV_texture_shader3 GL_NV_transform_feedback GL_NV_vdpau_interop GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_buffer_unified_memory GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NV_vertex_program2 "
     925        "GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_NVX_conditional_render GL_NVX_gpu_memory_info GL_OES_depth24 GL_OES_depth32 GL_OES_depth_texture GL_OES_element_index_uint GL_OES_fbo_render_mipmap "
     926        "GL_OES_get_program_binary GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float "
     927        "GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_array_object GL_OES_vertex_half_float GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum";
     928
     929typedef enum
     930{
     931    D3DCAPSSOURCE_TYPE_UNDEFINED = 0,
     932    D3DCAPSSOURCE_TYPE_EMBEDDED1,
     933    D3DCAPSSOURCE_TYPE_EMBEDDED2,
     934    D3DCAPSSOURCE_TYPE_NULL,
     935    D3DCAPSSOURCE_TYPE_LOCAL,
     936    D3DCAPSSOURCE_TYPE_FILE
     937} D3DCAPSSOURCE_TYPE;
     938
     939static D3DCAPS9* selectCaps(D3DCAPS9 *pLocalStorage, D3DCAPS9 *pLocalEmbedded1, D3DCAPS9 *pLocalEmbedded2, D3DCAPSSOURCE_TYPE enmCapsType)
     940{
     941    switch (enmCapsType)
     942    {
     943        case D3DCAPSSOURCE_TYPE_EMBEDDED1:
     944            return pLocalEmbedded1;
     945        case D3DCAPSSOURCE_TYPE_EMBEDDED2:
     946            return pLocalEmbedded2;
     947        case D3DCAPSSOURCE_TYPE_NULL:
     948            memset (pLocalStorage, 0, sizeof (*pLocalStorage));
     949            return pLocalStorage;
     950        case D3DCAPSSOURCE_TYPE_LOCAL:
     951        {
     952            LPDIRECT3D9EX pD3D = NULL;
     953            HRESULT hr = Direct3DCreate9Ex(D3D_SDK_VERSION, &pD3D);
     954            if (FAILED(hr))
     955            {
     956                Log(("Direct3DCreate9Ex failed hr 0x%x\n", hr));
     957                return NULL;
     958            }
     959
     960            memset (pLocalStorage, 0, sizeof (*pLocalStorage));
     961
     962            hr = pD3D->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, pLocalStorage);
     963
     964            pD3D->Release();
     965
     966            if (FAILED(hr))
     967            {
     968                Log(("GetDeviceCaps failed hr 0x%x\n", hr));
     969                return NULL;
     970            }
     971
     972            return pLocalStorage;
     973        }
     974        case D3DCAPSSOURCE_TYPE_FILE:
     975        {
     976            Log(("Loading caps from file not implemented yet!"));
     977            return NULL;
     978        }
     979        default:
     980        {
     981            Log(("Unsupported type %d", enmCapsType));
     982            return NULL;
     983        }
     984    }
     985
     986    Log(("Should not be here!"));
     987    return NULL;
     988}
     989
    652990int main()
    653991{
     992    diffGlExts(g_GlExts1, g_GlExts2);
     993
    654994    if (sizeof (g_aCaps1) != sizeof (D3DCAPS9))
    655995    {
    656         Log(("incorrect caps 1 size (%d), expected(%d)", sizeof (g_aCaps1), sizeof (D3DCAPS9)));
     996        Log(("incorrect caps 1 size (%d), expected(%d)\n", sizeof (g_aCaps1), sizeof (D3DCAPS9)));
    657997        return 1;
    658998    }
     
    6601000    if (sizeof (g_aCaps2) != sizeof (D3DCAPS9))
    6611001    {
    662         Log(("incorrect caps 2 size (%d), expected(%d)", sizeof (g_aCaps2), sizeof (D3DCAPS9)));
     1002        Log(("incorrect caps 2 size (%d), expected(%d)\n", sizeof (g_aCaps2), sizeof (D3DCAPS9)));
    6631003        return 1;
    6641004    }
    6651005
    666     diffCaps((D3DCAPS9*)g_aCaps1, (D3DCAPS9*)g_aCaps2);
     1006    D3DCAPS9 Caps1, Caps2;
     1007    D3DCAPS9 *pCaps1, *pCaps2;
     1008    D3DCAPSSOURCE_TYPE enmCaps1 = D3DCAPSSOURCE_TYPE_EMBEDDED2;
     1009    D3DCAPSSOURCE_TYPE enmCaps2 = D3DCAPSSOURCE_TYPE_EMBEDDED1;
     1010
     1011    pCaps1 = selectCaps(&Caps1, (D3DCAPS9*)g_aCaps1, (D3DCAPS9*)g_aCaps2, enmCaps1);
     1012    if (!pCaps1)
     1013    {
     1014        Log(("Failed to select Caps1"));
     1015        return 1;
     1016    }
     1017
     1018    pCaps2 = selectCaps(&Caps2, (D3DCAPS9*)g_aCaps1, (D3DCAPS9*)g_aCaps2, enmCaps2);
     1019    if (!pCaps2)
     1020    {
     1021        Log(("Failed to select Caps2"));
     1022        return 1;
     1023    }
     1024
     1025    diffCaps((D3DCAPS9*)g_aCaps2, (D3DCAPS9*)g_aCaps1);
    6671026    return 0;
    6681027}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette