Coder Social home page Coder Social logo

vivante_swizzle's Introduction

I wrote the post "Texture tiling and swizzling"
(http://fgiesen.wordpress.com/2011/01/17/texture-tiling-and-swizzling/)
almost exactly 3 years ago, but I never did a proper example, simply because
all the actual implementations of that technique that I'd written up to that
point were for hardware I had signed NDAs for.

Well, today I got a question about this relating to the "Supertiling" scheme
used by Vivante chips
(https://github.com/laanwj/etna_viv/blob/master/doc/hardware.md#texture-tiling).
As it happens, that scheme matches the model described in the article
exactly, is relatively simple, and most importantly, I've never signed any
NDAs with (or gotten hardware docs from) Vivante, so there shouldn't be any
legal problems.

So here goes: a full implementation of the technique as intended, for a format
used by actual existing GPU hardware, plus small test driver.

This code is optimized for readability not maximum performance; but I think it
shows off the key ideas quite well. In particular, I really want to emphasize
that, within the model described in my blog post, the code snippets are
*completely generic*. All knowledge about the texture layout is contained in
the "swizzle_*" functions and the (small) unrolled inner loop for the aligned
center part in "swizzle_32bpp". And none of these functions get called inside
the inner loops, so it really is possible to write a generic swizzler, passing
in the "swizzle_*" functions as an interface, function pointers or the like.

This code only implements RGBA/RGBx formats with 32 bits per pixel, since
that's what was described in the docs. However, again, this requirement is
fairly superficial. The same approach can be used with different bits per
pixel; you'd probably want one set of inner loops for every bit depth used.

- Fabian "ryg" Giesen, January 2014

vivante_swizzle's People

Contributors

rygorous avatar

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.