this solves what I was asking
- Viewing Profile: Reputation: lomateron
Community Stats
- Group Members
- Active Posts 276
- Profile Views 3,385
- Member Title Member
- Age Age Unknown
- Birthday Birthday Unknown
-
Gender
Not Telling
User Tools
Contacts
lomateron hasn't added any contacts yet.
Latest Visitors
#5069603 changing code on its roots
Posted by lomateron
on 13 June 2013 - 06:46 PM
#5069591 changing code on its roots
Posted by lomateron
on 13 June 2013 - 06:05 PM
HLSL supports switches and in my case the "if"s will translate the same way a switch will do to assembly code
don't derail my real question
Has anyone think about a way to make this faster by creating a way of recompiling the code so it deletes all the unnecessary "if" lines in the assembly code while the application runs
#5069583 changing code on its roots
Posted by lomateron
on 13 June 2013 - 05:39 PM
I have this code
float Code(float a,float b, int c)
{
float r=0;
if( c==0)
{
r=a*b;
}
else if( c==1)
{
r=a/b;
}
else if( c==2)
{
r=2*a;
}
return r;
}
Lets say i don't have 3 different "if" but a thousand different "if", and "c" as it is in the code just selects one "if"
Has anyone think about a way to make this faster by creating a way of recompiling the code so it deletes all the unnecessary "if" lines in the assembly code
Or is there anything related to this that solves the problem in a different way?
#5059350 normals in tangent space question
Posted by lomateron
on 04 May 2013 - 10:51 PM
"derived from the u-v coordinates"
how exactly is the bitangent direction derived?
#5040971 Directx bug?
Posted by lomateron
on 08 March 2013 - 04:06 PM
can someone try this to see if its really a bug, it's simple:
create a texture with 1 texel....create it's render target..create its depthstencil with this DXGI_FORMAT_D24_UNORM_S8_UINT
create depthstencil state with this description:
D3D10_DEPTH_STENCIL_DESC dSDd; dSDd.DepthEnable = FALSE; dSDd.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ZERO; dSDd.DepthFunc = D3D10_COMPARISON_ALWAYS; dSDd.StencilEnable = TRUE; dSDd.StencilReadMask = D3D10_DEFAULT_STENCIL_READ_MASK; dSDd.StencilWriteMask = D3D10_DEFAULT_STENCIL_WRITE_MASK; dSDd.FrontFace.StencilDepthFailOp = D3D10_STENCIL_OP_KEEP; dSDd.FrontFace.StencilFailOp = D3D10_STENCIL_OP_INCR; dSDd.FrontFace.StencilPassOp = D3D10_STENCIL_OP_INCR; dSDd.FrontFace.StencilFunc = D3D10_COMPARISON_EQUAL; dSDd.BackFace.StencilDepthFailOp = D3D10_STENCIL_OP_KEEP; dSDd.BackFace.StencilFailOp = D3D10_STENCIL_OP_KEEP; dSDd.BackFace.StencilPassOp = D3D10_STENCIL_OP_KEEP; dSDd.BackFace.StencilFunc = D3D10_COMPARISON_NEVER;
create 2 techniques with this shaders, first technique uses VS1 and second technique uses VS2
struct VS_A
{
float4 Pos : POSITION;
uint Id : SV_InstanceID;
};
struct PS_A
{
float4 Pos : SV_POSITION;
float4 Texl : TTTTT;
};
PS_A VS1( VS_A i )//stencil will not work as it should
{
PS_A output;
output.Pos=float4(0.0f,0.0f,0.0f,1.0f);
output.Texl=float4(1.0f,1.0f,1.0f,1.0f);
return output;
}
PS_A VS2( float4 Pos : POSITION )//stencil will work correctly
{
PS_A output;
output.Pos=float4(0.0f,0.0f,0.0f,1.0f);
output.Texl=float4(1.0f,1.0f,1.0f,1.0f);
return output;
}
float4 PS( PS_A a) : SV_Target
{
return a.Texl;
}
now to render
set the render target with its depthstencil, set its viewport and layout, point list and finally render it like this:
g_pd3dDevice->OMSetDepthStencilState(g_pDepthStencilState,1); g_pd3dDevice->ClearDepthStencilView( g_pDepthStencilViewSpace3D, D3D10_CLEAR_STENCIL, 0.0f, 0 ); g_pTechnique1->GetPassByIndex( 0 )->Apply( 0 ); g_pd3dDevice->DrawInstanced( 1, 1, 0, 0); g_pd3dDevice->ClearDepthStencilView( g_pDepthStencilViewSpace3D, D3D10_CLEAR_STENCIL, 0.0f, 0 ); g_pTechnique1->GetPassByIndex( 0 )->Apply( 0 ); g_pd3dDevice->DrawInstanced( 1, 1, 0, 0);
the first draw will fail the stencil test and will not draw nothing,
the second draw will pass the stencil test and will draw ----------->This is the problem, i don't know why it passes the test
Now change the technique so it uses the VS2 and render using: g_pd3dDevice->Draw( 1, 0);
The two draws will fail the stencil test, thats how it should work
The use of SV_Instance in VS1 i think is the cause of the problem, i dont know more
#5004009 Math "relations"
Posted by lomateron
on 25 November 2012 - 03:48 PM
Is there any place were i can find a calculator that doesnt gives numbers but relations, one that has a table of variables were i can introduce a list of numbers for each variable and it finds the relations that are between the numbers?
#4998169 Simple 3D model loader DirectX 11
Posted by lomateron
on 06 November 2012 - 01:47 PM
Code that creates the file with the mesh
[source lang="java"]#include <stdio.h>#include <d3dx10math.h>int main (){ FILE * pFile;D3DXVECTOR3 vertices[] ={{ D3DXVECTOR3( 1.0f,1.0f,1.0f )},{ D3DXVECTOR3( 1.0f,1.0f,1.0f )},{ D3DXVECTOR3( 1.0f,1.0f,1.0f )},};DWORD indices[] ={ 0,1,2,}; pFile = fopen ( "myfile.bin" , "wb" ); fwrite (vertices , 1 , sizeof(vertices) , pFile ); fwrite (indices , 1 , sizeof(indices) , pFile ); fclose (pFile); return 0;}[/source]
Code that loads the file with the mesh
[source lang="java"] FILE * pFile; pFile = fopen ( "myfile.bin" , "rb" ); D3DXVECTOR3 vertices[3]; fread (vertices,sizeof(vertices),1,pFile); DWORD indices[3]; fread (indicess,sizeof(indices),1,pFile); fclose (pFile);[/source]
#4981122 finding information on DirectX 10 is Difficult...?
Posted by lomateron
on 17 September 2012 - 09:38 PM
#4953144 big loop with big array
Posted by lomateron
on 26 June 2012 - 03:39 PM
#4925781 very important equation desentralazing
Posted by lomateron
on 27 March 2012 - 01:15 PM
What if i told you i know how to do it, i don't, maybe i will, MUAAHAHAHAHAHAUHUHUHUHU!!!! bye.
#4911868 stream output to vertex buffer (not working as it should)
Posted by lomateron
on 10 February 2012 - 09:34 PM
- Home
- » Viewing Profile: Reputation: lomateron

Find content