mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 04:30:10 +01:00
cell: Fix to work with commit fa9e7e9a8d
This commit is contained in:
parent
b12a28db96
commit
3115e8c968
3 changed files with 15 additions and 32 deletions
|
|
@ -37,13 +37,14 @@
|
|||
#include "cell_winsys.h"
|
||||
#include "cell/common.h"
|
||||
#include "rtasm/rtasm_ppc_spe.h"
|
||||
|
||||
#include "tgsi/util/tgsi_scan.h"
|
||||
|
||||
struct cell_vbuf_render;
|
||||
|
||||
struct cell_vertex_shader_state
|
||||
{
|
||||
struct pipe_shader_state shader;
|
||||
struct tgsi_shader_info info;
|
||||
void *draw_data;
|
||||
};
|
||||
|
||||
|
|
@ -51,6 +52,7 @@ struct cell_vertex_shader_state
|
|||
struct cell_fragment_shader_state
|
||||
{
|
||||
struct pipe_shader_state shader;
|
||||
struct tgsi_shader_info info;
|
||||
void *data;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@
|
|||
|
||||
|
||||
static int
|
||||
find_vs_output(const struct pipe_shader_state *vs,
|
||||
find_vs_output(const struct cell_vertex_shader_state *vs,
|
||||
uint semantic_name,
|
||||
uint semantic_index)
|
||||
{
|
||||
uint i;
|
||||
for (i = 0; i < vs->num_outputs; i++) {
|
||||
if (vs->output_semantic_name[i] == semantic_name &&
|
||||
vs->output_semantic_index[i] == semantic_index)
|
||||
for (i = 0; i < vs->info.num_outputs; i++) {
|
||||
if (vs->info.output_semantic_name[i] == semantic_name &&
|
||||
vs->info.output_semantic_index[i] == semantic_index)
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
|
@ -58,8 +58,8 @@ find_vs_output(const struct pipe_shader_state *vs,
|
|||
static void
|
||||
calculate_vertex_layout( struct cell_context *cell )
|
||||
{
|
||||
const struct pipe_shader_state *vs = &cell->vs->shader;
|
||||
const struct pipe_shader_state *fs = &cell->fs->shader;
|
||||
const struct cell_vertex_shader_state *vs = cell->vs;
|
||||
const struct cell_fragment_shader_state *fs = cell->fs;
|
||||
const enum interp_mode colorInterp
|
||||
= cell->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
|
||||
struct vertex_info *vinfo = &cell->vertex_info;
|
||||
|
|
@ -91,15 +91,15 @@ calculate_vertex_layout( struct cell_context *cell )
|
|||
* Loop over fragment shader inputs, searching for the matching output
|
||||
* from the vertex shader.
|
||||
*/
|
||||
for (i = 0; i < fs->num_inputs; i++) {
|
||||
switch (fs->input_semantic_name[i]) {
|
||||
for (i = 0; i < fs->info.num_inputs; i++) {
|
||||
switch (fs->info.input_semantic_name[i]) {
|
||||
case TGSI_SEMANTIC_POSITION:
|
||||
/* already done above */
|
||||
break;
|
||||
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
src = find_vs_output(vs, TGSI_SEMANTIC_COLOR,
|
||||
fs->input_semantic_index[i]);
|
||||
fs->info.input_semantic_index[i]);
|
||||
assert(src >= 0);
|
||||
draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
|
||||
break;
|
||||
|
|
@ -117,7 +117,7 @@ calculate_vertex_layout( struct cell_context *cell )
|
|||
case TGSI_SEMANTIC_GENERIC:
|
||||
/* this includes texcoords and varying vars */
|
||||
src = find_vs_output(vs, TGSI_SEMANTIC_GENERIC,
|
||||
fs->input_semantic_index[i]);
|
||||
fs->info.input_semantic_index[i]);
|
||||
assert(src >= 0);
|
||||
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -54,27 +54,7 @@ cell_create_fs_state(struct pipe_context *pipe,
|
|||
|
||||
state->shader = *templ;
|
||||
|
||||
#if 0
|
||||
if (cell->dump_fs) {
|
||||
tgsi_dump(state->shader.tokens, 0);
|
||||
}
|
||||
|
||||
#if defined(__i386__) || defined(__386__)
|
||||
if (cell->use_sse) {
|
||||
x86_init_func( &state->sse2_program );
|
||||
tgsi_emit_sse2_fs( state->shader.tokens, &state->sse2_program );
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MESA_LLVM
|
||||
state->llvm_prog = 0;
|
||||
if (!gallivm_global_cpu_engine()) {
|
||||
gallivm_cpu_engine_create(state->llvm_prog);
|
||||
}
|
||||
else
|
||||
gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog);
|
||||
#endif
|
||||
#endif
|
||||
tgsi_scan_shader(templ->tokens, &state->info);
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
@ -113,6 +93,7 @@ cell_create_vs_state(struct pipe_context *pipe,
|
|||
return NULL;
|
||||
|
||||
state->shader = *templ;
|
||||
tgsi_scan_shader(templ->tokens, &state->info);
|
||||
|
||||
state->draw_data = draw_create_vertex_shader(cell->draw, &state->shader);
|
||||
if (state->draw_data == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue