On original gen4, the surface format didn't determine the return data
type from sampling like it does on g45 and later.
Fixes GL_EXT_texture_integer/texture_integer_glsl130
Reviewed-by: Paul Berry <stereotype441@gmail.com>
GLuint response_length,
GLuint msg_length,
GLuint header_present,
- GLuint simd_mode);
+ GLuint simd_mode,
+ GLuint return_format);
void brw_math_16( struct brw_compile *p,
struct brw_reg dest,
GLuint response_length,
GLuint msg_length,
GLuint header_present,
- GLuint simd_mode)
+ GLuint simd_mode,
+ GLuint return_format)
{
struct brw_context *brw = p->brw;
struct intel_context *intel = &brw->intel;
insn->bits3.sampler.binding_table_index = binding_table_index;
insn->bits3.sampler.sampler = sampler;
insn->bits3.sampler.msg_type = msg_type;
- insn->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_FLOAT32;
+ insn->bits3.sampler.return_format = return_format;
}
}
GLuint response_length,
GLuint msg_length,
GLuint header_present,
- GLuint simd_mode)
+ GLuint simd_mode,
+ GLuint return_format)
{
struct intel_context *intel = &p->brw->intel;
bool need_stall = 0;
response_length,
msg_length,
header_present,
- simd_mode);
+ simd_mode,
+ return_format);
}
if (need_stall) {
int msg_type = -1;
int rlen = 4;
uint32_t simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD8;
+ uint32_t return_format;
+
+ switch (dst.type) {
+ case BRW_REGISTER_TYPE_D:
+ return_format = BRW_SAMPLER_RETURN_FORMAT_SINT32;
+ break;
+ case BRW_REGISTER_TYPE_UD:
+ return_format = BRW_SAMPLER_RETURN_FORMAT_UINT32;
+ break;
+ default:
+ return_format = BRW_SAMPLER_RETURN_FORMAT_FLOAT32;
+ break;
+ }
if (c->dispatch_width == 16)
simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD16;
rlen,
inst->mlen,
inst->header_present,
- simd_mode);
+ simd_mode,
+ return_format);
}
response_length,
cur_mrf - 1,
1,
- simd_mode);
+ simd_mode,
+ BRW_SAMPLER_RETURN_FORMAT_FLOAT32);
}
response_length,
msgLength,
1,
- BRW_SAMPLER_SIMD_MODE_SIMD16);
+ BRW_SAMPLER_SIMD_MODE_SIMD16,
+ BRW_SAMPLER_RETURN_FORMAT_FLOAT32);
}