当前位置: 首页>>代码示例>>C++>>正文


C++ StateWriter类代码示例

本文整理汇总了C++中StateWriter的典型用法代码示例。如果您正苦于以下问题:C++ StateWriter类的具体用法?C++ StateWriter怎么用?C++ StateWriter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了StateWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dumpShaders

static void
dumpShaders(StateWriter &writer, ID3D10Device *pDevice)
{
    writer.beginMember("shaders");
    writer.beginObject();

    com_ptr<ID3D10VertexShader> pVertexShader;
    pDevice->VSGetShader(&pVertexShader);
    if (pVertexShader) {
        dumpShader<ID3D10DeviceChild>(writer, "VS", pVertexShader);
    }

    com_ptr<ID3D10GeometryShader> pGeometryShader;
    pDevice->GSGetShader(&pGeometryShader);
    if (pGeometryShader) {
        dumpShader<ID3D10DeviceChild>(writer, "GS", pGeometryShader);
    }

    com_ptr<ID3D10PixelShader> pPixelShader;
    pDevice->PSGetShader(&pPixelShader);
    if (pPixelShader) {
        dumpShader<ID3D10DeviceChild>(writer, "PS", pPixelShader);
    }

    writer.endObject();
    writer.endMember(); // shaders
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:27,代码来源:d3d10state.cpp

示例2: dumpArbProgram

static inline void
dumpArbProgram(StateWriter &writer, Context &context, GLenum target)
{
    if (context.ES ||
        context.core ||
        !glIsEnabled(target)) {
        return;
    }

    GLint program_length = 0;
    glGetProgramivARB(target, GL_PROGRAM_LENGTH_ARB, &program_length);
    if (!program_length) {
        return;
    }

    GLchar *source = new GLchar[program_length + 1];
    source[0] = 0;
    glGetProgramStringARB(target, GL_PROGRAM_STRING_ARB, source);
    source[program_length] = 0;

    writer.beginMember(enumToString(target));
    writer.writeString(source);
    writer.endMember();

    delete [] source;
}
开发者ID:Innovative-Ideas,项目名称:apitrace,代码行数:26,代码来源:glstate_shaders.cpp

示例3: dumpShader

inline void
dumpShader(StateWriter &writer, const char *name, T *pShader) {
    if (!pShader) {
        return;
    }

    /*
     * There is no method to get the shader byte code, so the creator is supposed to
     * attach it via the SetPrivateData method.
     */


    std::vector<BYTE> ShaderBytecode = getPrivateData(pShader, GUID_D3DSTATE);
    if (ShaderBytecode.empty()) {
        return;
    }

    com_ptr<IDisassemblyBuffer> pDisassembly;
    HRESULT hr;
    hr = DisassembleShader(&ShaderBytecode[0], ShaderBytecode.size(), &pDisassembly);
    if (SUCCEEDED(hr)) {
        writer.beginMember(name);
        writer.writeString((const char *)pDisassembly->GetBufferPointer() /*, pDisassembly->GetBufferSize() */);
        writer.endMember();
    }
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:26,代码来源:d3d10state.hpp

示例4: dump_state

	// DebugAllocator::dump_state
	void DebugAllocator::dump_state( StateWriter & i_state_writer )
	{
		i_state_writer.write( "type", "debug" );
		i_state_writer.write_mem_size( "heading_nomansland_size", m_heading_nomansland_size );
		i_state_writer.write_mem_size( "tailing_nomansland_size", m_tailing_nomansland_size );

		DecoratorAllocator::dump_state( i_state_writer );
	}
开发者ID:giucamp,项目名称:mmemo,代码行数:9,代码来源:debug_allocator.cpp

示例5: dumpEnum

void
dumpEnum(StateWriter &writer, GLenum pname)
{
    const char *s = enumToString(pname);
    if (s) {
        writer.writeString(s);
    } else {
        writer.writeInt(pname);
    }
}
开发者ID:ShuangxueBai,项目名称:apitrace,代码行数:10,代码来源:glstate.cpp

示例6: dumpRasterizerState

static void
dumpRasterizerState(StateWriter &writer, ID3D10Device *pDevice)
{
    com_ptr<ID3D10RasterizerState> pRasterizerState;

    pDevice->RSGetState(&pRasterizerState);
    writer.beginMember("RasterizerState");
    dumpStateObjectDesc(writer, pRasterizerState);
    writer.endMember(); // RasterizerState
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:10,代码来源:d3d10state.cpp

示例7: dumpDepthStencilState

static void
dumpDepthStencilState(StateWriter &writer, ID3D10Device *pDevice)
{
    com_ptr<ID3D10DepthStencilState> pDepthStencilState;
    UINT stencilRef;

    pDevice->OMGetDepthStencilState(&pDepthStencilState, &stencilRef);
    writer.beginMember("DepthStencilState");
    dumpStateObjectDesc(writer, pDepthStencilState);
    writer.endMember(); // DepthStencilState
    writer.writeIntMember("StencilRef", stencilRef);
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:12,代码来源:d3d10state.cpp

示例8: dump_state

	// DecoratorAllocator::dump_state
	void DecoratorAllocator::dump_state( StateWriter & i_state_writer )
	{
		if( m_dest_allocator != nullptr )
		{
			i_state_writer.tab( "allocator" );
			m_dest_allocator->dump_state( i_state_writer );
			i_state_writer.untab();
		}
		else
		{
			i_state_writer.write( "target", "null" );
		}
	}
开发者ID:giucamp,项目名称:mmemo,代码行数:14,代码来源:decorator_allocator.cpp

示例9: dumpProgramUniformsStage

static void
dumpProgramUniformsStage(StateWriter &writer, GLint program, const char *stage)
{
    if (program <= 0) {
        return;
    }

    writer.beginMember(stage);
    writer.beginObject();
    dumpProgramUniforms(writer, program);
    writer.endObject();
    writer.endMember();
}
开发者ID:Innovative-Ideas,项目名称:apitrace,代码行数:13,代码来源:glstate_shaders.cpp

示例10: dumpBoolean

void
dumpBoolean(StateWriter &writer, GLboolean value)
{
    switch (value) {
    case GL_FALSE:
        writer.writeString("GL_FALSE");
        break;
    case GL_TRUE:
        writer.writeString("GL_TRUE");
        break;
    default:
        writer.writeInt(static_cast<GLint>(value));
        break;
    }
}
开发者ID:ShuangxueBai,项目名称:apitrace,代码行数:15,代码来源:glstate.cpp

示例11: dumpParameters

static void
dumpParameters(StateWriter &writer, ID3D10Device *pDevice)
{
    // TODO: dump description of current bound state
    writer.beginMember("parameters");
    writer.beginObject();

    dumpRasterizerState(writer, pDevice);
    dumpBlendState(writer, pDevice);
    dumpDepthStencilState(writer, pDevice);
    dumpViewports(writer, pDevice);
    dumpScissors(writer, pDevice);

    writer.endObject();
    writer.endMember(); // parameters
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:16,代码来源:d3d10state.cpp

示例12: dumpFramebuffer

void
dumpFramebuffer(StateWriter &writer, ID3D10Device *pDevice)
{
    writer.beginMember("framebuffer");
    writer.beginObject();

    ID3D10RenderTargetView *pRenderTargetViews[D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT];
    ID3D10DepthStencilView *pDepthStencilView;
    pDevice->OMGetRenderTargets(ARRAYSIZE(pRenderTargetViews), pRenderTargetViews,
                                &pDepthStencilView);

    for (UINT i = 0; i < ARRAYSIZE(pRenderTargetViews); ++i) {
        if (!pRenderTargetViews[i]) {
            continue;
        }

        image::Image *image;
        image = getRenderTargetViewImage(pDevice, pRenderTargetViews[i]);
        if (image) {
            char label[64];
            _snprintf(label, sizeof label, "RENDER_TARGET_%u", i);
            writer.beginMember(label);
            writer.writeImage(image);
            writer.endMember(); // RENDER_TARGET_*
            delete image;
        }

        pRenderTargetViews[i]->Release();
    }

    if (pDepthStencilView) {
        image::Image *image;
        image = getDepthStencilViewImage(pDevice, pDepthStencilView);
        if (image) {
            writer.beginMember("DEPTH_STENCIL");
            writer.writeImage(image);
            writer.endMember();
            delete image;
        }

        pDepthStencilView->Release();
    }

    writer.endObject();
    writer.endMember(); // framebuffer
}
开发者ID:byhj,项目名称:apitrace,代码行数:46,代码来源:d3d10state_images.cpp

示例13: dumpViewports

static void
dumpViewports(StateWriter &writer, ID3D10Device *pDevice)
{
   D3D10_VIEWPORT vps[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
   UINT numViewports = 0, i;

   pDevice->RSGetViewports(&numViewports, NULL);
   pDevice->RSGetViewports(&numViewports, vps);

   writer.beginMember("Viewports");
   writer.beginArray();
   for (i = 0; i < numViewports; ++i) {
      dumpStateObject(writer, vps[i]);
   }
   writer.endArray();
   writer.endMember();
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:17,代码来源:d3d10state.cpp

示例14: dumpScissors

static void
dumpScissors(StateWriter &writer, ID3D10Device *pDevice)
{
   D3D10_RECT rects[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];
   UINT numRects = 0, i;

   pDevice->RSGetScissorRects(&numRects, NULL);
   pDevice->RSGetScissorRects(&numRects, rects);

   writer.beginMember("Scissors");
   writer.beginArray();
   for (i = 0; i < numRects; ++i) {
      dumpStateObject(writer, rects[i]);
   }
   writer.endArray();
   writer.endMember();
}
开发者ID:Dhanasekahar,项目名称:apitrace,代码行数:17,代码来源:d3d10state.cpp

示例15: dumpObjectLabel

/**
 * Dump a GL_KHR_debug/GL_EXT_debug_label object label.
 */
void
dumpObjectLabel(StateWriter &writer, Context &context, GLenum identifier, GLuint name, const char *member) {
    char *label = getObjectLabel(context, identifier, name);
    if (!label) {
        return;
    }

    writer.writeStringMember(member, label);
    free(label);
}
开发者ID:ShuangxueBai,项目名称:apitrace,代码行数:13,代码来源:glstate.cpp


注:本文中的StateWriter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。