José Fonseca | 944088e | 2012-11-20 14:47:03 +0000 | [diff] [blame] | 1 | /************************************************************************** |
| 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é Fonseca | 1df5ed8 | 2014-06-13 10:45:46 +0100 | [diff] [blame^] | 31 | #include "com_ptr.hpp" |
José Fonseca | 1592ad2 | 2012-12-04 13:04:14 +0000 | [diff] [blame] | 32 | #include "d3d10imports.hpp" |
| 33 | #include "d3d10state.hpp" |
José Fonseca | 944088e | 2012-11-20 14:47:03 +0000 | [diff] [blame] | 34 | |
| 35 | |
| 36 | namespace d3dstate { |
| 37 | |
| 38 | |
José Fonseca | 1d4fd14 | 2012-11-28 15:06:22 +0000 | [diff] [blame] | 39 | const GUID |
| 40 | GUID_D3DSTATE = {0x7D71CAC9,0x7F58,0x432C,{0xA9,0x75,0xA1,0x9F,0xCF,0xCE,0xFD,0x14}}; |
| 41 | |
| 42 | |
José Fonseca | 1d4fd14 | 2012-11-28 15:06:22 +0000 | [diff] [blame] | 43 | static void |
| 44 | dumpShaders(JSONWriter &json, ID3D10Device *pDevice) |
| 45 | { |
| 46 | json.beginMember("shaders"); |
| 47 | json.beginObject(); |
| 48 | |
José Fonseca | 1df5ed8 | 2014-06-13 10:45:46 +0100 | [diff] [blame^] | 49 | com_ptr<ID3D10VertexShader> pVertexShader; |
José Fonseca | 1d4fd14 | 2012-11-28 15:06:22 +0000 | [diff] [blame] | 50 | pDevice->VSGetShader(&pVertexShader); |
| 51 | if (pVertexShader) { |
José Fonseca | 377c277 | 2012-11-28 17:24:42 +0000 | [diff] [blame] | 52 | dumpShader<ID3D10DeviceChild>(json, "VS", pVertexShader); |
José Fonseca | 1d4fd14 | 2012-11-28 15:06:22 +0000 | [diff] [blame] | 53 | } |
| 54 | |
José Fonseca | 1df5ed8 | 2014-06-13 10:45:46 +0100 | [diff] [blame^] | 55 | com_ptr<ID3D10GeometryShader> pGeometryShader; |
José Fonseca | 377c277 | 2012-11-28 17:24:42 +0000 | [diff] [blame] | 56 | pDevice->GSGetShader(&pGeometryShader); |
| 57 | if (pGeometryShader) { |
| 58 | dumpShader<ID3D10DeviceChild>(json, "GS", pGeometryShader); |
José Fonseca | 377c277 | 2012-11-28 17:24:42 +0000 | [diff] [blame] | 59 | } |
| 60 | |
José Fonseca | 1df5ed8 | 2014-06-13 10:45:46 +0100 | [diff] [blame^] | 61 | com_ptr<ID3D10PixelShader> pPixelShader; |
José Fonseca | 1d4fd14 | 2012-11-28 15:06:22 +0000 | [diff] [blame] | 62 | pDevice->PSGetShader(&pPixelShader); |
| 63 | if (pPixelShader) { |
José Fonseca | 377c277 | 2012-11-28 17:24:42 +0000 | [diff] [blame] | 64 | dumpShader<ID3D10DeviceChild>(json, "PS", pPixelShader); |
José Fonseca | 1d4fd14 | 2012-11-28 15:06:22 +0000 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | json.endObject(); |
| 68 | json.endMember(); // shaders |
| 69 | } |
| 70 | |
| 71 | |
José Fonseca | 944088e | 2012-11-20 14:47:03 +0000 | [diff] [blame] | 72 | void |
| 73 | dumpDevice(std::ostream &os, ID3D10Device *pDevice) |
| 74 | { |
| 75 | JSONWriter json(os); |
| 76 | |
| 77 | /* TODO */ |
José Fonseca | 65ba497 | 2012-11-28 12:56:01 +0000 | [diff] [blame] | 78 | json.beginMember("parameters"); |
| 79 | json.beginObject(); |
| 80 | json.endObject(); |
| 81 | json.endMember(); // parameters |
| 82 | |
José Fonseca | 1d4fd14 | 2012-11-28 15:06:22 +0000 | [diff] [blame] | 83 | dumpShaders(json, pDevice); |
José Fonseca | 65ba497 | 2012-11-28 12:56:01 +0000 | [diff] [blame] | 84 | |
José Fonseca | 283551a | 2013-07-03 15:48:30 +0100 | [diff] [blame] | 85 | dumpTextures(json, pDevice); |
José Fonseca | 65ba497 | 2012-11-28 12:56:01 +0000 | [diff] [blame] | 86 | |
| 87 | dumpFramebuffer(json, pDevice); |
José Fonseca | 944088e | 2012-11-20 14:47:03 +0000 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | |
| 91 | } /* namespace d3dstate */ |