Git Product home page Git Product logo

xrtl's Introduction

Cross-platform Real-Time Rendering Library

Linux/Mac CPU Windows CPU
Build Status Build status

Status: currently bringing up the foundations of the library and massaging code from previous internal projects to something acceptable for public release. Please be patient!

A lightweight framework for writing efficient cross-platform rendering code in modern C++. It abstracts operating system and toolchain concepts to enable quick prototyping and interation of rich interactive applications that run beautifully everywhere. The library is engineered for small code sizes to enable fast loading and low resource usage even within web browsers.

Pronounced 'zurtle'.

This is not an official Google product.

Setup Instructions

MacOS

$ brew install bazel go
  • Install protobuf:
$ sudo easy_install protobuf
  • Run initial setup with xtool:
$ ./xtool setup

Ubuntu

$ sudo apt-get install bazel golang-go libegl1-mesa-dev libgles2-mesa-dev
  • Run initial setup with xtool:
$ ./xtool setup

Windows

> choco install bazel golang
  • Follow the bazel on Windows instructions (set BAZEL_SH, etc)
  • Run initial setup with xtool:
> xtool setup

IDE Setup

Visual Studio 2017

  • Generate a Visual Studio solution; do this each time you change BUILD files:
> xtool sln
  • Open .vs\xrtl.sln, select a project, and press F5!

CLion

  • Install the 'CLion with Bazel' plugin from the repository.
  • Import the bazel project from the root git folder.
  • Set the bazel binary to xtool (or xtool.bat on Windows).
  • Import the project view from the workspace .bazelproject file.

If clang is not your default CC you should start CLion with CC=clang.

Developing

  • Build/test/run/query for host platform:
$ ./xtool build --all
$ ./xtool test --all
$ ./xtool run //xrtl/base:math_test_linux -- --some_arg
# Note that you can use `bazel` instead of `xtool` in most cases, but you must
# specify a config.
$ bazel build --config=macos_x86_64 //xrtl/base/...
  • Run linter and fix common errors:
$ ./xtool fix

Debugging Notes

GDB may need the following commands run at startup to resolve some third party source code. Replace directories with your workspace location:

dir $HOME/xrtl/bazel-xrtl
set substitute-path external/com_github_google_swiftshader $HOME/xrtl/third_party/swiftshader/
set substitute-path external/com_github_khronosgroup_glslang $HOME/xrtl/third_party/glslang/

Committing Code

  • Run presubmit to perform lint/style check/run tests.
$ ./xtool presubmit --fix

Testing

Test Tags

Common tags that can be added to tests:

  • exclusive: no other tests should run while this test is executing.
  • requires_gui: test uses a GUI and requires a window manager (X11/etc).
  • requires_gpu: test requires a real hardware GPU to run.
# Run all tests except those that require a hardware GPU:
$ ./xtool test --all --test_tag_filter=-requires_gpu

xrtl's People

Contributors

benvanik avatar scotttodd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xrtl's Issues

Travis/appveyor not using bazelrc?

AppVeyor hangs after a build, making me think it's not running bazel in batch mode. Travis was not building with swiftshader as defined in its bazelrc, which is also weird.

Bring up Android support

Meta bug for tracking initial Android bring-up:

  • xtool setup of Android SDK/NDK
  • Travis CI setup of Android SDK/NDK
  • target_platform configuration for crosstool/cpu combinations
  • portable_cc_test (or, maybe new skylark magic?)
    • adb use cross-platform?
    • adb cc_test/cc_binary data dep upload
    • gtest log writing and retrieval
  • xtool build/test to build Android targets (when SDK is present)
  • jni_utils ported to xrtl
  • javah skylark magic for exposing NDK code to java
  • java_cc_wrapper for bringing Java APIs into NDK code

Unbuffer window events/input when possible

Not great to have input events deferred - would be better when there's no need for ordering to instead execute the handlers inline on the message loop, if possible. Would need to change around PostEvent & co, maybe making it only for X11.

Modernize base/

Thread was written before ArrayView; the Thread::Wait* functions are a bit hard to use because of this. Updating it and other places that take vectors today would be nice.

Would also be nice to add ostream helpers for all threading return codes to enable CHECKs and logging.

Enable MessageLoop adoption

