本文整理汇总了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
}
示例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;
}
示例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();
}
}
示例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 );
}
示例5: dumpEnum
void
dumpEnum(StateWriter &writer, GLenum pname)
{
const char *s = enumToString(pname);
if (s) {
writer.writeString(s);
} else {
writer.writeInt(pname);
}
}
示例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
}
示例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);
}
示例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" );
}
}
示例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();
}
示例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;
}
}
示例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
}
示例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
}
示例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();
}
示例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();
}
示例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);
}