Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

steven166

Member Since 22 Nov 2011
Offline Last Active Yesterday, 07:26 PM
-----

Posts I've Made

In Topic: cannot access a texture array in precompiled shader

08 May 2013 - 07:32 PM

Thank eppo for reply, the syntax you see is right. The first texture will be bound to the 4th slot, and the second texture at the 5th slot...etc. About Texture2DArray, I have tried to use it, but there is a problem with texture's resolution if there are many textures.


In Topic: cannot access a texture array in precompiled shader

08 May 2013 - 05:23 AM

Thank everybody for the reply,

 

For binding the textures:

pd3dImmediateContext->PSSetSamplers( 0, 1, &g_pSamLinear );

//g_sFileNames stores list of texture names
//g_pTextures is two dimensional array of shader resource view
pd3dImmediateContext->PSSetShaderResources(4, g_sFileNames.size(), g_pTextures);

As I sampling at the current pixel, everything is fine if the current pixel use the first texture in the array, otherwise the color is black :(

 

For pre-compiling using fxc, I used

fxc simple.hlsl /T vs_5_0 /EVS /Fo "VSCompile.cso"

and 

fxc simple.hlsl /T ps_5_0 /EPS /Fo "PSCompile.cso"

In Topic: How to update a matrix array for shader in DirectX 11?

28 January 2013 - 09:07 AM

Sorry, I just test it before posting. Actually, it is b1


In Topic: How to update a matrix array for shader in DirectX 11?

28 January 2013 - 05:08 AM

Thank Zaoshi Kaba, but I even modify the shader for debug, but values of three arrays are the same (1, 0, 0)

 

cbuffer cbPerFrame: register(b1)
{
float4x4 g_mMatrixArray[10];
}

VS_OUTPUT RenderSceneVS( VS_INPUT input )
{
    VS_OUTPUT Output;    

    float4 temp = 0;
    float3 posL = float3(1.0f, 0.0f, 0.0f);
    float4x4 temp1 = g_mMatrixArray[0] + g_mMatrixArray[1] + g_mMatrixArray[2];
    temp = mul(float4(posL, 1.0f), temp1);

    // Transform the position from object space to homogeneous projection space
    Output.Position = mul( float4(temp.xyz, 1.0f), g_mWorldViewProjection );
    
    Output.Color = input.Color;

    return Output;
}

 

errorls.jpg

 

As you can see the image, all matrices have the same value and they are float1x4 instead of float4x4. I do not understand sad.png


In Topic: Effect in DX11?

27 January 2013 - 08:09 PM

Vexal, it is not what I meant. Just imagine that in shader, I have a constant buffer which is an array of matrix gBoneTransform[96]. And in C++ source code, I want to update that matrix array. For example, people use SetMatrixArray(array, count) to update the matrix array in an effect. But I am not sure that is there any way to do same thing without using an effect?


PARTNERS