Add a MessageLoop::AdoptCurrent() that returned a MessageLoop-compatible instance for posting. This would let us interact with the existing main-thread looper/runloop/etc on platforms where we are not the entry point.

Add clang CROSSTOOL for Windows

Would be nice to have a clang build on Windows (as clang can do that now!) and it would enable clang-tidy for xtool tidy and xtool presubmit. We could upstream this in bazel, maybe, too as --cpu=x64_windows_clang.

.

.

Android: setup javah for JNI autogeneration.

Add a skylark rule that accepts .java files and spits out a header per file; or one single header (to avoid outs mess). @local_jdk should have javah, but there may be a better bazel way to get it (or from the Android NDK).

CHECK tests in logging_test.cc fail in weird ways

The tests pass on MacOS but not on Windows and some Linux variants. Not sure why, as most of this is from TensorFlow.

[ RUN      ] LoggingTest.FailedChecks
C:\users\ben\appdata\local\temp\_bazel_ben\4qe-y0h3\execroot\xrtl\xrtl\base\logging_test.cc(72): error: Death test: if ((!(false))) ::xrtl::internal::LogMessageFatal("C:\\users\\ben\\appdata\\local\\temp\\_bazel_ben\\4qe-y0h3\\execroot\\xrtl\\xrtl\\base\\logging_test.cc", 72) << "Check failed: " "false" " "
    Result: died but not with expected error.
  Expected: false
Actual msg:

ES3: implement all push constant types.

Currently the ES3Shader push constant reflection code and the ES3RenderPassCommandEncoder::UpdatePushConstants code don't handle most supported types (like anything integer/ivec/etc).

`./xtool setup` failed with no explicit error message.

the command and output is as below, I am running it on an ubuntu 14.04 machine.

$ ./xtool setup
Setting up the build environment...

  • git submodule init / update...
    Cloning into 'third_party/glm'...
    remote: Counting objects: 46915, done.
    remote: Compressing objects: 100% (7/7), done.
    remote: Total 46915 (delta 2), reused 4 (delta 1), pack-reused 46907
    Receiving objects: 100% (46915/46915), 62.37 MiB | 4.36 MiB/s, done.
    error: RPC failed; result=56, HTTP code = 200
    Resolving deltas: 100% (34376/34376), done.
    Clone of 'https://github.com/g-truc/glm.git' into submodule path 'third_party/glm' failed
    Traceback (most recent call last):
    File "./xtool", line 1821, in
    sys.exit(main())
    File "./xtool", line 126, in main
    return_code = command.execute(args, pass_args, os.getcwd())
    File "./xtool", line 662, in execute
    git_submodule_update()
    File "./xtool", line 474, in git_submodule_update
    '--recursive',
    File "./xtool", line 324, in shell_call
    subprocess.check_call(command, shell=False, stdout=stdout_file)
    File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['git', 'submodule', 'update', '--init', '--recursive']' returned non-zero exit status 1

ES3: delay-create resources to avoid thread-locked contexts

Only need objects created when mapping, otherwise can be deferred until first use on the queue thread.
Thinking:

  • context has a single platform context for resource stuff (this is the 'root' share group context)
  • queues have a context of their own
  • swap chains have a context of their own

The context could then have a small thread that listens for requests to map/unmap buffers and delete objects, and creations happen delayed on first execution.

Cache bazel info results in xtool

Currently call bazel info execution_root and others a bunch. Would be nice to cache per run for each configuration in some helper, as the results should be the same for each config.

Add compile-time generated shader definitions.

Find minimal shader module definition (exported functions, push constant ranges, binding slots, etc) and add to shader_tool output. To allow the compile-time headers without requiring the use of embedded shaders a new header file (--output_spirv_layout={input}_layout.h) could contain the information.

Add RingBuffer and move imgui over to it.

Currently playing with fire by reusing the same buffers for drawing. Need to write a gfx::RingBuffer to reuse that does the right things here, as well as add QueueFence queries and waiting to properly manage the read/write heads.

Can't have QueueFence be an Event, unfortunately, but could add a Wait() method on it as well as a query.

Can support both wait and query easily on vulkan, webgl2/es3, and d3d. Metal needs some custom work via command submit completion handlers, but nothing bad.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.