gets shader constants from a compute program * Returns a table of all the shader constants in the compute program. * * @name compute.get_constants * * @param path [type:hash|string] The path to the resource * @return table [type:table] A table of tables, where each entry contains info about the shader constants: * * `name` * : [type:hash] the hashed nam
| 197 | * ``` |
| 198 | */ |
| 199 | static int Compute_GetConstants(lua_State* L) |
| 200 | { |
| 201 | DM_LUA_STACK_CHECK(L, 1); |
| 202 | |
| 203 | ComputeResource* compute_res = CheckComputeResource(L, 1); |
| 204 | |
| 205 | lua_newtable(L); |
| 206 | |
| 207 | uint32_t constant_index = 1; |
| 208 | |
| 209 | uint32_t constant_count = dmRender::GetComputeProgramConstantCount(compute_res->m_Program); |
| 210 | for (int i = 0; i < constant_count; ++i) |
| 211 | { |
| 212 | dmhash_t name_hash; |
| 213 | dmRender::GetComputeProgramConstantNameHash(compute_res->m_Program, i, &name_hash); |
| 214 | |
| 215 | dmRender::HConstant constant; |
| 216 | |
| 217 | if (dmRender::GetComputeProgramConstant(compute_res->m_Program, name_hash, constant)) |
| 218 | { |
| 219 | lua_pushinteger(L, (lua_Integer) constant_index++); |
| 220 | lua_newtable(L); |
| 221 | |
| 222 | PushRenderConstant(L, constant); |
| 223 | |
| 224 | lua_rawset(L, -3); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | return 1; |
| 229 | } |
| 230 | |
| 231 | /*# gets textures associated with a compute program |
| 232 | * Returns a table of all the textures from the compute program. |
nothing calls this directly
no test coverage detected