OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 EffectD3D9 *effect_; | 73 EffectD3D9 *effect_; |
74 D3DXHANDLE handle_; | 74 D3DXHANDLE handle_; |
75 unsigned int sampler_unit_count_; | 75 unsigned int sampler_unit_count_; |
76 scoped_array<unsigned int> sampler_units_; | 76 scoped_array<unsigned int> sampler_units_; |
77 }; | 77 }; |
78 | 78 |
79 // D3D9 version of Effect. | 79 // D3D9 version of Effect. |
80 class EffectD3D9 : public Effect { | 80 class EffectD3D9 : public Effect { |
81 public: | 81 public: |
82 EffectD3D9(ID3DXEffect *d3d_effect, | 82 EffectD3D9(ID3DXEffect *d3d_effect, |
83 ID3DXConstantTable *fs_constant_table); | 83 ID3DXConstantTable *fs_constant_table, |
84 IDirect3DVertexShader9 *d3d_vertex_shader); | |
84 virtual ~EffectD3D9(); | 85 virtual ~EffectD3D9(); |
85 // Compiles and creates an effect from source code. | 86 // Compiles and creates an effect from source code. |
86 static EffectD3D9 *Create(GAPID3D9 *gapi, | 87 static EffectD3D9 *Create(GAPID3D9 *gapi, |
87 const String &effect_code, | 88 const String &effect_code, |
88 const String &vertex_program_entry, | 89 const String &vertex_program_entry, |
89 const String &fragment_program_entry); | 90 const String &fragment_program_entry); |
90 // Applies the effect states (vertex shader, pixel shader) to D3D. | 91 // Applies the effect states (vertex shader, pixel shader) to D3D. |
91 bool Begin(GAPID3D9 *gapi); | 92 bool Begin(GAPID3D9 *gapi); |
92 // Resets the effect states (vertex shader, pixel shader) to D3D. | 93 // Resets the effect states (vertex shader, pixel shader) to D3D. |
93 void End(GAPID3D9 *gapi); | 94 void End(GAPID3D9 *gapi); |
94 // Commits parameters to D3D, if they were modified while the effect is | 95 // Commits parameters to D3D, if they were modified while the effect is |
95 // active. | 96 // active. |
96 bool CommitParameters(GAPID3D9 *gapi); | 97 bool CommitParameters(GAPID3D9 *gapi); |
97 | 98 |
98 // Gets the number of parameters in the effect. | 99 // Gets the number of parameters in the effect. |
99 unsigned int GetParamCount(); | 100 unsigned int GetParamCount(); |
100 // Creates an effect parameter with the specified index. | 101 // Creates an effect parameter with the specified index. |
101 EffectParamD3D9 *CreateParam(unsigned int index); | 102 EffectParamD3D9 *CreateParam(unsigned int index); |
102 // Creates an effect parameter of the specified name. | 103 // Creates an effect parameter of the specified name. |
103 EffectParamD3D9 *CreateParamByName(const char *name); | 104 EffectParamD3D9 *CreateParamByName(const char *name); |
105 // Gets the number of stream inputs for the effect. | |
106 unsigned int GetStreamCount(); | |
107 // Gets the stream data with the specified index. | |
108 bool GetStreamDesc(unsigned int index, unsigned int size, void *data); | |
104 private: | 109 private: |
105 typedef std::vector<EffectParamD3D9 *> ParamList; | 110 typedef std::vector<EffectParamD3D9 *> ParamList; |
111 typedef std::vector<effect_stream::Desc> StreamList; | |
106 | 112 |
107 // Links a param into this effect. | 113 // Links a param into this effect. |
108 void LinkParam(EffectParamD3D9 *param); | 114 void LinkParam(EffectParamD3D9 *param); |
109 // Unlinks a param into this effect. | 115 // Unlinks a param into this effect. |
110 void UnlinkParam(EffectParamD3D9 *param); | 116 void UnlinkParam(EffectParamD3D9 *param); |
111 // Sets sampler states. | 117 // Sets sampler states. |
112 bool SetSamplers(GAPID3D9 *gapi); | 118 bool SetSamplers(GAPID3D9 *gapi); |
119 // Sets streams vector. | |
120 bool SetStreams(); | |
113 | 121 |
114 ID3DXEffect *d3d_effect_; | 122 ID3DXEffect *d3d_effect_; |
123 IDirect3DVertexShader9 *d3d_vertex_shader_; | |
115 ID3DXConstantTable *fs_constant_table_; | 124 ID3DXConstantTable *fs_constant_table_; |
116 ParamList params_; | 125 ParamList params_; |
126 StreamList streams_; | |
117 bool sync_parameters_; | 127 bool sync_parameters_; |
118 ResourceID samplers_[kMaxSamplerUnits]; | 128 ResourceID samplers_[kMaxSamplerUnits]; |
119 | 129 |
120 friend class EffectParamD3D9; | 130 friend class EffectParamD3D9; |
131 friend class EffectStreamD3D9; | |
Antoine Labour
2009/07/06 23:48:12
Not needed any more.
| |
121 DISALLOW_COPY_AND_ASSIGN(EffectD3D9); | 132 DISALLOW_COPY_AND_ASSIGN(EffectD3D9); |
122 }; | 133 }; |
123 | 134 |
124 } // namespace command_buffer | 135 } // namespace command_buffer |
125 } // namespace o3d | 136 } // namespace o3d |
126 | 137 |
127 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_EFFECT_D3D9_H__ | 138 #endif // O3D_COMMAND_BUFFER_SERVICE_WIN_D3D9_EFFECT_D3D9_H__ |
OLD | NEW |