diff options
author | Brian Paul <[email protected]> | 2016-03-16 15:58:37 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-03-21 11:59:25 -0600 |
commit | 72eb5a3cfe29eabdd0a2386642b36f9648a911fc (patch) | |
tree | 7c3d6f5c17e7cc43959448cf34f4de1c3314ac55 /src | |
parent | eda81fa3571dac4b54c52134e9d198655f4561b0 (diff) |
st/mesa: emit sampler view declarations for ARB vert/frag programs
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Charmaine Lee <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 8a12ce4c685..7a686b199d5 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -297,6 +297,19 @@ st_translate_texture_target(GLuint textarget, GLboolean shadow) /** + * Translate a (1 << TEXTURE_x_INDEX) bit into a TGSI_TEXTURE_x enum. + */ +static unsigned +translate_texture_index(GLbitfield texBit, bool shadow) +{ + int index = ffs(texBit); + assert(index > 0); + assert(index - 1 < NUM_TEXTURE_TARGETS); + return st_translate_texture_target(index - 1, shadow); +} + + +/** * Create a TGSI ureg_dst register from a Mesa dest register. */ static struct ureg_dst @@ -1147,7 +1160,16 @@ st_translate_mesa_program( /* texture samplers */ for (i = 0; i < ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; i++) { if (program->SamplersUsed & (1 << i)) { + unsigned target = + translate_texture_index(program->TexturesUsed[i], + !!(program->ShadowSamplers & (1 << i))); t->samplers[i] = ureg_DECL_sampler( ureg, i ); + ureg_DECL_sampler_view(ureg, i, target, + TGSI_RETURN_TYPE_FLOAT, + TGSI_RETURN_TYPE_FLOAT, + TGSI_RETURN_TYPE_FLOAT, + TGSI_RETURN_TYPE_FLOAT); + } } |