| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 struct EffectParamDesc { | 52 struct EffectParamDesc { |
| 53 ResourceID id; // The resource ID for the param. | 53 ResourceID id; // The resource ID for the param. |
| 54 String name; // The name of the param. | 54 String name; // The name of the param. |
| 55 String semantic; // The semantic of the param. | 55 String semantic; // The semantic of the param. |
| 56 effect_param::DataType data_type; // The data type of a param. | 56 effect_param::DataType data_type; // The data type of a param. |
| 57 unsigned int data_size; // The size of the data for a param. | 57 unsigned int data_size; // The size of the data for a param. |
| 58 unsigned int cmd_desc_size; // The size of the effect_param::Desc | 58 unsigned int cmd_desc_size; // The size of the effect_param::Desc |
| 59 // structure (counting strings) for a | 59 // structure (counting strings) for a |
| 60 // param. | 60 // param. |
| 61 }; | 61 }; |
| 62 struct EffectStreamDesc { |
| 63 vertex_struct::Semantic semantic; // The semantic enum type. |
| 64 unsigned int semantic_index; |
| 65 }; |
| 62 | 66 |
| 63 EffectHelper(CommandBufferHelper *helper, | 67 EffectHelper(CommandBufferHelper *helper, |
| 64 FencedAllocatorWrapper *shm_allocator, | 68 FencedAllocatorWrapper *shm_allocator, |
| 65 unsigned int shm_id, | 69 unsigned int shm_id, |
| 66 IdAllocator *param_id_allocator) | 70 IdAllocator *param_id_allocator) |
| 67 : helper_(helper), | 71 : helper_(helper), |
| 68 shm_allocator_(shm_allocator), | 72 shm_allocator_(shm_allocator), |
| 69 shm_id_(shm_id), | 73 shm_id_(shm_id), |
| 70 param_id_allocator_(param_id_allocator) { | 74 param_id_allocator_(param_id_allocator) { |
| 71 DCHECK(helper); | 75 DCHECK(helper); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // - invalid parameter ResourceID, | 116 // - invalid parameter ResourceID, |
| 113 // - not enough memory in the shm_allocator_. | 117 // - not enough memory in the shm_allocator_. |
| 114 bool GetParamStrings(EffectParamDesc *desc); | 118 bool GetParamStrings(EffectParamDesc *desc); |
| 115 | 119 |
| 116 // Destroys all parameter resources referenced by the descriptions. The | 120 // Destroys all parameter resources referenced by the descriptions. The |
| 117 // ResourceID will be freed from the param_id_allocator. | 121 // ResourceID will be freed from the param_id_allocator. |
| 118 // Parameters: | 122 // Parameters: |
| 119 // descs: the vector of descriptions containing the ResourceIDs of the | 123 // descs: the vector of descriptions containing the ResourceIDs of the |
| 120 // parameters to destroy. | 124 // parameters to destroy. |
| 121 void DestroyEffectParameters(const std::vector<EffectParamDesc> &descs); | 125 void DestroyEffectParameters(const std::vector<EffectParamDesc> &descs); |
| 126 |
| 127 // Gets all the input stream semantics and semantic indices in an |
| 128 // array. These will be retrieved as many as possible at a time. At least |
| 129 // sizeof(effect_param::Desc) must be available for this function to succeed. |
| 130 // This function will call Finish(), hence will block. |
| 131 // |
| 132 // Parameters: |
| 133 // effect_id: the ResourceID of the effect. |
| 134 // descs: A pointer to a vector containing the returned descriptions. |
| 135 // The pointed vector will be cleared. |
| 136 // Returns: |
| 137 // true if successful. Reasons for failure are: |
| 138 // - invalid effect_id, |
| 139 // - not enough memory in the shm_allocator_. |
| 140 bool GetEffectStreams(ResourceID effect_id, |
| 141 std::vector<EffectStreamDesc> *descs); |
| 142 |
| 122 private: | 143 private: |
| 123 CommandBufferHelper *helper_; | 144 CommandBufferHelper *helper_; |
| 124 FencedAllocatorWrapper *shm_allocator_; | 145 FencedAllocatorWrapper *shm_allocator_; |
| 125 unsigned int shm_id_; | 146 unsigned int shm_id_; |
| 126 IdAllocator *param_id_allocator_; | 147 IdAllocator *param_id_allocator_; |
| 127 | 148 |
| 128 DISALLOW_COPY_AND_ASSIGN(EffectHelper); | 149 DISALLOW_COPY_AND_ASSIGN(EffectHelper); |
| 129 }; | 150 }; |
| 130 | 151 |
| 131 } // namespace command_buffer | 152 } // namespace command_buffer |
| 132 } // namespace o3d | 153 } // namespace o3d |
| 133 | 154 |
| 134 #endif // O3D_COMMAND_BUFFER_CLIENT_CROSS_EFFECT_HELPER_H_ | 155 #endif // O3D_COMMAND_BUFFER_CLIENT_CROSS_EFFECT_HELPER_H_ |
| OLD | NEW |