]> git.cworth.org Git - apitrace/commitdiff
Merge branch 'attrib_list'
authorJosé Fonseca <jfonseca@vmware.com>
Sat, 20 Jul 2013 13:53:14 +0000 (14:53 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Sat, 20 Jul 2013 13:53:14 +0000 (14:53 +0100)
Conflicts:
specs/glxapi.py

37 files changed:
Android.mk
BUGS.markdown
README.markdown
cli/CMakeLists.txt
cli/cli.hpp
cli/cli_main.cpp
cli/cli_sed.cpp [new file with mode: 0644]
cli/cli_trim.cpp
cli/trace_analyzer.cpp
common/trace_backtrace.cpp
common/trace_dump.cpp
common/trace_file_zlib.cpp
common/trace_loader.cpp
common/trace_model.cpp
common/trace_model.hpp
common/trace_parser.cpp
common/trace_profiler.cpp
dispatch/glimports.hpp
gui/argumentseditor.cpp
gui/argumentseditor.h
gui/mainwindow.cpp
gui/retracer.cpp
gui/retracer.h
gui/ui/retracerdialog.ui
retrace/d3d10state_images.cpp
retrace/d3d11state_images.cpp
retrace/dxgistate.cpp
retrace/glretrace_cgl.cpp
retrace/glretrace_egl.cpp
retrace/glretrace_glx.cpp
retrace/glretrace_ws.cpp
retrace/glstate_images.cpp
retrace/retrace.hpp
retrace/retrace.py
specs/glxapi.py
specs/wglapi.py
thirdparty/directxtex/DirectXTex/DirectXTexConvert.cpp

index 7e4c7a7880420613b046628617f6bad9a1341962..9e38fcb730a4023a38c8a62f0c9944495cc1ea9f 100644 (file)
@@ -7,10 +7,15 @@
 # This may work in other than FirefoxOS environments, but has not been tested.
 #
 
+NDK := prebuilt/ndk/android-ndk-r7
+
 ifeq ($(shell which cmake),)
 $(shell echo "CMake not found, will not compile apitrace" >&2)
 else # cmake
-$(shell echo "CMake found, will compile apitrace" >&2)
+ifeq ($(wildcard $(NDK)),)
+$(shell echo "CMake present but NDK not found at $(abspath $(NDK)), will not compile apitrace" >&2)
+else # NDK
+$(shell echo "CMake and NDK ($(abspath $(NDK))) found, will compile apitrace" >&2)
 
 LOCAL_PATH := $(call my-dir)
 
@@ -49,7 +54,7 @@ apitrace_private_target:
                cd $(MY_APITRACE_ROOT) && \
                cmake \
                -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain/android.toolchain.cmake \
-               -DANDROID_NDK=../../prebuilt/ndk/android-ndk-r7 \
+               -DANDROID_NDK=../../$(NDK) \
                -DANDROID_NDK_LAYOUT=LINARO \
                -DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.4.x \
                -DANDROID_API_LEVEL=9 \
@@ -84,4 +89,5 @@ $(linked_module): apitrace_private_target
        $(hide) mkdir -p $(dir $@)
        $(hide) cp $(MY_APITRACE_BUILD_ROOT_TARGET)/apitrace$(TARGET_EXECUTABLE_SUFFIX) $@
 
+endif # NDK
 endif # cmake
index 56049c1de24557e3901bc0c8b023509f3c9ef6be..d8258a7be883deae8069dda6e2fbc7da8a699a37 100644 (file)
@@ -176,7 +176,8 @@ Linux/MacOSX
 ------------
 
 Please rebuild apitrace with debugging information, by passing
-`-DCMAKE_BUILD_TYPE=Debug` to cmake.
+`-DCMAKE_BUILD_TYPE=Debug` to cmake, or editing its value in `CMakeCache.txt`
+and rebuilding.
 
 To obtain a stack back-trace, run the application with gdb from a terminal:
 
@@ -185,6 +186,10 @@ To obtain a stack back-trace, run the application with gdb from a terminal:
     ...
     (gdb) bt
 
+On Linux, to trace an application inside gdb the `LD_PRELOAD` environment
+variable should be set from within gdb like:
+
+    gdb --ex 'set exec-wrapper env LD_PRELOAD=/path/to/glxtrace.so' --args application arg1 ...
 
 See also more detailed and Distro specific instructions:
 
index 5f97d871ca2b40c2888fe3df16eab9e92571b292..f69991485bb66150acdef9fe36f3f13341f41183 100644 (file)
@@ -145,10 +145,6 @@ If you are an application developer, you can avoid this either by linking with
 See the `ld.so` man page for more information about `LD_PRELOAD` and
 `LD_LIBRARY_PATH` environment flags.
 
-To trace the application inside gdb, invoke gdb as:
-
-    gdb --ex 'set exec-wrapper env LD_PRELOAD=/path/to/glxtrace.so' --args /path/to/application
-
 ### Android ###
 
 To trace standalone native OpenGL ES applications, use
index 713222fcfbb5e52670a7173102e74b32fc77119d..299c3985a3284c120f8b33bf83df16fa77c98d92 100644 (file)
@@ -20,6 +20,7 @@ add_executable (apitrace
     cli_pickle.cpp
     cli_repack.cpp
     cli_retrace.cpp
+    cli_sed.cpp
     cli_trace.cpp
     cli_trim.cpp
     cli_resources.cpp
index c35cb3ac9eb6144cea3eb898dc4db092eae97007..088f0e8c2241bce3c3d3f7cf0c84b07f77b2bce0 100644 (file)
@@ -48,6 +48,7 @@ extern const Command dump_images_command;
 extern const Command pickle_command;
 extern const Command repack_command;
 extern const Command retrace_command;
+extern const Command sed_command;
 extern const Command trace_command;
 extern const Command trim_command;
 
index d6db6196121b3d5a9a158c29309c1e7f556a02c8..1e278e41381d1d4860175a84b7b058369d338757 100644 (file)
@@ -72,6 +72,7 @@ static const Command * commands[] = {
     &dump_command,
     &dump_images_command,
     &pickle_command,
+    &sed_command,
     &repack_command,
     &retrace_command,
     &trace_command,
diff --git a/cli/cli_sed.cpp b/cli/cli_sed.cpp
new file mode 100644 (file)
index 0000000..04dbc5c
--- /dev/null
@@ -0,0 +1,308 @@
+/**************************************************************************
+ *
+ * Copyright 2013 VMware, Inc.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ **************************************************************************/
+
+
+#include <limits.h> // for CHAR_MAX
+#include <getopt.h>
+
+#include "cli.hpp"
+
+#include "os_string.hpp"
+
+#include "trace_parser.hpp"
+#include "trace_writer.hpp"
+
+
+static const char *synopsis = "Stream editing of a trace.";
+
+
+static void
+usage(void)
+{
+    std::cout
+        << "usage: apitrace sed [OPTIONS] TRACE_FILE...\n"
+        << synopsis << "\n"
+        "\n"
+        "    -h, --help               Show detailed help for sed options and exit\n"
+        "    -e s/SEARCH/REPLACE/     Search and replace a symbol.\n"
+        "                             XXX: Only works for enums.\n"
+        "    -o, --output=TRACE_FILE  Output trace file\n"
+    ;
+}
+
+
+const static char *
+shortOptions = "ho:e:";
+
+const static struct option
+longOptions[] = {
+    {"help", no_argument, 0, 'h'},
+    {"output", required_argument, 0, 'o'},
+    {0, 0, 0, 0}
+};
+
+using namespace trace;
+
+
+/**
+ * A visitor that replaces symbol constants.
+ */
+class Replacer : public Visitor
+{
+protected:
+    std::string searchName;
+    std::string replaceName;
+
+public:
+    Replacer(const std::string & _searchName, const std::string & _replaceName) :
+        searchName(_searchName),
+        replaceName(_replaceName)
+    {
+    }
+
+    ~Replacer() {
+    }
+
+    void visit(Null *) {
+    }
+
+    void visit(Bool *node) {
+    }
+
+    void visit(SInt *node) {
+    }
+
+    void visit(UInt *node) {
+    }
+
+    void visit(Float *node) {
+    }
+
+    void visit(Double *node) {
+    }
+
+    void visit(String *node) {
+    }
+
+    void visit(Enum *node) {
+        const EnumValue *it = node->lookup();
+        if (it) {
+            if (searchName.compare(it->name) == 0) {
+                const EnumSig *sig = node->sig;
+                for (unsigned i = 0; i < sig->num_values; ++i) {
+                    if (replaceName.compare(sig->values[i].name) == 0) {
+                        node->value = sig->values[i].value;
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    void visit(Bitmask *bitmask) {
+    }
+
+    void visit(Struct *s) {
+        for (unsigned i = 0; i < s->members.size(); ++i) {
+            Value *memberValue = s->members[i];
+            _visit(memberValue);
+        }
+    }
+
+    void visit(Array *array) {
+        for (std::vector<Value *>::iterator it = array->values.begin(); it != array->values.end(); ++it) {
+            _visit(*it);
+        }
+    }
+
+    void visit(Blob *blob) {
+    }
+
+    void visit(Pointer *p) {
+    }
+
+    void visit(Repr *r) {
+        _visit(r->humanValue);
+    }
+
+    void visit(Call *call) {
+        for (unsigned i = 0; i < call->args.size(); ++i) {
+            if (call->args[i].value) {
+                _visit(call->args[i].value);
+            }
+        }
+
+        if (call->ret) {
+            _visit(call->ret);
+        }
+    }
+};
+
+
+typedef std::list<Replacer> Replacements;
+
+
+static int
+sed_trace(Replacements &replacements, const char *inFileName, std::string &outFileName)
+{
+    trace::Parser p;
+
+    if (!p.open(inFileName)) {
+        std::cerr << "error: failed to open " << inFileName << "\n";
+        return 1;
+    }
+
+    /* Prepare outFileName file and writer for outFileName. */
+    if (outFileName.empty()) {
+        os::String base(inFileName);
+        base.trimExtension();
+
+        outFileName = std::string(base.str()) + std::string("-sed.trace");
+    }
+
+    trace::Writer writer;
+    if (!writer.open(outFileName.c_str())) {
+        std::cerr << "error: failed to create " << outFileName << "\n";
+        return 1;
+    }
+
+    trace::Call *call;
+    while ((call = p.parse_call())) {
+
+        for (Replacements::iterator it = replacements.begin(); it != replacements.end(); ++it) {
+            it->visit(call);
+        }
+
+        writer.writeCall(call);
+
+        delete call;
+    }
+
+    std::cerr << "Trimmed trace is available as " << outFileName << "\n";
+
+    return 0;
+}
+
+
+/**
+ * Parse a string in the format "s/SEARCH/REPLACE/".
+ */
+static bool
+parseSubstOpt(Replacements &replacements, const char *opt)
+{
+    if (*opt++ != 's') {
+        return false;
+    }
+
+    if (*opt++ != '/') {
+        return false;
+    }
+
+    // Parse the search pattern
+    const char *search_begin = opt;
+    while (*opt != '/') {
+        if (*opt == 0) {
+            return false;
+        }
+        ++opt;
+    }
+    const char *search_end = opt++;
+
+    // Parse the replace pattern
+    const char *replace_begin = opt;
+    while (*opt != '/') {
+        if (*opt == 0) {
+            return false;
+        }
+        ++opt;
+    }
+    const char *replace_end = opt++;
+
+    if (*opt != 0) {
+        return false;
+    }
+
+    std::string search(search_begin, search_end);
+    std::string replace(replace_begin, replace_end);
+
+    replacements.push_back(Replacer(search, replace));
+
+    return true;
+}
+
+
+static int
+command(int argc, char *argv[])
+{
+    Replacements replacements;
+    std::string outFileName;
+
+    int opt;
+    while ((opt = getopt_long(argc, argv, shortOptions, longOptions, NULL)) != -1) {
+        switch (opt) {
+        case 'h':
+            usage();
+            return 0;
+        case 'o':
+            outFileName = optarg;
+            break;
+        case 'e':
+            if (!parseSubstOpt(replacements, optarg)) {
+                std::cerr << "error: invalid replacement patter `" << optarg << "`\n";
+            }
+            break;
+        default:
+            std::cerr << "error: unexpected option `" << opt << "`\n";
+            usage();
+            return 1;
+        }
+    }
+
+    if (optind >= argc) {
+        std::cerr << "error: apitrace sed requires a trace file as an argument.\n";
+        usage();
+        return 1;
+    }
+
+    if (argc > optind + 1) {
+        std::cerr << "error: extraneous arguments:";
+        for (int i = optind + 1; i < argc; i++) {
+            std::cerr << " " << argv[i];
+        }
+        std::cerr << "\n";
+        usage();
+        return 1;
+    }
+
+    return sed_trace(replacements, argv[optind], outFileName);
+}
+
+
+const Command sed_command = {
+    "sed",
+    synopsis,
+    usage,
+    command
+};
index 342e66b02e831c2b22a5d9a63d4a17e98c9a48d1..938329c94d566769cac982a026cc9561b935b60c 100644 (file)
@@ -273,7 +273,7 @@ trim_trace(const char *filename, struct trim_options *options)
 
     trace::Writer writer;
     if (!writer.open(options->output.c_str())) {
-        std::cerr << "error: failed to create " << filename << "\n";
+        std::cerr << "error: failed to create " << options->output << "\n";
         return 1;
     }
 
index 374e6ceffedcc545c86aa11b8403679cce27a7bd..79f95579eb2626be39a3aa724542367147f2de04 100644 (file)
@@ -279,7 +279,7 @@ bool
 TraceAnalyzer::recordTextureSideEffects(trace::Call *call, const char *name)
 {
     if (strcmp(name, "glGenTextures") == 0) {
-        const trace::Array *textures = dynamic_cast<const trace::Array *>(&call->arg(1));
+        const trace::Array *textures = call->arg(1).toArray();
         size_t i;
         GLuint texture;
 
index 5cd30c93e47e7bee16e2acd3b8b59db2ad706026..ba2a3739a6082b48a03e036bd0f4976c23c56f55 100644 (file)
@@ -112,7 +112,7 @@ bool backtrace_is_needed(const char* fname) {
 
 } /* namespace trace */
 
-#ifdef ANDROID
+#if defined(ANDROID)
 
 #include <dlfcn.h>
 #include "os.hpp"
@@ -270,7 +270,7 @@ std::vector<RawStackFrame> get_backtrace() {
 }
 
 /* end ANDROID */
-#elif defined __linux__
+#elif defined(__ELF__)
 
 #include <stdint.h>
 #include <dlfcn.h>
@@ -278,7 +278,7 @@ std::vector<RawStackFrame> get_backtrace() {
 #include <vector>
 #include <cxxabi.h>
 
-#include "backtrace.h"
+#include <backtrace.h>
 
 namespace trace {
 
index 655b023d55c97b7bbcf5c236be9b4949a4b3844d..6e67e08ab53e0f2585d5a1e952b9d00bae220b02 100644 (file)
@@ -178,7 +178,7 @@ public:
 
             if (!memberName || !*memberName) {
                 // Anonymous structure
-                Struct *memberStruct = dynamic_cast<Struct *>(memberValue);
+                Struct *memberStruct = memberValue->toStruct();
                 assert(memberStruct);
                 if (memberStruct) {
                     sep = visitMembers(memberStruct, sep);
index c4eed33dd2df650d9f63826981999b3498a500ad..a432ccde44598984f2503ff4a68e304a723ec54d 100644 (file)
@@ -105,12 +105,12 @@ bool ZLibFile::rawOpen(const std::string &filename, File::Mode mode)
 
 bool ZLibFile::rawWrite(const void *buffer, size_t length)
 {
-    return gzwrite(m_gzFile, buffer, length) != -1;
+    return gzwrite(m_gzFile, buffer, unsigned(length)) != -1;
 }
 
 size_t ZLibFile::rawRead(void *buffer, size_t length)
 {
-    int ret = gzread(m_gzFile, buffer, length);
+    int ret = gzread(m_gzFile, buffer, unsigned(length));
     return ret < 0 ? 0 : ret;
 }
 
@@ -150,7 +150,7 @@ bool ZLibFile::rawSkip(size_t)
 int ZLibFile::rawPercentRead()
 {
     gz_state *state = (gz_state *)m_gzFile;
-    return 100 * (lseek(state->fd, 0, SEEK_CUR) / m_endOffset);
+    return int(100 * (lseek(state->fd, 0, SEEK_CUR) / m_endOffset));
 }
 
 
index e091dce38688f1395fba51d0a67c86a96426c49c..6a3d7de08b3ddf8bc20d136272e50895d3d5850f 100644 (file)
@@ -25,7 +25,7 @@ void Loader::setFrameMarker(Loader::FrameMarker marker)
 
 unsigned Loader::numberOfFrames() const
 {
-    return m_frameBookmarks.size();
+    return unsigned(m_frameBookmarks.size());
 }
 
 unsigned Loader::numberOfCallsInFrame(unsigned frameIdx) const
index 2c0fafaabbc6e81240d95eba251ebe9a9a434abf..3f19bc6c60b27c43f82f66acd976fdee364871dc 100644 (file)
@@ -210,7 +210,7 @@ void Visitor::visit(StackFrame *) { assert(0); }
 static Null null;
 
 const Value & Value::operator[](size_t index) const {
-    const Array *array = dynamic_cast<const Array *>(this);
+    const Array *array = toArray();
     if (array) {
         if (index < array->values.size()) {
             return *array->values[index];
index 4a9ca476f262580f6c32a83ce6ba882f41630935..36f0a03eff83cb15d5919fb86b661eb0cd271513 100644 (file)
@@ -91,6 +91,9 @@ struct BitmaskSig {
 
 
 class Visitor;
+class Null;
+class Struct;
+class Array;
 
 
 class Value
@@ -110,6 +113,15 @@ public:
     virtual unsigned long long toUIntPtr(void) const;
     virtual const char *toString(void) const;
 
+    virtual const Null *toNull(void) const { return NULL; }
+    virtual Null *toNull(void) { return NULL; }
+
+    virtual const Array *toArray(void) const { return NULL; }
+    virtual Array *toArray(void) { return NULL; }
+
+    virtual const Struct *toStruct(void) const { return NULL; }
+    virtual Struct *toStruct(void) { return NULL; }
+
     const Value & operator[](size_t index) const;
 };
 
@@ -127,6 +139,9 @@ public:
     unsigned long long toUIntPtr(void) const;
     const char *toString(void) const;
     void visit(Visitor &visitor);
+
+    const Null *toNull(void) const { return this; }
+    Null *toNull(void) { return this; }
 };
 
 
@@ -266,6 +281,9 @@ public:
     bool toBool(void) const;
     void visit(Visitor &visitor);
 
+    const Struct *toStruct(void) const { return this; }
+    Struct *toStruct(void) { return this; }
+
     const StructSig *sig;
     std::vector<Value *> members;
 };
@@ -280,6 +298,9 @@ public:
     bool toBool(void) const;
     void visit(Visitor &visitor);
 
+    const Array *toArray(void) const { return this; }
+    Array *toArray(void) { return this; }
+
     std::vector<Value *> values;
 
     inline size_t
index f7a1f78e54b1e0f511a78bc8ee49a17ef51b153b..a9cdd0fbc0586465be407522a0148146e05f283a 100644 (file)
@@ -65,6 +65,8 @@ bool Parser::open(const char *filename) {
     version = read_uint();
     if (version > TRACE_VERSION) {
         std::cerr << "error: unsupported trace format version " << version << "\n";
+        delete file;
+        file = NULL;
         return false;
     }
     api = API_UNKNOWN;
index e9ed707e8ac3c91b3f4a629a1025022a731dd217..b7653409fb01042618017f547cc3495b48c973e9 100644 (file)
@@ -232,7 +232,7 @@ void Profiler::parseLine(const char* in, Profile* profile)
         }
     } else if (type.compare("frame_end") == 0) {
         Profile::Frame frame;
-        frame.no = profile->frames.size();
+        frame.no = unsigned(profile->frames.size());
 
         if (frame.no == 0) {
             frame.gpuStart = 0;
index e6d1d324f7f3649dcef6abd64140eaf83bcd41dd..358135f2ba86f62b444cedfa6ffb79e1fd0061d5 100644 (file)
@@ -89,8 +89,22 @@ typedef struct _WGLSWAP
 #elif defined(__APPLE__)
 
 #include <OpenGL/OpenGL.h>
+
+#include <AvailabilityMacros.h>
+
+#ifndef MAC_OS_X_VERSION_10_6
+#define MAC_OS_X_VERSION_10_6 1060
+#endif
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6
 #include <OpenGL/CGLIOSurface.h>
 #include <OpenGL/CGLDevice.h>
+#else
+#define kCGLPFAAcceleratedCompute 97
+#define kCGLRPAcceleratedCompute 130
+typedef void *CGLShareGroupObj;
+typedef struct __IOSurface *IOSurfaceRef;
+#endif
 
 #ifndef CGL_VERSION_1_3
 #define kCGLPFAOpenGLProfile 99
index e6345ea5659eac2301561c0fe102dee907b1082b..4310d2ec112642802ff04ae64b6c23c783785b9f 100644 (file)
@@ -30,6 +30,7 @@ isVariantEditable(const QVariant &var)
     case QVariant::ULongLong:
     case QMetaType::Float:
     case QVariant::Double:
+    case QVariant::String:
         return true;
     default:
         return false;
@@ -71,6 +72,8 @@ void setArgumentsItemEditorFactory ()
     new QStandardItemEditorCreator<FloatEditorCreator>();
     QItemEditorCreatorBase *doubleEditorCreator =
     new QStandardItemEditorCreator<DoubleEditorCreator>();
+    QItemEditorCreatorBase *stringEditorCreator =
+    new QStandardItemEditorCreator<StringEditorCreator>();
     QItemEditorCreatorBase *invalidEditorCreator =
     new QStandardItemEditorCreator<InvalidEditorCreator>();
 
@@ -87,6 +90,7 @@ void setArgumentsItemEditorFactory ()
     factory->registerEditor(QVariant::Pixmap, pixmapEditorCreator);
     factory->registerEditor(typeFloat, floatEditorCreator);
     factory->registerEditor(QVariant::Double, doubleEditorCreator);
+    factory->registerEditor(QVariant::String, stringEditorCreator);
     factory->registerEditor(QVariant::Invalid, invalidEditorCreator);
 
     QItemEditorFactory::setDefaultFactory(factory);
index 27aa491f595cfe1162a44bf642a7ceea170d01e4..73cd45803cb3036689865e704804625232eafbad 100644 (file)
@@ -9,6 +9,7 @@
 #include <QItemEditorFactory>
 #include <QStandardItemModel>
 #include <QSpinBox>
+#include <QTextEdit>
 
 #include <limits.h>
 #include <float.h>
@@ -126,6 +127,16 @@ public:
     };
 };
 
+class StringEditorCreator : public QTextEdit
+{
+    Q_OBJECT
+    Q_PROPERTY(QString plainText READ toPlainText WRITE setPlainText USER true)
+public:
+    StringEditorCreator(QWidget *widget = 0) : QTextEdit(widget)
+    {
+    };
+};
+
 class InvalidEditorCreator : public QLabel
 {
     Q_OBJECT
index 2891863a4a0f87bbd147febdf916116870ec7b63..23729cd6d274f7f7b920fb2278286b13dcc6a05c 100644 (file)
@@ -196,6 +196,9 @@ void MainWindow::replayStart()
     dlgUi.errorCheckCB->setChecked(
         !m_retracer->isBenchmarking());
 
+    dlgUi.singlethreadCB->setChecked(
+        m_retracer->isSinglethread());
+
     if (dlg.exec() == QDialog::Accepted) {
         m_retracer->setDoubleBuffered(
             dlgUi.doubleBufferingCB->isChecked());
@@ -203,6 +206,9 @@ void MainWindow::replayStart()
         m_retracer->setBenchmarking(
             !dlgUi.errorCheckCB->isChecked());
 
+        m_retracer->setSinglethread(
+            dlgUi.singlethreadCB->isChecked());
+
         m_retracer->setProfiling(false, false, false);
 
         replayTrace(false, false);
index 2de9d23ee849de85f12c6cbf51461750ba7edf68..cb0bad35abcfb5284a79ee971a7be9f679a01c28 100644 (file)
@@ -130,6 +130,7 @@ Retracer::Retracer(QObject *parent)
     : QThread(parent),
       m_benchmarking(false),
       m_doubleBuffered(true),
+      m_singlethread(false),
       m_captureState(false),
       m_captureCall(0),
       m_profileGpu(false),
@@ -184,6 +185,16 @@ void Retracer::setDoubleBuffered(bool db)
     m_doubleBuffered = db;
 }
 
+bool Retracer::isSinglethread() const
+{
+    return m_singlethread;
+}
+
+void Retracer::setSinglethread(bool singlethread)
+{
+    m_singlethread = singlethread;
+}
+
 bool Retracer::isProfilingGpu() const
 {
     return m_profileGpu;
@@ -281,6 +292,10 @@ void Retracer::run()
         return;
     }
 
+    if (m_singlethread) {
+        arguments << QLatin1String("--singlethread");
+    }
+
     if (m_captureState) {
         arguments << QLatin1String("-D");
         arguments << QString::number(m_captureCall);
index 915b97fe0252cf86d01d74ee7a02df775eba2a16..bb534698661bd08adeceecaeef5ec5e51e61b6ed 100644 (file)
@@ -31,6 +31,9 @@ public:
     bool isDoubleBuffered() const;
     void setDoubleBuffered(bool db);
 
+    bool isSinglethread() const;
+    void setSinglethread(bool singlethread);
+
     bool isProfilingGpu() const;
     bool isProfilingCpu() const;
     bool isProfilingPixels() const;
@@ -63,6 +66,7 @@ private:
     trace::API m_api;
     bool m_benchmarking;
     bool m_doubleBuffered;
+    bool m_singlethread;
     bool m_captureState;
     bool m_captureThumbnails;
     qlonglong m_captureCall;
index 8df9960eb40dce9060d967f50773397213c64644..33ae85d99e3695818e9c360abea5f1979e57b5c9 100644 (file)
@@ -10,7 +10,7 @@
     <x>0</x>
     <y>0</y>
     <width>286</width>
-    <height>94</height>
+    <height>125</height>
    </rect>
   </property>
   <property name="windowTitle">
      </item>
     </layout>
    </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <spacer name="horizontalSpacer_5">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QCheckBox" name="singlethreadCB">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>Singlethread</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_6">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
    <item>
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
index 1cab792a2062beb7d9ca521c149fe80e0c9e6cb4..daba21f9e9489de3ae17dd635f24d4cb0b3db267 100644 (file)
@@ -261,7 +261,6 @@ getShaderResourceViewImage(ID3D10Device *pDevice,
         break;
     case D3D10_SRV_DIMENSION_TEXTURE2D:
         MipSlice = Desc.Texture2D.MostDetailedMip;
-        MipSlice = 0;
         break;
     case D3D10_SRV_DIMENSION_TEXTURE2DARRAY:
         MipSlice = Desc.Texture2DArray.MostDetailedMip;
@@ -367,7 +366,6 @@ getDepthStencilViewImage(ID3D10Device *pDevice,
         break;
     case D3D10_DSV_DIMENSION_TEXTURE2D:
         MipSlice = Desc.Texture2D.MipSlice;
-        MipSlice = 0;
         break;
     case D3D10_DSV_DIMENSION_TEXTURE2DARRAY:
         MipSlice = Desc.Texture2DArray.MipSlice;
index b0c753bca10b0b8f0668cad803f303939ce0c201..64169d41917c23aaa2c196c49124ad4a39b26008 100644 (file)
@@ -220,7 +220,6 @@ getShaderResourceViewImage(ID3D11DeviceContext *pDevice,
         break;
     case D3D11_SRV_DIMENSION_TEXTURE2D:
         MipSlice = Desc.Texture2D.MostDetailedMip;
-        MipSlice = 0;
         break;
     case D3D11_SRV_DIMENSION_TEXTURE2DARRAY:
         MipSlice = Desc.Texture2DArray.MostDetailedMip;
@@ -326,7 +325,6 @@ getDepthStencilViewImage(ID3D11DeviceContext *pDevice,
         break;
     case D3D11_DSV_DIMENSION_TEXTURE2D:
         MipSlice = Desc.Texture2D.MipSlice;
-        MipSlice = 0;
         break;
     case D3D11_DSV_DIMENSION_TEXTURE2DARRAY:
         MipSlice = Desc.Texture2DArray.MipSlice;
index 3361894c9257b9ce3ea7d855a29eadc2e9f593cc..0b1bf76a291aa0aef19857a51aa964ac5a701d91 100644 (file)
@@ -26,6 +26,8 @@
 
 #include <assert.h>
 
+#include <iostream>
+
 #include "image.hpp"
 
 #include "dxgistate.hpp"
@@ -218,7 +220,12 @@ ConvertFormat(DXGI_FORMAT SrcFormat,
         DirectX::ScratchImage ScratchImage;
         ScratchImage.Initialize2D(DstFormat, Width, Height, 1, 1);
 
-        hr = DirectX::Convert(SrcImage, DstFormat, DirectX::TEX_FILTER_DEFAULT, 0.0f, ScratchImage);
+        if (DirectX::IsCompressed(SrcFormat)) {
+            hr = DirectX::Decompress(SrcImage, DstFormat, ScratchImage);
+        } else {
+            hr = DirectX::Convert(SrcImage, DstFormat, DirectX::TEX_FILTER_DEFAULT, 0.0f, ScratchImage);
+        }
+
         if (SUCCEEDED(hr)) {
             hr = CopyRectangle(*ScratchImage.GetImage(0, 0, 0), rect, DstImage, DirectX::TEX_FILTER_DEFAULT, 0, 0);
         }
@@ -255,6 +262,7 @@ ConvertImage(DXGI_FORMAT SrcFormat,
                        image->start(), image->stride(),
                        Width, Height);
     if (FAILED(hr)) {
+        std::cerr << "warning: failed to convert from format " << SrcFormat << " to format " << DstFormat << "\n";
         delete image;
         image = NULL;
     }
index f0d0e2d7d5b29ff4ee0232d479fab8b408374de9..73bb250c4a4b58bf5b19d63337fa6bcadff58739 100644 (file)
@@ -127,7 +127,7 @@ getContext(unsigned long long ctx) {
 static void retrace_CGLChoosePixelFormat(trace::Call &call) {
     int profile = kCGLOGLPVersion_Legacy;
 
-    const trace::Array * attribs = dynamic_cast<const trace::Array *>(&call.arg(0));
+    const trace::Array * attribs = call.arg(0).toArray();
     if (attribs) {
         size_t i = 0;
         while (i < attribs->values.size()) {
@@ -201,7 +201,7 @@ static void retrace_CGLCreateContext(trace::Call &call) {
     unsigned long long share = call.arg(1).toUIntPtr();
     Context *sharedContext = getContext(share);
 
-    const trace::Array *ctx_ptr = dynamic_cast<const trace::Array *>(&call.arg(2));
+    const trace::Array *ctx_ptr = call.arg(2).toArray();
     unsigned long long ctx = ctx_ptr->values[0]->toUIntPtr();
 
     Context *context = glretrace::createContext(sharedContext);
index 27c5bb8e39531a8534f63542e76a2cfaa392e400..c03d04c2d4fc16743e6b71665c42de5f4d518bcd 100644 (file)
@@ -145,7 +145,7 @@ static void retrace_eglCreateContext(trace::Call &call) {
     unsigned long long orig_context = call.ret->toUIntPtr();
     unsigned long long orig_config = call.arg(1).toUIntPtr();
     Context *share_context = getContext(call.arg(2).toUIntPtr());
-    trace::Array *attrib_array = dynamic_cast<trace::Array *>(&call.arg(3));
+    trace::Array *attrib_array = call.arg(3).toArray();
     glws::Profile profile;
 
     switch (current_api) {
index fe88a59406ab285c0ace7327077bbbe4f929406e..3179c1ea7ff34d779635fdcb86d3b1c25dc58979 100644 (file)
@@ -133,7 +133,7 @@ static void retrace_glXCreateNewContext(trace::Call &call) {
 }
 
 static void retrace_glXCreatePbuffer(trace::Call &call) {
-    const trace::Value *attrib_list = dynamic_cast<const trace::Array *>(&call.arg(2));
+    const trace::Value *attrib_list = call.arg(2).toArray();
     int width = glretrace::parseAttrib(attrib_list, GLX_PBUFFER_WIDTH, 0);
     int height = glretrace::parseAttrib(attrib_list, GLX_PBUFFER_HEIGHT, 0);
 
index ab3c41af388009583be26f5190abf0a7f44d8ec1..d1e85f824d08815d4a511c06197725051e85062d 100644 (file)
@@ -233,7 +233,7 @@ updateDrawable(int width, int height) {
 
 int
 parseAttrib(const trace::Value *attribs, int param, int default_ = 0) {
-    const trace::Array *attribs_ = dynamic_cast<const trace::Array *>(attribs);
+    const trace::Array *attribs_ = attribs ? attribs->toArray() : NULL;
 
     if (attribs_) {
         for (size_t i = 0; i + 1 < attribs_->values.size(); i += 2) {
index 45d77eb940d903f5ff9add982e92dd781556cfa9..6efc0a677ba24c1e287d776b0a9378cab6c56e61 100644 (file)
@@ -392,23 +392,134 @@ getTexImageOES(GLenum target, GLint level, ImageDesc &desc, GLubyte *pixels)
 }
 
 
-static inline GLboolean
-isDepthFormat(GLenum internalFormat)
+struct InternalFormatDesc
 {
-   switch (internalFormat) {
-   case GL_DEPTH_COMPONENT:
-   case GL_DEPTH_COMPONENT16:
-   case GL_DEPTH_COMPONENT24:
-   case GL_DEPTH_COMPONENT32:
-   case GL_DEPTH_COMPONENT32F:
-   case GL_DEPTH_COMPONENT32F_NV:
-   case GL_DEPTH_STENCIL:
-   case GL_DEPTH24_STENCIL8:
-   case GL_DEPTH32F_STENCIL8:
-   case GL_DEPTH32F_STENCIL8_NV:
-      return GL_TRUE;
-   }
-   return GL_FALSE;
+    GLenum internalFormat;
+    GLenum format;
+};
+
+
+static const InternalFormatDesc
+internalFormatDescs[] = {
+
+    {1,        GL_RED},
+    {2,        GL_RG},
+    {3,        GL_RGB},
+    {4,        GL_RGBA},
+
+    {GL_RED,   GL_RED},
+    {GL_GREEN, GL_GREEN},
+    {GL_BLUE,  GL_BLUE},
+    {GL_ALPHA, GL_ALPHA},
+    {GL_RG,    GL_RG},
+    {GL_RGB,   GL_RGB},
+    {GL_BGR,   GL_RGB},
+    {GL_RGBA,  GL_RGBA},
+    {GL_BGRA,  GL_RGBA},
+    {GL_LUMINANCE,     GL_LUMINANCE},
+    {GL_LUMINANCE_ALPHA,       GL_LUMINANCE_ALPHA},
+    {GL_INTENSITY,     GL_INTENSITY},
+    {GL_RG8,   GL_RG},
+    {GL_RG16,  GL_RG},
+    {GL_RGB8,  GL_RGB},
+    {GL_RGB16, GL_RGB},
+    {GL_RGBA8, GL_RGBA},
+    {GL_RGBA16,        GL_RGBA},
+    {GL_RGB10_A2,      GL_RGBA},
+    {GL_LUMINANCE8,    GL_LUMINANCE},
+    {GL_LUMINANCE16,   GL_LUMINANCE},
+    {GL_ALPHA8,        GL_ALPHA},
+    {GL_ALPHA16,       GL_ALPHA},
+    {GL_LUMINANCE8_ALPHA8,     GL_LUMINANCE_ALPHA},
+    {GL_LUMINANCE16_ALPHA16,   GL_LUMINANCE_ALPHA},
+    {GL_INTENSITY8,    GL_INTENSITY},
+    {GL_INTENSITY16,   GL_INTENSITY},
+    
+    {GL_RED_INTEGER,   GL_RED_INTEGER},
+    {GL_GREEN_INTEGER, GL_GREEN_INTEGER},
+    {GL_BLUE_INTEGER,  GL_BLUE_INTEGER},
+    {GL_ALPHA_INTEGER, GL_ALPHA_INTEGER},
+    {GL_RG_INTEGER,    GL_RG_INTEGER},
+    {GL_RGB_INTEGER,   GL_RGB_INTEGER},
+    {GL_BGR_INTEGER,   GL_RGB_INTEGER},
+    {GL_RGBA_INTEGER,  GL_RGBA_INTEGER},
+    {GL_BGRA_INTEGER,  GL_RGBA_INTEGER},
+    {GL_LUMINANCE_INTEGER_EXT, GL_LUMINANCE_INTEGER_EXT},
+    {GL_LUMINANCE_ALPHA_INTEGER_EXT,   GL_LUMINANCE_ALPHA_INTEGER_EXT},
+    {GL_R8I,   GL_RED_INTEGER},
+    {GL_R8UI,  GL_RED_INTEGER},
+    {GL_R16I,  GL_RED_INTEGER},
+    {GL_R16UI, GL_RED_INTEGER},
+    {GL_R32I,  GL_RED_INTEGER},
+    {GL_R32UI, GL_RED_INTEGER},
+    {GL_RG8I,  GL_RG_INTEGER},
+    {GL_RG8UI, GL_RG_INTEGER},
+    {GL_RG16I, GL_RG_INTEGER},
+    {GL_RG16UI,        GL_RG_INTEGER},
+    {GL_RG32I, GL_RG_INTEGER},
+    {GL_RG32UI,        GL_RG_INTEGER},
+    {GL_RGB8I, GL_RGB_INTEGER},
+    {GL_RGB8UI,        GL_RGB_INTEGER},
+    {GL_RGB16I,        GL_RGB_INTEGER},
+    {GL_RGB16UI,       GL_RGB_INTEGER},
+    {GL_RGB32I,        GL_RGB_INTEGER},
+    {GL_RGB32UI,       GL_RGB_INTEGER},
+    {GL_RGBA8I,        GL_RGBA_INTEGER},
+    {GL_RGBA8UI,       GL_RGBA_INTEGER},
+    {GL_RGBA16I,       GL_RGBA_INTEGER},
+    {GL_RGBA16UI,      GL_RGBA_INTEGER},
+    {GL_RGBA32I,       GL_RGBA_INTEGER},
+    {GL_RGBA32UI,      GL_RGBA_INTEGER},
+    {GL_RGB10_A2UI,    GL_RGBA_INTEGER},
+    {GL_LUMINANCE8I_EXT,       GL_LUMINANCE_INTEGER_EXT},
+    {GL_LUMINANCE8UI_EXT,      GL_LUMINANCE_INTEGER_EXT},
+    {GL_LUMINANCE16I_EXT,      GL_LUMINANCE_INTEGER_EXT},
+    {GL_LUMINANCE16UI_EXT,     GL_LUMINANCE_INTEGER_EXT},
+    {GL_LUMINANCE32I_EXT,      GL_LUMINANCE_INTEGER_EXT},
+    {GL_LUMINANCE32UI_EXT,     GL_LUMINANCE_INTEGER_EXT},
+    {GL_ALPHA8I_EXT,   GL_ALPHA_INTEGER_EXT},
+    {GL_ALPHA8UI_EXT,  GL_ALPHA_INTEGER_EXT},
+    {GL_ALPHA16I_EXT,  GL_ALPHA_INTEGER_EXT},
+    {GL_ALPHA16UI_EXT, GL_ALPHA_INTEGER_EXT},
+    {GL_ALPHA32I_EXT,  GL_ALPHA_INTEGER_EXT},
+    {GL_ALPHA32UI_EXT, GL_ALPHA_INTEGER_EXT},
+    {GL_LUMINANCE_ALPHA8I_EXT, GL_LUMINANCE_ALPHA_INTEGER_EXT},
+    {GL_LUMINANCE_ALPHA8UI_EXT,        GL_LUMINANCE_ALPHA_INTEGER_EXT},
+    {GL_LUMINANCE_ALPHA16I_EXT,        GL_LUMINANCE_ALPHA_INTEGER_EXT},
+    {GL_LUMINANCE_ALPHA16UI_EXT,       GL_LUMINANCE_ALPHA_INTEGER_EXT},
+    {GL_LUMINANCE_ALPHA32I_EXT,        GL_LUMINANCE_ALPHA_INTEGER_EXT},
+    {GL_LUMINANCE_ALPHA32UI_EXT,       GL_LUMINANCE_ALPHA_INTEGER_EXT},
+    {GL_INTENSITY8I_EXT,       GL_RED_INTEGER},
+    {GL_INTENSITY8UI_EXT,      GL_RED_INTEGER},
+    {GL_INTENSITY16I_EXT,      GL_RED_INTEGER},
+    {GL_INTENSITY16UI_EXT,     GL_RED_INTEGER},
+    {GL_INTENSITY32I_EXT,      GL_RED_INTEGER},
+    {GL_INTENSITY32UI_EXT,     GL_RED_INTEGER},
+    
+    {GL_DEPTH_COMPONENT,       GL_DEPTH_COMPONENT},
+    {GL_DEPTH_COMPONENT16,     GL_DEPTH_COMPONENT},
+    {GL_DEPTH_COMPONENT24,     GL_DEPTH_COMPONENT},
+    {GL_DEPTH_COMPONENT32,     GL_DEPTH_COMPONENT},
+    {GL_DEPTH_COMPONENT32F,    GL_DEPTH_COMPONENT},
+    {GL_DEPTH_COMPONENT32F_NV, GL_DEPTH_COMPONENT},
+    {GL_DEPTH_STENCIL,         GL_DEPTH_COMPONENT},
+    {GL_DEPTH24_STENCIL8,      GL_DEPTH_COMPONENT},
+    {GL_DEPTH32F_STENCIL8,     GL_DEPTH_COMPONENT},
+    {GL_DEPTH32F_STENCIL8_NV,  GL_DEPTH_COMPONENT},
+};
+
+
+static GLenum
+getFormat(GLenum internalFormat)
+{
+    for (unsigned i = 0; i < sizeof internalFormatDescs / sizeof internalFormatDescs[0]; ++i) {
+        if (internalFormatDescs[i].internalFormat == internalFormat) {
+            return internalFormatDescs[i].format;
+        }
+    }
+    return GL_RGBA;
 }
 
 
@@ -428,15 +539,11 @@ dumpActiveTextureLevel(JSONWriter &json, Context &context, GLenum target, GLint
 
     json.beginMember(label);
 
-    GLuint channels;
-    GLenum format;
-    if (!context.ES && isDepthFormat(desc.internalFormat)) {
-       format = GL_DEPTH_COMPONENT;
-       channels = 1;
-    } else {
-       format = GL_RGBA;
-       channels = 4;
+    GLenum format = getFormat(desc.internalFormat);;
+    if (context.ES && format == GL_DEPTH_COMPONENT) {
+        format = GL_RED;
     }
+    GLuint channels = _gl_format_channels(format);;
 
     image::Image *image = new image::Image(desc.width, desc.height*desc.depth, channels, true);
 
index f37f2494d7ca05b2acc27eb03791bdbecbcc6e5a..6e6bf131c6dc82eed5710db6df6b5e8fb0328633 100644 (file)
@@ -63,11 +63,11 @@ public:
      */
     inline void *
     alloc(const trace::Value *value, size_t size) {
-        const trace::Array *array = dynamic_cast<const trace::Array *>(value);
+        const trace::Array *array = value->toArray();
         if (array) {
             return ::ScopedAllocator::alloc(array->size() * size);
         }
-        const trace::Null *null = dynamic_cast<const trace::Null *>(value);
+        const trace::Null *null = value->toNull();
         if (null) {
             return NULL;
         }
index 25fa62a51f4644c7141b9a664c359d9d81ddbed1..1cdb092efcfc7b9f3d0610e3a8e0ef2abaa1b2bc 100644 (file)
@@ -129,7 +129,7 @@ class ValueDeserializer(stdapi.Visitor, stdapi.ExpanderMixin):
         self.seq += 1
 
         print '    if (%s) {' % (lvalue,)
-        print '        const trace::Array *%s = dynamic_cast<const trace::Array *>(&%s);' % (tmp, rvalue)
+        print '        const trace::Array *%s = (%s).toArray();' % (tmp, rvalue)
         length = '%s->values.size()' % (tmp,)
         index = '_j' + array.tag
         print '        for (size_t {i} = 0; {i} < {length}; ++{i}) {{'.format(i = index, length = length)
@@ -144,7 +144,7 @@ class ValueDeserializer(stdapi.Visitor, stdapi.ExpanderMixin):
         self.seq += 1
 
         print '    if (%s) {' % (lvalue,)
-        print '        const trace::Array *%s = dynamic_cast<const trace::Array *>(&%s);' % (tmp, rvalue)
+        print '        const trace::Array *%s = (%s).toArray();' % (tmp, rvalue)
         try:
             self.visit(pointer.type, '%s[0]' % (lvalue,), '*%s->values[0]' % (tmp,))
         finally:
@@ -190,7 +190,7 @@ class ValueDeserializer(stdapi.Visitor, stdapi.ExpanderMixin):
         tmp = '_s_' + struct.tag + '_' + str(self.seq)
         self.seq += 1
 
-        print '    const trace::Struct *%s = dynamic_cast<const trace::Struct *>(&%s);' % (tmp, rvalue)
+        print '    const trace::Struct *%s = (%s).toStruct();' % (tmp, rvalue)
         print '    assert(%s);' % (tmp)
         for i in range(len(struct.members)):
             member = struct.members[i]
@@ -251,7 +251,7 @@ class SwizzledValueRegistrator(stdapi.Visitor, stdapi.ExpanderMixin):
         pass
 
     def visitArray(self, array, lvalue, rvalue):
-        print '    const trace::Array *_a%s = dynamic_cast<const trace::Array *>(&%s);' % (array.tag, rvalue)
+        print '    const trace::Array *_a%s = (%s).toArray();' % (array.tag, rvalue)
         print '    if (_a%s) {' % (array.tag)
         length = '_a%s->values.size()' % array.tag
         index = '_j' + array.tag
@@ -263,7 +263,7 @@ class SwizzledValueRegistrator(stdapi.Visitor, stdapi.ExpanderMixin):
             print '    }'
     
     def visitPointer(self, pointer, lvalue, rvalue):
-        print '    const trace::Array *_a%s = dynamic_cast<const trace::Array *>(&%s);' % (pointer.tag, rvalue)
+        print '    const trace::Array *_a%s = (%s).toArray();' % (pointer.tag, rvalue)
         print '    if (_a%s) {' % (pointer.tag)
         try:
             self.visit(pointer.type, '%s[0]' % (lvalue,), '*_a%s->values[0]' % (pointer.tag,))
@@ -325,7 +325,7 @@ class SwizzledValueRegistrator(stdapi.Visitor, stdapi.ExpanderMixin):
         tmp = '_s_' + struct.tag + '_' + str(self.seq)
         self.seq += 1
 
-        print '    const trace::Struct *%s = dynamic_cast<const trace::Struct *>(&%s);' % (tmp, rvalue)
+        print '    const trace::Struct *%s = (%s).toStruct();' % (tmp, rvalue)
         print '    assert(%s);' % (tmp,)
         print '    (void)%s;' % (tmp,)
         for i in range(len(struct.members)):
index 07ff361cd3c41fada80a7222660550ad791a435b..134071183e32364ba9a35c26cab322c035b294d9 100644 (file)
@@ -48,6 +48,8 @@ GLXWindow = Alias("GLXWindow", UInt32)
 GLXPbuffer = Alias("GLXPbuffer", UInt32)
 GLXPbufferSGIX = Alias("GLXPbufferSGIX", UInt32)
 GLXVideoSourceSGIX = Alias("GLXVideoSourceSGIX", UInt32)
+GLXVideoDeviceNV = Alias("GLXVideoDeviceNV", UInt32)
+GLXVideoCaptureDeviceNV = Alias("GLXVideoCaptureDeviceNV", UInt32)
 
 XVisualInfo = Struct("XVisualInfo", [
   (Visual, "visual"),
@@ -459,16 +461,16 @@ glxapi.addFunctions([
     Function(Void, "glXReleaseTexImageEXT", [(Display, "display"), (GLXDrawable, "drawable"), (GLXEnum, "buffer")]),
 
     # GLX_NV_present_video
-    #Function(OpaquePointer(UInt), "glXEnumerateVideoDevicesNV", [(Display, "dpy"), (Int, "screen"), (OpaquePointer(Int), "nelements")]),
-    #Function(Int, "glXBindVideoDeviceNV", [(Display, "dpy"), (UInt, "video_slot"), (UInt, "video_device"), (UnusedAttribs, "attrib_list")]),
+    Function(Array(UInt, "(nelements ? *nelements : 0)"), "glXEnumerateVideoDevicesNV", [(Display, "dpy"), (Int, "screen"), Out(Pointer(Int), "nelements")]),
+    Function(Int, "glXBindVideoDeviceNV", [(Display, "dpy"), (UInt, "video_slot"), (UInt, "video_device"), (UnusedAttribs, "attrib_list")]),
 
     # GLX_NV_video_output
-    #Function(Int, "glXGetVideoDeviceNV", [(Display, "dpy"), (Int, "screen"), (Int, "numVideoDevices"), (OpaquePointer(GLXVideoDeviceNV), "pVideoDevice")]),
-    #Function(Int, "glXReleaseVideoDeviceNV", [(Display, "dpy"), (Int, "screen"), (GLXVideoDeviceNV, "VideoDevice")]),
-    #Function(Int, "glXBindVideoImageNV", [(Display, "dpy"), (GLXVideoDeviceNV, "VideoDevice"), (GLXPbuffer, "pbuf"), (Int, "iVideoBuffer")]),
-    #Function(Int, "glXReleaseVideoImageNV", [(Display, "dpy"), (GLXPbuffer, "pbuf")]),
-    #Function(Int, "glXSendPbufferToVideoNV", [(Display, "dpy"), (GLXPbuffer, "pbuf"), (Int, "iBufferType"), (OpaquePointer(ULong), "pulCounterPbuffer"), (GLboolean, "bBlock")]),
-    #Function(Int, "glXGetVideoInfoNV", [(Display, "dpy"), (Int, "screen"), (GLXVideoDeviceNV, "VideoDevice"), (OpaquePointer(ULong), "pulCounterOutputPbuffer"), (OpaquePointer(ULong), "pulCounterOutputVideo")]),
+    Function(Int, "glXGetVideoDeviceNV", [(Display, "dpy"), (Int, "screen"), (Int, "numVideoDevices"), Out(Array(GLXVideoDeviceNV, "numVideoDevices"), "pVideoDevice")]),
+    Function(Int, "glXReleaseVideoDeviceNV", [(Display, "dpy"), (Int, "screen"), (GLXVideoDeviceNV, "VideoDevice")]),
+    Function(Int, "glXBindVideoImageNV", [(Display, "dpy"), (GLXVideoDeviceNV, "VideoDevice"), (GLXPbuffer, "pbuf"), (Int, "iVideoBuffer")]),
+    Function(Int, "glXReleaseVideoImageNV", [(Display, "dpy"), (GLXPbuffer, "pbuf")]),
+    Function(Int, "glXSendPbufferToVideoNV", [(Display, "dpy"), (GLXPbuffer, "pbuf"), (Int, "iBufferType"), Out(Pointer(ULong), "pulCounterPbuffer"), (GLboolean, "bBlock")]),
+    Function(Int, "glXGetVideoInfoNV", [(Display, "dpy"), (Int, "screen"), (GLXVideoDeviceNV, "VideoDevice"), Out(Pointer(ULong), "pulCounterOutputPbuffer"), Out(Pointer(ULong), "pulCounterOutputVideo")], sideeffects=False),
 
     # GLX_NV_swap_group
     Function(Bool, "glXJoinSwapGroupNV", [(Display, "dpy"), (GLXDrawable, "drawable"), (GLuint, "group")]),
@@ -479,11 +481,11 @@ glxapi.addFunctions([
     Function(Bool, "glXResetFrameCountNV", [(Display, "dpy"), (Int, "screen")]),
 
     # GLX_NV_video_capture
-    #Function(Int, "glXBindVideoCaptureDeviceNV", [(Display, "dpy"), (UInt, "video_capture_slot"), (GLXVideoCaptureDeviceNV, "device")]),
-    #Function(OpaquePointer(GLXVideoCaptureDeviceNV), "glXEnumerateVideoCaptureDevicesNV", [(Display, "dpy"), (Int, "screen"), (OpaquePointer(Int), "nelements")]),
-    #Function(Void, "glXLockVideoCaptureDeviceNV", [(Display, "dpy"), (GLXVideoCaptureDeviceNV, "device")]),
-    #Function(Int, "glXQueryVideoCaptureDeviceNV", [(Display, "dpy"), (GLXVideoCaptureDeviceNV, "device"), (Int, "attribute"), (OpaquePointer(Int), "value")]),
-    #Function(Void, "glXReleaseVideoCaptureDeviceNV", [(Display, "dpy"), (GLXVideoCaptureDeviceNV, "device")]),
+    Function(Int, "glXBindVideoCaptureDeviceNV", [(Display, "dpy"), (UInt, "video_capture_slot"), (GLXVideoCaptureDeviceNV, "device")]),
+    Function(Array(GLXVideoCaptureDeviceNV, "(nelements ? *nelements : 0)"), "glXEnumerateVideoCaptureDevicesNV", [(Display, "dpy"), (Int, "screen"), Out(Pointer(Int), "nelements")]),
+    Function(Void, "glXLockVideoCaptureDeviceNV", [(Display, "dpy"), (GLXVideoCaptureDeviceNV, "device")]),
+    Function(Int, "glXQueryVideoCaptureDeviceNV", [(Display, "dpy"), (GLXVideoCaptureDeviceNV, "device"), (Int, "attribute"), Out(Pointer(Int), "value")], sideeffects=False),
+    Function(Void, "glXReleaseVideoCaptureDeviceNV", [(Display, "dpy"), (GLXVideoCaptureDeviceNV, "device")]),
 
     # GLX_EXT_swap_control
     Function(Void, "glXSwapIntervalEXT", [(Display, "dpy"), (GLXDrawable, "drawable"), (Int, "interval")]),
index 2ee25cc5016181aadcd631fa291ecd44609af0c9..ae2e07849c757b2f3542a78a6cfd189459baaa6d 100644 (file)
@@ -244,6 +244,19 @@ WGLSetPbufferARBAttribs = AttribArray(WGLenum, [
 ])
 
 HPBUFFERARB = Alias("HPBUFFERARB", HANDLE)
+HPBUFFEREXT = Alias("HPBUFFEREXT", HANDLE)
+HPVIDEODEV = Alias("HPVIDEODEV", HANDLE)
+HVIDEOOUTPUTDEVICENV = Alias("HVIDEOOUTPUTDEVICENV", HANDLE)
+HVIDEOINPUTDEVICENV = Alias("HVIDEOINPUTDEVICENV", HANDLE)
+HGPUNV = Alias("HGPUNV", HANDLE)
+
+GPU_DEVICE = Struct("GPU_DEVICE", [
+    (DWORD, "cb"),
+    (CString, "DeviceName"),
+    (CString, "DeviceString"),
+    (DWORD, "Flags"),
+    (RECT, "rcVirtualScreen"),
+])
 
 
 wglapi.addFunctions([
@@ -306,6 +319,12 @@ wglapi.addFunctions([
     # WGL_ARB_create_context
     StdFunction(HGLRC, "wglCreateContextAttribsARB", [(HDC, "hDC"), (HGLRC, "hShareContext"), (WGLContextAttribs, "attribList")]),
 
+    # WGL_EXT_display_color_table
+    StdFunction(GLboolean, "wglCreateDisplayColorTableEXT", [(GLushort, "id")]),
+    StdFunction(GLboolean, "wglLoadDisplayColorTableEXT", [(Array(Const(GLushort), "length"), "table"), (GLuint, "length")]),
+    StdFunction(GLboolean, "wglBindDisplayColorTableEXT", [(GLushort, "id")]),
+    StdFunction(VOID, "wglDestroyDisplayColorTableEXT", [(GLushort, "id")]),
+
     # WGL_EXT_extensions_string
     StdFunction(ConstCString, "wglGetExtensionsStringEXT", [], sideeffects=False),
 
@@ -313,6 +332,13 @@ wglapi.addFunctions([
     StdFunction(BOOL, "wglMakeContextCurrentEXT", [(HDC, "hDrawDC"), (HDC, "hReadDC"), (HGLRC, "hglrc")]),
     StdFunction(HDC, "wglGetCurrentReadDCEXT", [], sideeffects=False),
 
+    # WGL_EXT_pbuffer
+    StdFunction(HPBUFFEREXT, "wglCreatePbufferEXT", [(HDC, "hDC"), (Int, "iPixelFormat"), (Int, "iWidth"), (Int, "iHeight"), (WGLCreatePbufferARBAttribs, "piAttribList")]),
+    StdFunction(HDC, "wglGetPbufferDCEXT", [(HPBUFFEREXT, "hPbuffer")], sideeffects=False),
+    StdFunction(Int, "wglReleasePbufferDCEXT", [(HPBUFFEREXT, "hPbuffer"), (HDC, "hDC")]),
+    StdFunction(BOOL, "wglDestroyPbufferEXT", [(HPBUFFEREXT, "hPbuffer")]),
+    StdFunction(BOOL, "wglQueryPbufferEXT", [(HPBUFFEREXT, "hPbuffer"), (WGLenum, "iAttribute"), Out(Pointer(Int), "piValue")], sideeffects=False),
+
     # WGL_EXT_pixel_format
     StdFunction(BOOL, "wglGetPixelFormatAttribivEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(Int, "nAttributes"), "piValues")], sideeffects=False),
     StdFunction(BOOL, "wglGetPixelFormatAttribfvEXT", [(HDC, "hdc"), (Int, "iPixelFormat"), (Int, "iLayerPlane"), (UINT, "nAttributes"), (Array(WGLenum, "nAttributes"), "piAttributes"), Out(Array(FLOAT, "nAttributes"), "pfValues")], sideeffects=False),
@@ -326,6 +352,118 @@ wglapi.addFunctions([
     StdFunction(OpaquePointer(Void), "wglAllocateMemoryNV", [(GLsizei, "size"), (GLfloat, "readfreq"), (GLfloat, "writefreq"), (GLfloat, "priority")]),
     StdFunction(Void, "wglFreeMemoryNV", [(OpaquePointer(Void), "pointer")]),
 
+    # WGL_OML_sync_control
+    StdFunction(BOOL, "wglGetSyncValuesOML", [(HDC, "hdc"), Out(Pointer(INT64), "ust"), Out(Pointer(INT64), "msc"), Out(Pointer(INT64), "sbc")], sideeffects=False),
+    StdFunction(BOOL, "wglGetMscRateOML", [(HDC, "hdc"), Out(Pointer(INT32), "numerator"), Out(Pointer(INT32), "denominator")], sideeffects=False),
+    StdFunction(INT64, "wglSwapBuffersMscOML", [(HDC, "hdc"), (INT64, "target_msc"), (INT64, "divisor"), (INT64, "remainder")]),
+    StdFunction(INT64, "wglSwapLayerBuffersMscOML", [(HDC, "hdc"), (Int, "fuPlanes"), (INT64, "target_msc"), (INT64, "divisor"), (INT64, "remainder")]),
+    StdFunction(BOOL, "wglWaitForMscOML", [(HDC, "hdc"), (INT64, "target_msc"), (INT64, "divisor"), (INT64, "remainder"), Out(Pointer(INT64), "ust"), Out(Pointer(INT64), "msc"), Out(Pointer(INT64), "sbc")]),
+    StdFunction(BOOL, "wglWaitForSbcOML", [(HDC, "hdc"), (INT64, "target_sbc"), Out(Pointer(INT64), "ust"), Out(Pointer(INT64), "msc"), Out(Pointer(INT64), "sbc")]),
+
+    # WGL_I3D_digital_video_control
+    StdFunction(BOOL, "wglGetDigitalVideoParametersI3D", [(HDC, "hDC"), (Int, "iAttribute"), Out(OpaqueArray(Int, "_wglGetDigitalVideoParametersI3D_size(iAttribute)"), "piValue")], sideeffects=False),
+    StdFunction(BOOL, "wglSetDigitalVideoParametersI3D", [(HDC, "hDC"), (Int, "iAttribute"), (OpaqueArray(Const(Int), "_wglSetDigitalVideoParametersI3D_size(iAttribute)"), "piValue")]),
+
+    # WGL_I3D_gamma
+    StdFunction(BOOL, "wglGetGammaTableParametersI3D", [(HDC, "hDC"), (Int, "iAttribute"), Out(OpaqueArray(Int, "_wglGetGammaTableParametersI3D_size(iAttribute)"), "piValue")], sideeffects=False),
+    StdFunction(BOOL, "wglSetGammaTableParametersI3D", [(HDC, "hDC"), (Int, "iAttribute"), (OpaqueArray(Const(Int), "_wglSetGammaTableParametersI3D_size(iAttribute)"), "piValue")]),
+    StdFunction(BOOL, "wglGetGammaTableI3D", [(HDC, "hDC"), (Int, "iEntries"), Out(Array(USHORT, "iEntries"), "puRed"), Out(Array(USHORT, "iEntries"), "puGreen"), Out(Array(USHORT, "iEntries"), "puBlue")], sideeffects=False),
+    StdFunction(BOOL, "wglSetGammaTableI3D", [(HDC, "hDC"), (Int, "iEntries"), (Array(Const(USHORT), "iEntries"), "puRed"), (Array(Const(USHORT), "iEntries"), "puGreen"), (Array(Const(USHORT), "iEntries"), "puBlue")]),
+
+    # WGL_I3D_genlock
+    StdFunction(BOOL, "wglEnableGenlockI3D", [(HDC, "hDC")]),
+    StdFunction(BOOL, "wglDisableGenlockI3D", [(HDC, "hDC")]),
+    StdFunction(BOOL, "wglIsEnabledGenlockI3D", [(HDC, "hDC"), Out(Pointer(BOOL), "pFlag")], sideeffects=False),
+    StdFunction(BOOL, "wglGenlockSourceI3D", [(HDC, "hDC"), (UINT, "uSource")]),
+    StdFunction(BOOL, "wglGetGenlockSourceI3D", [(HDC, "hDC"), Out(Pointer(UINT), "uSource")], sideeffects=False),
+    StdFunction(BOOL, "wglGenlockSourceEdgeI3D", [(HDC, "hDC"), (UINT, "uEdge")]),
+    StdFunction(BOOL, "wglGetGenlockSourceEdgeI3D", [(HDC, "hDC"), Out(Pointer(UINT), "uEdge")], sideeffects=False),
+    StdFunction(BOOL, "wglGenlockSampleRateI3D", [(HDC, "hDC"), (UINT, "uRate")]),
+    StdFunction(BOOL, "wglGetGenlockSampleRateI3D", [(HDC, "hDC"), Out(Pointer(UINT), "uRate")], sideeffects=False),
+    StdFunction(BOOL, "wglGenlockSourceDelayI3D", [(HDC, "hDC"), (UINT, "uDelay")]),
+    StdFunction(BOOL, "wglGetGenlockSourceDelayI3D", [(HDC, "hDC"), Out(Pointer(UINT), "uDelay")], sideeffects=False),
+    StdFunction(BOOL, "wglQueryGenlockMaxSourceDelayI3D", [(HDC, "hDC"), Out(Pointer(UINT), "uMaxLineDelay"), Out(Pointer(UINT), "uMaxPixelDelay")]),
+
+    # WGL_I3D_image_buffer
+    StdFunction(LPVOID, "wglCreateImageBufferI3D", [(HDC, "hDC"), (DWORD, "dwSize"), (UINT, "uFlags")]),
+    StdFunction(BOOL, "wglDestroyImageBufferI3D", [(HDC, "hDC"), (LPVOID, "pAddress")]),
+    StdFunction(BOOL, "wglAssociateImageBufferEventsI3D", [(HDC, "hDC"), (Array(Const(HANDLE), "count"), "pEvent"), (Array(Const(LPVOID), "count"), "pAddress"), (Array(Const(DWORD), "count"), "pSize"), (UINT, "count")]),
+    StdFunction(BOOL, "wglReleaseImageBufferEventsI3D", [(HDC, "hDC"), (Array(Const(LPVOID), "count"), "pAddress"), (UINT, "count")]),
+
+    # WGL_I3D_swap_frame_lock
+    StdFunction(BOOL, "wglEnableFrameLockI3D", []),
+    StdFunction(BOOL, "wglDisableFrameLockI3D", []),
+    StdFunction(BOOL, "wglIsEnabledFrameLockI3D", [Out(Pointer(BOOL), "pFlag")], sideeffects=False),
+    StdFunction(BOOL, "wglQueryFrameLockMasterI3D", [Out(Pointer(BOOL), "pFlag")]),
+
+    # WGL_I3D_swap_frame_usage
+    StdFunction(BOOL, "wglGetFrameUsageI3D", [Out(Pointer(Float), "pUsage")], sideeffects=False),
+    StdFunction(BOOL, "wglBeginFrameTrackingI3D", []),
+    StdFunction(BOOL, "wglEndFrameTrackingI3D", []),
+    StdFunction(BOOL, "wglQueryFrameTrackingI3D", [Out(Pointer(DWORD), "pFrameCount"), Out(Pointer(DWORD), "pMissedFrames"), Out(Pointer(Float), "pLastMissedUsage")]),
+
+    # WGL_3DL_stereo_control
+    StdFunction(BOOL, "wglSetStereoEmitterState3DL", [(HDC, "hDC"), (UINT, "uState")]),
+
+    # WGL_NV_present_video
+    StdFunction(Int, "wglEnumerateVideoDevicesNV", [(HDC, "hDC"), Out(OpaquePointer(HVIDEOOUTPUTDEVICENV), "phDeviceList")]),
+    StdFunction(BOOL, "wglBindVideoDeviceNV", [(HDC, "hDC"), (UInt, "uVideoSlot"), (HVIDEOOUTPUTDEVICENV, "hVideoDevice"), (OpaqueArray(Const(Int), "_wglBindVideoDeviceNV_size()"), "piAttribList")]),
+    StdFunction(BOOL, "wglQueryCurrentContextNV", [(Int, "iAttribute"), Out(OpaqueArray(Int, "_wglQueryCurrentContextNV_size()"), "piValue")]),
+
+    # WGL_NV_video_output
+    StdFunction(BOOL, "wglGetVideoDeviceNV", [(HDC, "hDC"), (Int, "numDevices"), Out(Pointer(HPVIDEODEV), "hVideoDevice")], sideeffects=False),
+    StdFunction(BOOL, "wglReleaseVideoDeviceNV", [(HPVIDEODEV, "hVideoDevice")]),
+    StdFunction(BOOL, "wglBindVideoImageNV", [(HPVIDEODEV, "hVideoDevice"), (HPBUFFERARB, "hPbuffer"), (Int, "iVideoBuffer")]),
+    StdFunction(BOOL, "wglReleaseVideoImageNV", [(HPBUFFERARB, "hPbuffer"), (Int, "iVideoBuffer")]),
+    StdFunction(BOOL, "wglSendPbufferToVideoNV", [(HPBUFFERARB, "hPbuffer"), (Int, "iBufferType"), Out(Pointer(ULong), "pulCounterPbuffer"), (BOOL, "bBlock")]),
+    StdFunction(BOOL, "wglGetVideoInfoNV", [(HPVIDEODEV, "hpVideoDevice"), Out(Pointer(ULong), "pulCounterOutputPbuffer"), Out(Pointer(ULong), "pulCounterOutputVideo")], sideeffects=False),
+
+    # WGL_NV_swap_group
+    StdFunction(BOOL, "wglJoinSwapGroupNV", [(HDC, "hDC"), (GLuint, "group")]),
+    StdFunction(BOOL, "wglBindSwapBarrierNV", [(GLuint, "group"), (GLuint, "barrier")]),
+    StdFunction(BOOL, "wglQuerySwapGroupNV", [(HDC, "hDC"), Out(Pointer(GLuint), "group"), Out(Pointer(GLuint), "barrier")]),
+    StdFunction(BOOL, "wglQueryMaxSwapGroupsNV", [(HDC, "hDC"), Out(Pointer(GLuint), "maxGroups"), Out(Pointer(GLuint), "maxBarriers")]),
+    StdFunction(BOOL, "wglQueryFrameCountNV", [(HDC, "hDC"), Out(Pointer(GLuint), "count")]),
+    StdFunction(BOOL, "wglResetFrameCountNV", [(HDC, "hDC")]),
+
+    # WGL_NV_gpu_affinity
+    StdFunction(BOOL, "wglEnumGpusNV", [(UINT, "iGpuIndex"), Out(Pointer(HGPUNV), "phGpu")]),
+    StdFunction(BOOL, "wglEnumGpuDevicesNV", [(HGPUNV, "hGpu"), (UINT, "iDeviceIndex"), Out(Pointer(GPU_DEVICE), "lpGpuDevice")]),
+    StdFunction(HDC, "wglCreateAffinityDCNV", [(OpaqueArray(Const(HGPUNV), "_wglCreateAffinityDCNV_size()"), "phGpuList")]),
+    StdFunction(BOOL, "wglEnumGpusFromAffinityDCNV", [(HDC, "hAffinityDC"), (UINT, "iGpuIndex"), Out(Pointer(HGPUNV), "hGpu")]),
+    StdFunction(BOOL, "wglDeleteDCNV", [(HDC, "hdc")]),
+
+    # WGL_AMD_gpu_association
+    StdFunction(UINT, "wglGetGPUIDsAMD", [(UINT, "maxCount"), Out(Array(UINT, "maxCount"), "ids")], sideeffects=False),
+    StdFunction(INT, "wglGetGPUInfoAMD", [(UINT, "id"), (Int, "property"), (GLenum, "dataType"), (UINT, "size"), Out(OpaqueBlob(Void, "_wglGetGPUInfoAMD_size(dataType,size)"), "data")], sideeffects=False),
+    StdFunction(UINT, "wglGetContextGPUIDAMD", [(HGLRC, "hglrc")], sideeffects=False),
+    StdFunction(HGLRC, "wglCreateAssociatedContextAMD", [(UINT, "id")]),
+    StdFunction(HGLRC, "wglCreateAssociatedContextAttribsAMD", [(UINT, "id"), (HGLRC, "hShareContext"), (OpaqueArray(Const(Int), "_wglCreateAssociatedContextAttribsAMD_size()"), "attribList")]),
+    StdFunction(BOOL, "wglDeleteAssociatedContextAMD", [(HGLRC, "hglrc")]),
+    StdFunction(BOOL, "wglMakeAssociatedContextCurrentAMD", [(HGLRC, "hglrc")]),
+    StdFunction(HGLRC, "wglGetCurrentAssociatedContextAMD", [], sideeffects=False),
+    StdFunction(VOID, "wglBlitContextFramebufferAMD", [(HGLRC, "dstCtx"), (GLint, "srcX0"), (GLint, "srcY0"), (GLint, "srcX1"), (GLint, "srcY1"), (GLint, "dstX0"), (GLint, "dstY0"), (GLint, "dstX1"), (GLint, "dstY1"), (GLbitfield, "mask"), (GLenum, "filter")]),
+
+    # WGL_NV_video_capture
+    StdFunction(BOOL, "wglBindVideoCaptureDeviceNV", [(UINT, "uVideoSlot"), (HVIDEOINPUTDEVICENV, "hDevice")]),
+    StdFunction(UINT, "wglEnumerateVideoCaptureDevicesNV", [(HDC, "hDc"), Out(Pointer(HVIDEOINPUTDEVICENV), "phDeviceList")]),
+    StdFunction(BOOL, "wglLockVideoCaptureDeviceNV", [(HDC, "hDc"), (HVIDEOINPUTDEVICENV, "hDevice")]),
+    StdFunction(BOOL, "wglQueryVideoCaptureDeviceNV", [(HDC, "hDc"), (HVIDEOINPUTDEVICENV, "hDevice"), (Int, "iAttribute"), Out(Pointer(Int), "piValue")]),
+    StdFunction(BOOL, "wglReleaseVideoCaptureDeviceNV", [(HDC, "hDc"), (HVIDEOINPUTDEVICENV, "hDevice")]),
+
+    # WGL_NV_copy_image
+    StdFunction(BOOL, "wglCopyImageSubDataNV", [(HGLRC, "hSrcRC"), (GLuint, "srcName"), (GLenum, "srcTarget"), (GLint, "srcLevel"), (GLint, "srcX"), (GLint, "srcY"), (GLint, "srcZ"), (HGLRC, "hDstRC"), (GLuint, "dstName"), (GLenum, "dstTarget"), (GLint, "dstLevel"), (GLint, "dstX"), (GLint, "dstY"), (GLint, "dstZ"), (GLsizei, "width"), (GLsizei, "height"), (GLsizei, "depth")]),
+
+    # WGL_NV_DX_interop
+    StdFunction(BOOL, "wglDXSetResourceShareHandleNV", [(OpaquePointer(Void), "dxObject"), (HANDLE, "shareHandle")]),
+    StdFunction(HANDLE, "wglDXOpenDeviceNV", [(OpaquePointer(Void), "dxDevice")]),
+    StdFunction(BOOL, "wglDXCloseDeviceNV", [(HANDLE, "hDevice")]),
+    StdFunction(HANDLE, "wglDXRegisterObjectNV", [(HANDLE, "hDevice"), (OpaquePointer(Void), "dxObject"), (GLuint, "name"), (GLenum, "type"), (GLenum, "access")]),
+    StdFunction(BOOL, "wglDXUnregisterObjectNV", [(HANDLE, "hDevice"), (HANDLE, "hObject")]),
+    StdFunction(BOOL, "wglDXObjectAccessNV", [(HANDLE, "hObject"), (GLenum, "access")]),
+    StdFunction(BOOL, "wglDXLockObjectsNV", [(HANDLE, "hDevice"), (GLint, "count"), Out(Array(HANDLE, "count"), "hObjects")]),
+    StdFunction(BOOL, "wglDXUnlockObjectsNV", [(HANDLE, "hDevice"), (GLint, "count"), Out(Array(HANDLE, "count"), "hObjects")]),
+
     # must be last
     StdFunction(PROC, "wglGetProcAddress", [(LPCSTR, "lpszProc")]),
 ])
index 7c607346f064000e4d0ddf1cd2bd33d709983c4e..3496ce5b74880d4e7b8aaa8d50bcfdac4c4d9697 100644 (file)
@@ -497,7 +497,9 @@ bool _ExpandScanline( LPVOID pDestination, size_t outSize, DXGI_FORMAT outFormat
 bool _LoadScanline( XMVECTOR* pDestination, size_t count,
                     LPCVOID pSource, size_t size, DXGI_FORMAT format )
 {
+#if !defined(_XM_NO_INTRINSICS_)
     assert( pDestination && count > 0 && (((uintptr_t)pDestination & 0xF) == 0) );
+#endif
     assert( pSource && size > 0 );
     assert( IsValid(format) && !IsVideo(format) && !IsTypeless(format) && !IsCompressed(format) );
 
@@ -977,7 +979,9 @@ bool _StoreScanline( LPVOID pDestination, size_t size, DXGI_FORMAT format,
                      const XMVECTOR* pSource, size_t count )
 {
     assert( pDestination && size > 0 );
+#if !defined(_XM_NO_INTRINSICS_)
     assert( pSource && count > 0 && (((uintptr_t)pSource & 0xF) == 0) );
+#endif
     assert( IsValid(format) && !IsVideo(format) && !IsTypeless(format) && !IsCompressed(format) );
 
     const XMVECTOR* __restrict sPtr = pSource;
@@ -1836,7 +1840,9 @@ DWORD _GetConvertFlags( DXGI_FORMAT format )
 
 void _ConvertScanline( XMVECTOR* pBuffer, size_t count, DXGI_FORMAT outFormat, DXGI_FORMAT inFormat, DWORD flags )
 {
+#if !defined(_XM_NO_INTRINSICS_)
     assert( pBuffer && count > 0 && (((uintptr_t)pBuffer & 0xF) == 0) );
+#endif
     assert( IsValid(outFormat) && !IsVideo(outFormat) && !IsTypeless(outFormat) );
     assert( IsValid(inFormat) && !IsVideo(inFormat) && !IsTypeless(inFormat) );