mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 11:38:05 +02:00
r600/sfn: Unify semantic name and index query and use TEXCOORD semantic
Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Reviewed-by: Reviewed-by: Dave Airlie <airlied@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5085>
This commit is contained in:
parent
667126cc82
commit
65d8c692bd
6 changed files with 43 additions and 20 deletions
|
|
@ -256,6 +256,8 @@ void ShaderFromNirProcessor::evaluate_spi_sid(r600_shader_io& io)
|
|||
io.spi_sid = 0;
|
||||
break;
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
case TGSI_SEMANTIC_TEXCOORD:
|
||||
case TGSI_SEMANTIC_PCOORD:
|
||||
io.spi_sid = io.sid + 1;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -66,22 +66,15 @@ bool FragmentShaderFromNir::do_process_inputs(nir_variable *input)
|
|||
<< " interpolation:" << input->data.interpolation
|
||||
<< "\n";
|
||||
|
||||
unsigned name, sid;
|
||||
|
||||
if (input->data.location == VARYING_SLOT_FACE) {
|
||||
m_sv_values.set(es_face);
|
||||
return true;
|
||||
}
|
||||
|
||||
tgsi_get_gl_varying_semantic(static_cast<gl_varying_slot>(input->data.location),
|
||||
true, &name, &sid);
|
||||
|
||||
/* Work around the mixed tgsi/nir semantic problems, this fixes
|
||||
* dEQP-GLES2.functional.shaders.builtin_variable.pointcoord */
|
||||
if (input->data.location == VARYING_SLOT_PNTC) {
|
||||
name = TGSI_SEMANTIC_GENERIC;
|
||||
sid = 8;
|
||||
}
|
||||
unsigned name, sid;
|
||||
auto semantic = r600_get_varying_semantic(input->data.location);
|
||||
name = semantic.first;
|
||||
sid = semantic.second;
|
||||
|
||||
tgsi_semantic sname = static_cast<tgsi_semantic>(name);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "tgsi/tgsi_from_mesa.h"
|
||||
#include "sfn_shader_geometry.h"
|
||||
#include "sfn_instruction_misc.h"
|
||||
#include "sfn_instruction_fetch.h"
|
||||
#include "sfn_shaderio.h"
|
||||
|
||||
namespace r600 {
|
||||
|
||||
|
|
@ -95,8 +95,10 @@ bool GeometryShaderFromNir::do_process_inputs(nir_variable *input)
|
|||
input->data.location <= VARYING_SLOT_TEX7)) {
|
||||
|
||||
r600_shader_io& io = sh_info().input[input->data.driver_location];
|
||||
tgsi_get_gl_varying_semantic(static_cast<gl_varying_slot>( input->data.location),
|
||||
true, &io.name, &io.sid);
|
||||
auto semantic = r600_get_varying_semantic(input->data.location);
|
||||
io.name = semantic.first;
|
||||
io.sid = semantic.second;
|
||||
|
||||
io.ring_offset = 16 * input->data.driver_location;
|
||||
++sh_info().ninput;
|
||||
m_next_input_ring_offset += 16;
|
||||
|
|
@ -127,8 +129,10 @@ bool GeometryShaderFromNir::do_process_outputs(nir_variable *output)
|
|||
output->data.location == VARYING_SLOT_FOGC) {
|
||||
r600_shader_io& io = sh_info().output[output->data.driver_location];
|
||||
|
||||
tgsi_get_gl_varying_semantic(static_cast<gl_varying_slot>( output->data.location),
|
||||
true, &io.name, &io.sid);
|
||||
auto semantic = r600_get_varying_semantic(output->data.location);
|
||||
io.name = semantic.first;
|
||||
io.sid = semantic.second;
|
||||
|
||||
evaluate_spi_sid(io);
|
||||
++sh_info().noutput;
|
||||
|
||||
|
|
|
|||
|
|
@ -196,6 +196,8 @@ void ShaderInputVarying::evaluate_spi_sid()
|
|||
assert(0 && "System value used as varying");
|
||||
break;
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
case TGSI_SEMANTIC_TEXCOORD:
|
||||
case TGSI_SEMANTIC_PCOORD:
|
||||
m_spi_sid = m_sid + 1;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -380,5 +382,22 @@ void ShaderIO::set_two_sided()
|
|||
m_two_sided = true;
|
||||
}
|
||||
|
||||
std::pair<unsigned, unsigned>
|
||||
r600_get_varying_semantic(unsigned varying_location)
|
||||
{
|
||||
std::pair<unsigned, unsigned> result;
|
||||
tgsi_get_gl_varying_semantic(static_cast<gl_varying_slot>(varying_location),
|
||||
true, &result.first, &result.second);
|
||||
|
||||
if (result.first == TGSI_SEMANTIC_GENERIC) {
|
||||
result.second += 9;
|
||||
} else if (result.first == TGSI_SEMANTIC_PCOORD) {
|
||||
result.second = 8;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -161,6 +161,10 @@ private:
|
|||
|
||||
};
|
||||
|
||||
std::pair<unsigned, unsigned>
|
||||
r600_get_varying_semantic(unsigned varying_location);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // SFN_SHADERIO_H
|
||||
#endif // SFN_SHADERIO_H
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#include "sfn_vertexstageexport.h"
|
||||
|
||||
#include "tgsi/tgsi_from_mesa.h"
|
||||
#include "sfn_shaderio.h"
|
||||
|
||||
namespace r600 {
|
||||
|
||||
|
|
@ -70,8 +70,9 @@ bool VertexStageExportBase::do_process_outputs(nir_variable *output)
|
|||
) {
|
||||
|
||||
r600_shader_io& io = m_proc.sh_info().output[output->data.driver_location];
|
||||
tgsi_get_gl_varying_semantic(static_cast<gl_varying_slot>( output->data.location),
|
||||
true, &io.name, &io.sid);
|
||||
auto semantic = r600_get_varying_semantic(output->data.location);
|
||||
io.name = semantic.first;
|
||||
io.sid = semantic.second;
|
||||
|
||||
m_proc.evaluate_spi_sid(io);
|
||||
io.write_mask = ((1 << glsl_get_components(output->type)) - 1)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue