VQ Framebuffer Article

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
maslevin
DC Developer
DC Developer
Posts: 13
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Thu Apr 02, 2015 11:26 pm
Has thanked: 15 times
Been thanked: 6 times

VQ Framebuffer Article

Post by maslevin »

Hey I just wanted to post this article I wrote for my blog about using a VQ Texture for emulation on the Dreamcast, based on my experience writing FrNES back in the day, and experimenting with an approach that TapamN mentioned in a 2 year old post that I read last week. It might be of interest to anyone writing code that produces procedural textures for the DC.

http://www.numechanix.com/blog/index.php/2015/10/03/20/

A code sample is presented at my github.

https://github.com/maslevin/dreamcast-samples
User avatar
Bouz
DCEmu Junior
DCEmu Junior
Posts: 46
Joined: Mon May 10, 2010 3:42 pm
Location: St. Bauzille de Putois (France)
Has thanked: 0
Been thanked: 0

Re: VQ Framebuffer Article

Post by Bouz »

Nice article, thanks for this!
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: VQ Framebuffer Article

Post by bogglez »

Vq can be used with less than 16 bits btw
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
maslevin
DC Developer
DC Developer
Posts: 13
Joined: Thu Apr 02, 2015 11:26 pm
Has thanked: 15 times
Been thanked: 6 times

Re: VQ Framebuffer Article

Post by maslevin »

Don't the paletted modes for VQ still require the image to be twiddled as well (because the bit flag for paletted modes is shared with the flag for image twiddling)?
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: VQ Framebuffer Article

Post by bogglez »

I've never tried that, so I'm not sure, sorry :-)

However

Code: Select all

>>palette4 = 5 << 27
>>palette8 = 6 << 27
>>twid       = 1 << 26
>>palette4 & twid
0
>>palette8 & twid
0
So I'm not sure what you mean
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: VQ Framebuffer Article

Post by BlueCrab »

The bits for selecting the palette used overlap with the twiddled/strided bits. Thus, the hardware requires all paletted images to be twiddled.
MetalliC
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 28
Joined: Wed Apr 23, 2014 3:04 pm
Has thanked: 0
Been thanked: 0

Re: VQ Framebuffer Article

Post by MetalliC »

anyone tested this on real Dreamcast ?
in DCDBSysArc990907E.doc §3.6.2 Texture Formats and §3.6.2.3 VQ Textures is clearly defined as subset of twiddled textures only, and only square.
I suppose even if it works it's kind of "undefined behaviour" case.

PS: if anyone interested - regular model of PowerVR2 chip, PMX1 aka Neon250, doesn't have onchip palette memory like DC's CLX2/Holly, so it have VQ-style paletted texture format instead. each element of codebook represents single A8R8G8B8 texel (last 32bits of code book entry not used). can be either twiddled or nontwiddled.
maslevin
DC Developer
DC Developer
Posts: 13
Joined: Thu Apr 02, 2015 11:26 pm
Has thanked: 15 times
Been thanked: 6 times

Re: VQ Framebuffer Article

Post by maslevin »

Hey MetalliC,

I tested this on a real DC through the writing of the article and the associated research.

What you are referring to is an incomplete reference, as far as I am aware. I have found reference to the non-palleted VQ texture in the Kamui manual (although, no documentation of its byte-structure) so it's definitely a known aspect of the hardware, at least by the Katana SDK team.

Interesting point about the PMX1. I've often wondered if there are 32BPP modes/features of the PVR2 that we haven't yet discovered.

-Matt
MetalliC
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 28
Joined: Wed Apr 23, 2014 3:04 pm
Has thanked: 0
Been thanked: 0

Re: VQ Framebuffer Article

Post by MetalliC »

Hi ;)
maslevin wrote: I tested this on a real DC through the writing of the article and the associated research.
great, thank you for making this clear.
maslevin wrote: What you are referring to is an incomplete reference, as far as I am aware. I have found reference to the non-palleted VQ texture in the Kamui manual (although, no documentation of its byte-structure) so it's definitely a known aspect of the hardware, at least by the Katana SDK team.
indeed its not 100% complete, but this reference for internal Sega usage only, so it describes a lot of things in much much greater details than KatanaSDK docs.
Kamui docs more looks like edited Videologic's PVR2 user manual, there is no need to describe how thing works inside, but just how to use it.
maslevin wrote: Interesting point about the PMX1. I've often wondered if there are 32BPP modes/features of the PVR2 that we haven't yet discovered.
sadly, I don't think its exists or can be enabled in CLX2.
in term of rendering features PMX1 core differs in a few things only, all in Texture Control Word:
- texture type 5 is 32bit B8G8R8A8 (you are looking for ;)
- there is no onchip palette RAM, so no 4 or 8 BPP Palette textures (types 5 and 6 in CLX2)
- bit 21 enables "VQ palette" texture mode described in previous post.
its the only differences I've seen in games so far, but its possible there are more.

in my opinion, CLX2 may have some undocumented texturing-related things hidden only in TCW bits 21-24 (in the case of non palette textures only). so it seems unlikely.
MetalliC
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 28
Joined: Wed Apr 23, 2014 3:04 pm
Has thanked: 0
Been thanked: 0

Re: VQ Framebuffer Article

Post by MetalliC »

can anyone please share selfbootable cdi image of this VQFB demo ?
Post Reply