summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_lower_texture_gradients.cpp
Commit message (Collapse)AuthorAgeFilesLines
* glsl: move to compiler/Emil Velikov2016-01-261-2/+2
| | | | | | Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Matt Turner <mattst88@gmail.com> Acked-by: Jose Fonseca <jfonseca@vmware.com>
* i965: Use rcp in brw_lower_texture_gradients rather than 1.0 / x.Kenneth Graunke2016-01-051-1/+1
| | | | | | | | That's what it's for. Plus, we actually implement rcp. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* i965: fix textureGrad for cubemapsTapani Pälli2015-09-221-19/+182
| | | | | | | | | | | | | | | | | | | Fixes bugs exposed by commit 2b1cdb0eddb73f62e4848d4b64840067f1f70865 in: ES3-CTS.gtf.GL3Tests.shadow.shadow_execution_frag No regressions observed in deqp, CTS or Piglit. v2: address review feedback from Iago Toral: - move rho calculation to else branch - optimize dx and dy calculation - fix documentation inconsistensies Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com> Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91114 Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
* i965: Fix textureGrad with cube samplersIago Toral Quiroga2015-06-181-8/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't use sampler messages with gradient information (like sample_g or sample_d) to deal with this scenario because according to the PRM: "The r coordinate and its gradients are required only for surface types that use the third coordinate. Usage of this message type on cube surfaces assumes that the u, v, and gradients have already been transformed onto the appropriate face, but still in [-1,+1] range. The r coordinate contains the faceid, and the r gradients are ignored by hardware." Instead, we should lower this to compute the LOD manually based on the gradients and use a different sample message that takes the computed LOD instead of the gradients. This is already being done in brw_lower_texture_gradients.cpp, but it is restricted to shadow samplers only, although there is a comment stating that we should probably do this also for samplerCube and samplerCubeArray. Because of this, both dEQP and Piglit test cases for textureGrad with cube maps currently fail. This patch does two things: 1) Activates the texturegrad lowering pass for all cube samplers. 2) Corrects the computation of the LOD value for cube samplers. I had to do 2) because for cube maps the calculations implemented in the lowering pass always compute a value of rho that is twice the value we want (so we get a LOD value one unit larger than we want). This only happens for cube map samplers (all kinds). I am not sure about why we need to do this, but I suspect that it is related to the fact that cube map coordinates, when transported to a specific face in the cube, are in the range [-1, 1] instead of [0, 1] so we probably need to divide the derivatives by 2 when we compute the LOD. Doing that would produce the same result as dividing the final rho computation by 2 (or removing a unit from the computed LOD, which is what we are doing here). Fixes the following piglit tests: bin/tex-miplevel-selection textureGrad Cube -auto -fbo bin/tex-miplevel-selection textureGrad CubeArray -auto -fbo bin/tex-miplevel-selection textureGrad CubeShadow -auto -fbo Fixes 10 dEQP tests in the following category: dEQP-GLES3.functional.shaders.texture_functions.texturegrad.*cube* Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
* i965: Fix a crash in the texture gradient lowering pass with cube samplersIago Toral Quiroga2015-02-161-1/+3
| | | | | | | We need to swizzle the rhs to match the number of components in the writemask, otherwise we'll hit an assertion in ir_assignment. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* i965: Use unreachable() instead of unconditional assert().Matt Turner2014-07-011-2/+1
| | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* i965: Move intel_context::gen and gt fields to brw_context.Kenneth Graunke2013-07-091-2/+1
| | | | | | | | | | Most functions no longer use intel_context, so this patch additionally removes the local "intel" variables to avoid compiler warnings. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Chris Forbes <chrisf@ijw.co.nz> Acked-by: Paul Berry <stereotype441@gmail.com> Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
* i965: Move intel_context::is_<platform> flags to brw_context.Kenneth Graunke2013-07-091-1/+1
| | | | | | | Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Chris Forbes <chrisf@ijw.co.nz> Acked-by: Paul Berry <stereotype441@gmail.com> Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
* i965: Pass brw_context to functions rather than intel_context.Kenneth Graunke2013-07-091-1/+2
| | | | | | | | | | | | | | This makes brw_context available in every function that used intel_context. This makes it possible to start migrating fields from intel_context to brw_context. Surprisingly, this actually removes some code, as functions that use OUT_BATCH don't need to declare "intel"; they just use "brw." Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Chris Forbes <chrisf@ijw.co.nz> Acked-by: Paul Berry <stereotype441@gmail.com> Acked-by: Anuj Phogat <anuj.phogat@gmail.com>
* i965: Lower textureGrad() for samplerCubeShadow.Kenneth Graunke2013-05-011-3/+24
| | | | | | | | | | | | | | | | | | | | | | | According to the Ivybridge PRM, Volume 4 Part 1, page 130, in the section for the sample_d message: "The r coordinate contains the faceid, and the r gradients are ignored by hardware." This doesn't match GLSL, which provides gradients for all of the coordinates. So we would need to do some math to compute the face ID before using sample_d. We currently don't have any code to do that. However, we do have a lowering pass that converts textureGrad to textureLod, which solves this problem. Since textureGrad on three components is sufficiently obscure, it's not a performance path. For now, only handle samplerCubeShadow; we need tests for samplerCube and samplerCubeArray. Fixes es3conform's shadow_comparison_frag test on Haswell. NOTE: This is a candidate for stable branches. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
* i965: Shut up the last release build warning.Eric Anholt2013-04-121-0/+1
| | | | | | | I don't see a sensible value to use in this path, but we shouldn't ever hit this outside of developer new-texture-target enabling. Reviewed-by: Matt Turner <mattst88@gmail.com>
* i965: Lower textureGrad() with samplerCubeShadow on pre-Haswell.Kenneth Graunke2013-01-181-6/+9
| | | | | | | | | | | | | | | | | Fixes regressions since commit 899017fc54c40c969b5239b33f3a17b311878b0d Author: Kenneth Graunke <kenneth@whitecape.org> Date: Fri Jan 4 07:53:09 2013 -0800 i965: Use Haswell's sample_d_c for textureGrad with shadow samplers. That patch assumed that all instances were lowered. However, we weren't lowering textureGrad() with samplerCubeShadow because I couldn't figure out the LOD calculations. It turns out they're easy: you just have to use 1 for the depth. This causes it to pass oglconform's four tests. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Tested-by: Anuj Phogat <anuj.phogat@gmail.com> Tested-by: Ian Romanick <idr@freedesktop.org>
* i965: Add a lowering pass to convert TXD to TXL by computing the LOD.Kenneth Graunke2012-07-121-0/+154
Intel hardware doesn't natively support textureGrad with shadow comparisons. So we need to generate code to handle it somehow. Based on the equations of page 205 of the OpenGL 3.0 specification, it's possible to compute the LOD value that would be selected given the gradient values. Then, we can simply convert the TXD to a TXL. Currently, this passes 34/46 of oglconform's shadow-grad subtests; four cubemap tests are regressed. We should investigate this in the future. v2: Apply abs() to the scalar case (thanks to Eric). Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Eric Anholt <eric@anholt.net>