blob: e612bd0a238831bdadcd1816da4dfc119b14d0d4 [file] [log] [blame]
José Fonseca944088e2012-11-20 14:47:03 +00001/**************************************************************************
2 *
3 * Copyright 2011 Jose Fonseca
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 *
24 **************************************************************************/
25
26
27#include <stdio.h>
28
29#include <iostream>
30
José Fonseca1df5ed82014-06-13 10:45:46 +010031#include "com_ptr.hpp"
José Fonseca1592ad22012-12-04 13:04:14 +000032#include "d3d10imports.hpp"
33#include "d3d10state.hpp"
José Fonseca944088e2012-11-20 14:47:03 +000034
35
36namespace d3dstate {
37
38
José Fonseca1d4fd142012-11-28 15:06:22 +000039const GUID
40GUID_D3DSTATE = {0x7D71CAC9,0x7F58,0x432C,{0xA9,0x75,0xA1,0x9F,0xCF,0xCE,0xFD,0x14}};
41
42
José Fonseca1d4fd142012-11-28 15:06:22 +000043static void
44dumpShaders(JSONWriter &json, ID3D10Device *pDevice)
45{
46 json.beginMember("shaders");
47 json.beginObject();
48
José Fonseca1df5ed82014-06-13 10:45:46 +010049 com_ptr<ID3D10VertexShader> pVertexShader;
José Fonseca1d4fd142012-11-28 15:06:22 +000050 pDevice->VSGetShader(&pVertexShader);
51 if (pVertexShader) {
José Fonseca377c2772012-11-28 17:24:42 +000052 dumpShader<ID3D10DeviceChild>(json, "VS", pVertexShader);
José Fonseca1d4fd142012-11-28 15:06:22 +000053 }
54
José Fonseca1df5ed82014-06-13 10:45:46 +010055 com_ptr<ID3D10GeometryShader> pGeometryShader;
José Fonseca377c2772012-11-28 17:24:42 +000056 pDevice->GSGetShader(&pGeometryShader);
57 if (pGeometryShader) {
58 dumpShader<ID3D10DeviceChild>(json, "GS", pGeometryShader);
José Fonseca377c2772012-11-28 17:24:42 +000059 }
60
José Fonseca1df5ed82014-06-13 10:45:46 +010061 com_ptr<ID3D10PixelShader> pPixelShader;
José Fonseca1d4fd142012-11-28 15:06:22 +000062 pDevice->PSGetShader(&pPixelShader);
63 if (pPixelShader) {
José Fonseca377c2772012-11-28 17:24:42 +000064 dumpShader<ID3D10DeviceChild>(json, "PS", pPixelShader);
José Fonseca1d4fd142012-11-28 15:06:22 +000065 }
66
67 json.endObject();
68 json.endMember(); // shaders
69}
70
71
José Fonseca944088e2012-11-20 14:47:03 +000072void
73dumpDevice(std::ostream &os, ID3D10Device *pDevice)
74{
75 JSONWriter json(os);
76
77 /* TODO */
José Fonseca65ba4972012-11-28 12:56:01 +000078 json.beginMember("parameters");
79 json.beginObject();
80 json.endObject();
81 json.endMember(); // parameters
82
José Fonseca1d4fd142012-11-28 15:06:22 +000083 dumpShaders(json, pDevice);
José Fonseca65ba4972012-11-28 12:56:01 +000084
José Fonseca283551a2013-07-03 15:48:30 +010085 dumpTextures(json, pDevice);
José Fonseca65ba4972012-11-28 12:56:01 +000086
87 dumpFramebuffer(json, pDevice);
José Fonseca944088e2012-11-20 14:47:03 +000088}
89
90
91} /* namespace d3dstate */