Jump to content

  • Log In with Google      Sign In   
  • Create Account


brasslips2

Member Since 27 Sep 2008
Offline Last Active May 26 2013 07:04 PM

Posts I've Made

In Topic: [DX 11] object names for debugging & warnings using Effects

03 October 2011 - 04:26 AM

Well, here's my implementation if anyone is wanting this for their project. Big thanks to MJP for leading me in the right direction. He was right that the constant buffers are accessible but the shaders aren't. Below is some code that I wrote to add debug names to the shaders. You'd do similar stuff for hull, computer shaders, etc. I can't guarantee that my way is the best way to do it. But it works nevertheless. Hope it helps if anyone was in the same boat as I was...

---The added Code to Effect..

d3dx11effect.h(ID3DX11Effect ~1524)
STDMETHOD_(HRESULT, GetVertexShader)(THIS_ ID3D11VertexShader **ppVS) PURE;
    STDMETHOD_(HRESULT, GetPixelShader)(THIS_ ID3D11PixelShader **ppPS) PURE;


Effect.h(CEffect ~1219)
STDMETHOD_(HRESULT, GetVertexShader)(ID3D11VertexShader **ppVS);
    STDMETHOD_(HRESULT, GetPixelShader)(ID3D11PixelShader **ppPS);


EffectReflection.cpp(2151)
HRESULT CEffect::GetVertexShader(ID3D11VertexShader **ppVS)
{
    if(m_pShaderBlocks != NULL)
    {
        for(UINT i = 0; i < m_ShaderBlockCount; ++i)
        {
            if(m_pShaderBlocks[i].GetVertexShader(ppVS) == S_OK)
            {
                return S_OK;
            }
        }
    }
    return S_FALSE;
}
HRESULT CEffect::GetPixelShader(ID3D11PixelShader **ppPS)
{
    if(m_pShaderBlocks != NULL)
    {
        for(UINT i = 0; i < m_ShaderBlockCount; ++i)
        {
            if(m_pShaderBlocks[i].GetPixelShader(ppPS) == S_OK)
            {
                return S_OK;
            }
        }
    }
    return S_FALSE;}
---------- Using the code...
// Set the vertex shader name
ID3D11VertexShader* pVertexShader;
effect->GetVertexShader(&pVertexShader);
DXUT_SetDebugName(pVertexShader, YOUR_DEBUG_NAME);
SAFE_RELEASE(pVertexShader);

// Set the pixel shader name
ID3D11PixelShader* pPixelShader;
effect->GetPixelShader(&pPixelShader);
DXUT_SetDebugName(pPixelShader, YOUR_DEBUG_NAME);
SAFE_RELEASE(pPixelShader);

// Set the debug name for the constant buffers
UINT bufferIndex = 0;
ID3DX11EffectConstantBuffer* cBuffer = effect->GetConstantBufferByIndex(bufferIndex);
while(cBuffer->IsValid())
{
    ID3D11Buffer* ccBuffer;
    cBuffer->GetConstantBuffer(&ccBuffer);
    DXUT_SetDebugName(ccBuffer, YOUR_DEBUG_NAME);
    SAFE_RELEASE(ccBuffer);
    cBuffer = effect->GetConstantBufferByIndex(++bufferIndex);
}

------
VUALA IT WORKS!

In Topic: [DX 11] object names for debugging & warnings using Effects

25 September 2011 - 03:19 AM

Those are objects created by the effect. The first is a buffer (probably a constant buffer), the second is a vertex shader, and the third is a pixel shader. There could be even more of these objects in an effect, depending on how many techniques and passes you have. I know you can access constant buffers through GetConstantBufferByIndex and GetConstantBufferByName, but I don't think there's any way to access the underlying shaders.

Of course, since you have the Effects11 source code you could always modify it to set the debug names or to provide access to the shaders.


Thanks, I was wondering why it wasn't very straight forward. I guess I'm off to editing the effects framework then... sigh =(

In Topic: [DX 11] object names for debugging & warnings using Effects

18 September 2011 - 06:12 AM

DXUT_SetDebugName calls SetPrivateData on the object... thanks, but that doesn't really help.

In Topic: [DX 11] object names for debugging & warnings using Effects

18 September 2011 - 01:40 AM

Anyone? I'm still having this issue.

In Topic: PIX Error on experiment startup

15 June 2011 - 03:11 AM

So this was caused by my screen width and height to be garbage data when running through pix. The reason being was that my width and height I was reading from XML with with a file reference as such:


TiXmlDocument doc("Assets/XML/WindowsTweakables.xml");
if(!doc.LoadFile()) return;

When running through PIX it wasn't getting the proper file directory and returning so my variables from this file weren't being initialized. To fix this I tried the following:
project properties -> c/c++ -> preprocessor -> Preprocesor Definitions: and added this MY_SOLUTIONDIR=$(SolutionDir)

That creates a define with the full c:/ extension. Now I'm stuck on figuring out how to turn the define into a string since it doesn't include the quotes at the beginning and end. If anyone knows a cool way to turn it into a string that would be helpful =D


*UPDATE*:
MY_SOLUTIONDIR expands to something like: C:\Users\***\Desktop\***\TestProject\Debug\\


#define ADD_QUOTES_HELPER(s) #s
#define ADD_QUOTES(s) ADD_QUOTES_HELPER(s)

std::string filename(ADD_QUOTES(MY_SOLUTIONDIR));
**

For some reason the above doesn't work to add the quotes... instead I get:

warning C4129: 'D' : unrecognized character escape sequence
warning C4129: 'T' : unrecognized character escape sequence

Any 1337 macro programmers know how to fix this?

PARTNERS