sets texture samplers in a compute program * Sets texture samplers in a compute program, if the samplers exist. Use this function to change the settings of texture samplers. * To set actual textures that should be bound to the samplers, use the `compute.set_textures` function instead. * * @name compute.set_samplers * * @param path [type:hash|string] The path to the re
| 367 | * ``` |
| 368 | */ |
| 369 | static int SetComputeSampler(lua_State* L, ComputeResource* compute_res, dmhash_t name_hash, int args_index) |
| 370 | { |
| 371 | args_index = args_index < 0 ? lua_gettop(L) + args_index + 1 : args_index; |
| 372 | |
| 373 | uint32_t unit = dmRender::GetComputeProgramSamplerUnit(compute_res->m_Program, name_hash); |
| 374 | if (unit == dmRender::INVALID_SAMPLER_UNIT) |
| 375 | { |
| 376 | return luaL_error(L, "Compute program sampler '%s' not found", dmHashReverseSafe64(name_hash)); |
| 377 | } |
| 378 | |
| 379 | dmRender::HSampler sampler = dmRender::GetComputeProgramSampler(compute_res->m_Program, unit); |
| 380 | |
| 381 | dmRender::SamplerInfo sampler_info = {}; |
| 382 | dmRender::GetSamplerInfo(sampler, &sampler_info); |
| 383 | |
| 384 | luaL_checktype(L, args_index, LUA_TTABLE); |
| 385 | lua_pushvalue(L, args_index); |
| 386 | |
| 387 | GetSamplerParametersFromLua(L, &sampler_info.m_UWrap, &sampler_info.m_VWrap, &sampler_info.m_MinFilter, &sampler_info.m_MagFilter, &sampler_info.m_MaxAnisotropy); |
| 388 | |
| 389 | lua_pop(L, 1); |
| 390 | |
| 391 | dmRender::SetComputeProgramSampler(compute_res->m_Program, name_hash, unit, sampler_info.m_UWrap, sampler_info.m_VWrap, sampler_info.m_MinFilter, sampler_info.m_MagFilter, sampler_info.m_MaxAnisotropy); |
| 392 | |
| 393 | return 0; |
| 394 | } |
| 395 | |
| 396 | static int Compute_SetSamplers(lua_State* L) |
| 397 | { |
no test coverage detected