Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, ChrstphFr), 941 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
get exact pixelshader version (ps2.0, 2.a, 2.b) and r32f support #315712
03/18/10 13:51
03/18/10 13:51
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
Hi,
I'm trying to get the shader capabilities of a gfx card through D3DCAPS9 but i can't get it to work. What i need is the exact pixelshader version the gfx card supports (ps 2.0, ps 2.a, ps 2.b or ps 3.0) and if the card supports r16f and/or r32f textures as well as MRTs (2 or 4).
Is there anyone who already did this and can give me some help?
Oh and using a dll is not an option. I need it lite-c only.

Any help appreciated laugh


Shade-C EVO Lite-C Shader Framework
Re: get exact pixelshader version (ps2.0, 2.a, 2.b) and r32f support [Re: BoH_Havoc] #315724
03/18/10 15:06
03/18/10 15:06
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
If you haven´t done it yet, you should try messing around with the DirecX SDK documentation. I just tried to check the texture format using: ((LPDIRECT3D9)pd3d)->CheckDeviceFormat(...) But the texture formats aren´t defined, so this needs some more defines....

I am still doing something wrong as it crashes, but I think that I am quite close:
Code:
#include <acknex.h>
#include <d3d9.h>

#define D3DFMT_A8R8G8B8 21
#define D3DFMT_X8R8G8B8 22

#define D3DFMT_R16F 111
#define D3DFMT_G16R16F 112
#define D3DFMT_A16B16G16R16F 113

#define D3DFMT_R32F 114
#define D3DFMT_G32R32F 115
#define D3DFMT_A32B32G32R32F 116

#define D3DRTYPE_SURFACE 1
#define D3DRTYPE_VOLUME 2
#define D3DRTYPE_TEXTURE 3
#define D3DRTYPE_VOLUMETEXTURE 4
#define D3DRTYPE_CubeTexture 5
#define D3DRTYPE_VERTEXBUFFER 6
#define D3DRTYPE_INDEXBUFFER 7

void main()
{
	level_load("");
	wait(1);
	((LPDIRECT3D9)pd3d)->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_R32F);
}



Re: get exact pixelshader version (ps2.0, 2.a, 2.b) and r32f support [Re: Slin] #315853
03/19/10 16:50
03/19/10 16:50
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
The manual's "d3d_shaderversion" variable can be used to check the shader version support.

Quote:
as well as MRTs (2 or 4).
I was under the impression that if a card does support MRTs it usually supports 4 or 8, but the lack of a "2" option was just an assumption on my part.

The "bmap_rendertarget()" -- the old way to do MRTs -- is still supported and can be useful for determining how many render targets the computer supports. See what the manual says about it. I used it in the shader contest last year for disabling deferred rendering when there's no MRT support (as far as I've heard your deferred shaders work with or without MRT support, but I was being lazy laugh ).

Unfortunately the engine doesn't seem to come with anything for checking R16f or R32f texture support, which is obviously also very important to know, so you're probably best-off with Slin's example if he/you/I/someone can get it working.

Jibb

EDIT: Just realized after posting that d3d_shaderversion doesn't seem to differentiate between different 2.x versions.

Last edited by JulzMighty; 03/19/10 16:52.

Formerly known as JulzMighty.
I made KarBOOM!
Re: get exact pixelshader version (ps2.0, 2.a, 2.b) and r32f support [Re: JibbSmart] #316000
03/20/10 17:21
03/20/10 17:21
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
Thanks guys, r32f detection works now

Code:
#define D3DFMT_X8R8G8B8 22
#define D3DFMT_R32F 114
#define D3DRTYPE_TEXTURE 3
#define D3DUSAGE_RENDERTARGET (0x00000001L)

void getR32FSupport()
{
   LPDIRECT3D9 mypD3D;
   mypD3D = pd3d;

   var b_r32f = (mypD3D)->CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_R32F);

   if(b_r32f == 0) //r32f supported for RTs
   else //r32f not supported, b_r32f == -653206
}



No let's see if we can get the pixelshader detection working as well... laugh


Shade-C EVO Lite-C Shader Framework
Re: get exact pixelshader version (ps2.0, 2.a, 2.b) and r32f support [Re: BoH_Havoc] #316002
03/20/10 17:25
03/20/10 17:25
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Thanks for the code.

What's the big difference between the 2.x's?

Jibb


Formerly known as JulzMighty.
I made KarBOOM!
Re: get exact pixelshader version (ps2.0, 2.a, 2.b) and r32f support [Re: JibbSmart] #316003
03/20/10 17:35
03/20/10 17:35
Joined: Jun 2004
Posts: 655
to your left
BoH_Havoc Offline OP
User
BoH_Havoc  Offline OP
User

Joined: Jun 2004
Posts: 655
to your left
For me the most important part right now is the number of instrcution slots, which is way higher with ps 2.0a/b cards laugh

For more differences, have a look at the comparison table here (there's even more, but this gives a good overview):
http://en.wikipedia.org/wiki/High_Level_Shader_Language


Shade-C EVO Lite-C Shader Framework
Re: get exact pixelshader version (ps2.0, 2.a, 2.b) and r32f support [Re: BoH_Havoc] #316021
03/20/10 19:09
03/20/10 19:09
Joined: Mar 2006
Posts: 3,538
WA, Australia
J
JibbSmart Offline
Expert
JibbSmart  Offline
Expert
J

Joined: Mar 2006
Posts: 3,538
WA, Australia
Oh wow -- the difference is significant. Thanks for that. It definitely makes sense to make the most of those differences where possible.

Jibb


Formerly known as JulzMighty.
I made KarBOOM!

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1