libobs/graphics: Add ability to set shader texture sampler
(Note: This also modifies libobs-d3d11 and libobs-opengl) Allows overriding the sampler for a specific shader parameter.
This commit is contained in:
@@ -222,10 +222,18 @@ inline void gs_shader::UpdateParam(vector<uint8_t> &constData,
|
||||
upload = true;
|
||||
param.changed = false;
|
||||
}
|
||||
|
||||
} else if (param.curValue.size() == sizeof(gs_texture_t*)) {
|
||||
gs_texture_t *tex;
|
||||
memcpy(&tex, param.curValue.data(), sizeof(gs_texture_t*));
|
||||
device_load_texture(device, tex, param.textureID);
|
||||
|
||||
if (param.nextSampler) {
|
||||
ID3D11SamplerState *state = param.nextSampler->state;
|
||||
device->context->PSSetSamplers(param.textureID, 1,
|
||||
&state);
|
||||
param.nextSampler = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,3 +392,8 @@ void gs_shader_set_default(gs_sparam_t *param)
|
||||
shader_setval_inline(param, param->defaultValue.data(),
|
||||
param->defaultValue.size());
|
||||
}
|
||||
|
||||
void gs_shader_set_next_sampler(gs_sparam_t *param, gs_samplerstate_t *sampler)
|
||||
{
|
||||
param->nextSampler = sampler;
|
||||
}
|
||||
|
Reference in New Issue
Block a user