mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-29 01:30:08 +01:00
svga: remove support for shader model 2.0
We've been requiring SM 3.0 all along so this just removes unused code. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
396ac41fc2
commit
94b219b9e2
9 changed files with 25 additions and 374 deletions
|
|
@ -37,7 +37,6 @@ C_SOURCES := \
|
|||
svga_swtnl_draw.c \
|
||||
svga_swtnl_state.c \
|
||||
svga_tgsi.c \
|
||||
svga_tgsi_decl_sm20.c \
|
||||
svga_tgsi_decl_sm30.c \
|
||||
svga_tgsi_insn.c \
|
||||
svga_sampler_view.c \
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
#include "util/u_bitmask.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
|
||||
#include "svga_screen.h"
|
||||
#include "svga_context.h"
|
||||
#include "svga_tgsi.h"
|
||||
#include "svga_hw_reg.h"
|
||||
|
|
@ -46,7 +45,6 @@ svga_create_fs_state(struct pipe_context *pipe,
|
|||
const struct pipe_shader_state *templ)
|
||||
{
|
||||
struct svga_context *svga = svga_context(pipe);
|
||||
struct svga_screen *svgascreen = svga_screen(pipe->screen);
|
||||
struct svga_fragment_shader *fs;
|
||||
|
||||
fs = CALLOC_STRUCT(svga_fragment_shader);
|
||||
|
|
@ -60,7 +58,6 @@ svga_create_fs_state(struct pipe_context *pipe,
|
|||
tgsi_scan_shader(fs->base.tokens, &fs->base.info);
|
||||
|
||||
fs->base.id = svga->debug.shader_id++;
|
||||
fs->base.use_sm30 = svgascreen->use_ps30;
|
||||
|
||||
if (SVGA_DEBUG & DEBUG_TGSI || 0) {
|
||||
debug_printf("%s id: %u, inputs: %u, outputs: %u\n",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
#include "tgsi/tgsi_parse.h"
|
||||
#include "tgsi/tgsi_text.h"
|
||||
|
||||
#include "svga_screen.h"
|
||||
#include "svga_context.h"
|
||||
#include "svga_tgsi.h"
|
||||
#include "svga_hw_reg.h"
|
||||
|
|
@ -101,7 +100,6 @@ svga_create_vs_state(struct pipe_context *pipe,
|
|||
const struct pipe_shader_state *templ)
|
||||
{
|
||||
struct svga_context *svga = svga_context(pipe);
|
||||
struct svga_screen *svgascreen = svga_screen(pipe->screen);
|
||||
struct svga_vertex_shader *vs = CALLOC_STRUCT(svga_vertex_shader);
|
||||
if (!vs)
|
||||
return NULL;
|
||||
|
|
@ -126,7 +124,6 @@ svga_create_vs_state(struct pipe_context *pipe,
|
|||
}
|
||||
|
||||
vs->base.id = svga->debug.shader_id++;
|
||||
vs->base.use_sm30 = svgascreen->use_vs30;
|
||||
|
||||
if (SVGA_DEBUG & DEBUG_TGSI || 0) {
|
||||
debug_printf("%s id: %u, inputs: %u, outputs: %u\n",
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
|
|||
case PIPE_CAP_TWO_SIDED_STENCIL:
|
||||
return 1;
|
||||
case PIPE_CAP_GLSL:
|
||||
return svgascreen->use_ps30 && svgascreen->use_vs30;
|
||||
return 1;
|
||||
case PIPE_CAP_ANISOTROPIC_FILTER:
|
||||
return 1;
|
||||
case PIPE_CAP_POINT_SPRITE:
|
||||
|
|
@ -220,18 +220,18 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
|
|||
case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
|
||||
case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
|
||||
case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
|
||||
return svgascreen->use_ps30 ? 512 : 96;
|
||||
return 512;
|
||||
case PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH:
|
||||
return SVGA3D_MAX_NESTING_LEVEL;
|
||||
case PIPE_SHADER_CAP_MAX_INPUTS:
|
||||
return 10;
|
||||
case PIPE_SHADER_CAP_MAX_CONSTS:
|
||||
return svgascreen->use_ps30 ? 224 : 16;
|
||||
return 224;
|
||||
case PIPE_SHADER_CAP_MAX_CONST_BUFFERS:
|
||||
return 1;
|
||||
case PIPE_SHADER_CAP_MAX_TEMPS:
|
||||
if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS, &result))
|
||||
return svgascreen->use_ps30 ? 32 : 12;
|
||||
return 32;
|
||||
return result.u;
|
||||
case PIPE_SHADER_CAP_MAX_ADDRS:
|
||||
case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR:
|
||||
|
|
@ -243,7 +243,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
|
|||
*/
|
||||
return 0;
|
||||
case PIPE_SHADER_CAP_MAX_PREDS:
|
||||
return svgascreen->use_ps30 ? 1 : 0;
|
||||
return 1;
|
||||
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
|
||||
return 1;
|
||||
case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR:
|
||||
|
|
@ -264,7 +264,7 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
|
|||
case PIPE_SHADER_CAP_MAX_INSTRUCTIONS:
|
||||
case PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS:
|
||||
if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS, &result))
|
||||
return svgascreen->use_vs30 ? 512 : 256;
|
||||
return 512;
|
||||
return result.u;
|
||||
case PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS:
|
||||
case PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS:
|
||||
|
|
@ -280,17 +280,17 @@ static int svga_get_shader_param(struct pipe_screen *screen, unsigned shader, en
|
|||
return 1;
|
||||
case PIPE_SHADER_CAP_MAX_TEMPS:
|
||||
if (!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS, &result))
|
||||
return svgascreen->use_vs30 ? 32 : 12;
|
||||
return 32;
|
||||
return result.u;
|
||||
case PIPE_SHADER_CAP_MAX_ADDRS:
|
||||
return svgascreen->use_vs30 ? 1 : 0;
|
||||
return 1;
|
||||
case PIPE_SHADER_CAP_MAX_PREDS:
|
||||
return svgascreen->use_vs30 ? 1 : 0;
|
||||
return 1;
|
||||
case PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED:
|
||||
return 1;
|
||||
case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR:
|
||||
case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR:
|
||||
return svgascreen->use_vs30 ? 1 : 0;
|
||||
return 1;
|
||||
case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR:
|
||||
return 0;
|
||||
case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
|
||||
|
|
@ -436,6 +436,7 @@ svga_screen_create(struct svga_winsys_screen *sws)
|
|||
struct svga_screen *svgascreen;
|
||||
struct pipe_screen *screen;
|
||||
SVGA3dDevCapResult result;
|
||||
boolean use_vs30, use_ps30;
|
||||
|
||||
#ifdef DEBUG
|
||||
SVGA_DEBUG = debug_get_flags_option("SVGA_DEBUG", svga_debug_flags, 0 );
|
||||
|
|
@ -479,14 +480,18 @@ svga_screen_create(struct svga_winsys_screen *sws)
|
|||
svgascreen->hw_version = SVGA3D_HWVERSION_WS65_B1;
|
||||
}
|
||||
|
||||
svgascreen->use_ps30 =
|
||||
use_ps30 =
|
||||
sws->get_cap(sws, SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION, &result) &&
|
||||
result.u >= SVGA3DPSVERSION_30 ? TRUE : FALSE;
|
||||
|
||||
svgascreen->use_vs30 =
|
||||
use_vs30 =
|
||||
sws->get_cap(sws, SVGA3D_DEVCAP_VERTEX_SHADER_VERSION, &result) &&
|
||||
result.u >= SVGA3DVSVERSION_30 ? TRUE : FALSE;
|
||||
|
||||
/* we require Shader model 3.0 or later */
|
||||
if (!use_ps30 || !use_vs30)
|
||||
goto error2;
|
||||
|
||||
/*
|
||||
* The D16, D24X8, and D24S8 formats always do an implicit shadow compare
|
||||
* when sampled from, where as the DF16, DF24, and D24S8_INT do not. So
|
||||
|
|
@ -532,15 +537,6 @@ svga_screen_create(struct svga_winsys_screen *sws)
|
|||
}
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* Shader model 2.0 is unsupported at the moment. */
|
||||
if(!svgascreen->use_ps30 || !svgascreen->use_vs30)
|
||||
goto error2;
|
||||
#else
|
||||
if(debug_get_bool_option("SVGA_NO_SM30", FALSE))
|
||||
svgascreen->use_vs30 = svgascreen->use_ps30 = FALSE;
|
||||
#endif
|
||||
|
||||
pipe_mutex_init(svgascreen->tex_mutex);
|
||||
pipe_mutex_init(svgascreen->swc_mutex);
|
||||
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ struct svga_screen
|
|||
|
||||
SVGA3dHardwareVersion hw_version;
|
||||
|
||||
unsigned use_ps30;
|
||||
unsigned use_vs30;
|
||||
|
||||
struct {
|
||||
boolean force_level_surface_view;
|
||||
boolean force_surface_view;
|
||||
|
|
|
|||
|
|
@ -136,8 +136,6 @@ boolean svga_shader_emit_opcode( struct svga_shader_emitter *emit,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#define SVGA3D_PS_2X (SVGA3D_PS_20 | 1)
|
||||
#define SVGA3D_VS_2X (SVGA3D_VS_20 | 1)
|
||||
|
||||
static boolean svga_shader_emit_header( struct svga_shader_emitter *emit )
|
||||
{
|
||||
|
|
@ -147,10 +145,10 @@ static boolean svga_shader_emit_header( struct svga_shader_emitter *emit )
|
|||
|
||||
switch (emit->unit) {
|
||||
case PIPE_SHADER_FRAGMENT:
|
||||
header.value = emit->use_sm30 ? SVGA3D_PS_30 : SVGA3D_PS_2X;
|
||||
header.value = SVGA3D_PS_30;
|
||||
break;
|
||||
case PIPE_SHADER_VERTEX:
|
||||
header.value = emit->use_sm30 ? SVGA3D_VS_30 : SVGA3D_VS_2X;
|
||||
header.value = SVGA3D_VS_30;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +176,6 @@ svga_tgsi_translate( const struct svga_shader *shader,
|
|||
|
||||
memset(&emit, 0, sizeof(emit));
|
||||
|
||||
emit.use_sm30 = shader->use_sm30;
|
||||
emit.size = 1024;
|
||||
emit.buf = MALLOC(emit.size);
|
||||
if (emit.buf == NULL) {
|
||||
|
|
|
|||
|
|
@ -1,277 +0,0 @@
|
|||
/**********************************************************
|
||||
* Copyright 2008-2009 VMware, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
**********************************************************/
|
||||
|
||||
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "svga_tgsi_emit.h"
|
||||
|
||||
|
||||
static boolean ps20_input( struct svga_shader_emitter *emit,
|
||||
struct tgsi_declaration_semantic semantic,
|
||||
unsigned idx )
|
||||
{
|
||||
struct src_register reg;
|
||||
SVGA3DOpDclArgs dcl;
|
||||
SVGA3dShaderInstToken opcode;
|
||||
|
||||
opcode = inst_token( SVGA3DOP_DCL );
|
||||
dcl.values[0] = 0;
|
||||
dcl.values[1] = 0;
|
||||
|
||||
switch (semantic.Name) {
|
||||
case TGSI_SEMANTIC_POSITION:
|
||||
/* Special case:
|
||||
*/
|
||||
reg = src_register( SVGA3DREG_MISCTYPE,
|
||||
SVGA3DMISCREG_POSITION );
|
||||
break;
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
reg = src_register( SVGA3DREG_INPUT,
|
||||
semantic.Index );
|
||||
break;
|
||||
case TGSI_SEMANTIC_FOG:
|
||||
assert(semantic.Index == 0);
|
||||
reg = src_register( SVGA3DREG_TEXTURE, 0 );
|
||||
break;
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
reg = src_register( SVGA3DREG_TEXTURE,
|
||||
semantic.Index + 1 );
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
emit->input_map[idx] = reg;
|
||||
|
||||
dcl.dst = dst( reg );
|
||||
|
||||
dcl.usage = 0;
|
||||
dcl.index = 0;
|
||||
|
||||
dcl.values[0] |= 1<<31;
|
||||
|
||||
return (emit_instruction(emit, opcode) &&
|
||||
svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
|
||||
}
|
||||
|
||||
|
||||
static boolean ps20_output( struct svga_shader_emitter *emit,
|
||||
struct tgsi_declaration_semantic semantic,
|
||||
unsigned idx )
|
||||
{
|
||||
SVGA3dShaderDestToken reg;
|
||||
|
||||
switch (semantic.Name) {
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
if (semantic.Index < PIPE_MAX_COLOR_BUFS) {
|
||||
unsigned cbuf = semantic.Index;
|
||||
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
|
||||
emit->nr_hw_temp++ );
|
||||
emit->temp_col[cbuf] = emit->output_map[idx];
|
||||
emit->true_col[cbuf] = dst_register( SVGA3DREG_COLOROUT,
|
||||
semantic.Index );
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
reg = dst_register( SVGA3DREG_COLOROUT, 0 );
|
||||
}
|
||||
break;
|
||||
case TGSI_SEMANTIC_POSITION:
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
|
||||
emit->nr_hw_temp++ );
|
||||
emit->temp_pos = emit->output_map[idx];
|
||||
emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT,
|
||||
semantic.Index );
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
reg = dst_register( SVGA3DREG_COLOROUT, 0 );
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static boolean vs20_input( struct svga_shader_emitter *emit,
|
||||
struct tgsi_declaration_semantic semantic,
|
||||
unsigned idx )
|
||||
{
|
||||
SVGA3DOpDclArgs dcl;
|
||||
SVGA3dShaderInstToken opcode;
|
||||
|
||||
opcode = inst_token( SVGA3DOP_DCL );
|
||||
dcl.values[0] = 0;
|
||||
dcl.values[1] = 0;
|
||||
|
||||
emit->input_map[idx] = src_register( SVGA3DREG_INPUT, idx );
|
||||
dcl.dst = dst_register( SVGA3DREG_INPUT, idx );
|
||||
|
||||
assert(dcl.dst.reserved0);
|
||||
|
||||
/* Mesa doesn't provide use with VS input semantics (they're
|
||||
* actually pretty meaningless), so we just generate some plausible
|
||||
* ones here. This has to match what we declare in the vdecl code
|
||||
* in svga_pipe_vertex.c.
|
||||
*/
|
||||
if (idx == 0) {
|
||||
dcl.usage = SVGA3D_DECLUSAGE_POSITION;
|
||||
dcl.index = 0;
|
||||
}
|
||||
else {
|
||||
dcl.usage = SVGA3D_DECLUSAGE_TEXCOORD;
|
||||
dcl.index = idx - 1;
|
||||
}
|
||||
|
||||
dcl.values[0] |= 1<<31;
|
||||
|
||||
return (emit_instruction(emit, opcode) &&
|
||||
svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
|
||||
}
|
||||
|
||||
|
||||
static boolean vs20_output( struct svga_shader_emitter *emit,
|
||||
struct tgsi_declaration_semantic semantic,
|
||||
unsigned idx )
|
||||
{
|
||||
/* Don't emit dcl instruction for vs20 inputs
|
||||
*/
|
||||
|
||||
/* Just build the register map table:
|
||||
*/
|
||||
switch (semantic.Name) {
|
||||
case TGSI_SEMANTIC_POSITION:
|
||||
assert(semantic.Index == 0);
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
|
||||
emit->nr_hw_temp++ );
|
||||
emit->temp_pos = emit->output_map[idx];
|
||||
emit->true_pos = dst_register( SVGA3DREG_RASTOUT,
|
||||
SVGA3DRASTOUT_POSITION);
|
||||
break;
|
||||
case TGSI_SEMANTIC_PSIZE:
|
||||
assert(semantic.Index == 0);
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_TEMP,
|
||||
emit->nr_hw_temp++ );
|
||||
emit->temp_psiz = emit->output_map[idx];
|
||||
emit->true_psiz = dst_register( SVGA3DREG_RASTOUT,
|
||||
SVGA3DRASTOUT_PSIZE );
|
||||
break;
|
||||
case TGSI_SEMANTIC_FOG:
|
||||
assert(semantic.Index == 0);
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT, 0 );
|
||||
break;
|
||||
case TGSI_SEMANTIC_COLOR:
|
||||
/* oD0 */
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_ATTROUT,
|
||||
semantic.Index );
|
||||
break;
|
||||
case TGSI_SEMANTIC_GENERIC:
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT,
|
||||
semantic.Index + 1 );
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, 0 );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static boolean ps20_sampler( struct svga_shader_emitter *emit,
|
||||
struct tgsi_declaration_semantic semantic,
|
||||
unsigned idx )
|
||||
{
|
||||
SVGA3DOpDclArgs dcl;
|
||||
SVGA3dShaderInstToken opcode;
|
||||
|
||||
opcode = inst_token( SVGA3DOP_DCL );
|
||||
dcl.values[0] = 0;
|
||||
dcl.values[1] = 0;
|
||||
|
||||
dcl.dst = dst_register( SVGA3DREG_SAMPLER, idx );
|
||||
dcl.type = svga_tgsi_sampler_type( emit, idx );
|
||||
|
||||
return (emit_instruction(emit, opcode) &&
|
||||
svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values)));
|
||||
}
|
||||
|
||||
|
||||
boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit,
|
||||
const struct tgsi_full_declaration *decl )
|
||||
{
|
||||
unsigned first = decl->Range.First;
|
||||
unsigned last = decl->Range.Last;
|
||||
unsigned semantic = 0;
|
||||
unsigned semantic_idx = 0;
|
||||
unsigned idx;
|
||||
|
||||
if (decl->Declaration.Semantic) {
|
||||
semantic = decl->Semantic.Name;
|
||||
semantic_idx = decl->Semantic.Index;
|
||||
}
|
||||
|
||||
for( idx = first; idx <= last; idx++ ) {
|
||||
boolean ok;
|
||||
|
||||
switch (decl->Declaration.File) {
|
||||
case TGSI_FILE_SAMPLER:
|
||||
assert (emit->unit == PIPE_SHADER_FRAGMENT);
|
||||
ok = ps20_sampler( emit, decl->Semantic, idx );
|
||||
break;
|
||||
|
||||
case TGSI_FILE_INPUT:
|
||||
if (emit->unit == PIPE_SHADER_VERTEX)
|
||||
ok = vs20_input( emit, decl->Semantic, idx );
|
||||
else
|
||||
ok = ps20_input( emit, decl->Semantic, idx );
|
||||
break;
|
||||
|
||||
case TGSI_FILE_OUTPUT:
|
||||
if (emit->unit == PIPE_SHADER_VERTEX)
|
||||
ok = vs20_output( emit, decl->Semantic, idx );
|
||||
else
|
||||
ok = ps20_output( emit, decl->Semantic, idx );
|
||||
break;
|
||||
|
||||
default:
|
||||
/* don't need to declare other vars */
|
||||
ok = TRUE;
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -50,8 +50,6 @@ struct svga_arl_consts {
|
|||
|
||||
struct svga_shader_emitter
|
||||
{
|
||||
boolean use_sm30;
|
||||
|
||||
unsigned size;
|
||||
char *buf;
|
||||
char *ptr;
|
||||
|
|
@ -147,9 +145,6 @@ boolean svga_shader_emit_opcode( struct svga_shader_emitter *emit,
|
|||
boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit,
|
||||
const struct tgsi_token *tokens );
|
||||
|
||||
boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit,
|
||||
const struct tgsi_full_declaration *decl );
|
||||
|
||||
boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit,
|
||||
const struct tgsi_full_declaration *decl );
|
||||
|
||||
|
|
|
|||
|
|
@ -1083,16 +1083,8 @@ static boolean do_emit_sincos(struct svga_shader_emitter *emit,
|
|||
{
|
||||
src0 = scalar(src0, TGSI_SWIZZLE_X);
|
||||
|
||||
if (emit->use_sm30) {
|
||||
return submit_op1( emit, inst_token( SVGA3DOP_SINCOS ),
|
||||
dst, src0 );
|
||||
} else {
|
||||
struct src_register const1 = get_sincos_const( emit, 0 );
|
||||
struct src_register const2 = get_sincos_const( emit, 1 );
|
||||
|
||||
return submit_op3( emit, inst_token( SVGA3DOP_SINCOS ),
|
||||
dst, src0, const1, const2 );
|
||||
}
|
||||
return submit_op1( emit, inst_token( SVGA3DOP_SINCOS ),
|
||||
dst, src0 );
|
||||
}
|
||||
|
||||
static boolean emit_sincos(struct svga_shader_emitter *emit,
|
||||
|
|
@ -1646,9 +1638,7 @@ static boolean emit_tex(struct svga_shader_emitter *emit,
|
|||
/* If doing compare processing or tex swizzle, need to put fetched color into
|
||||
* a temporary so it can be used as a source later on.
|
||||
*/
|
||||
if (compare ||
|
||||
swizzle ||
|
||||
(!emit->use_sm30 && dst.mask != TGSI_WRITEMASK_XYZW) ) {
|
||||
if (compare || swizzle) {
|
||||
tex_result = get_temp( emit );
|
||||
}
|
||||
else {
|
||||
|
|
@ -1737,17 +1727,6 @@ static boolean emit_tex(struct svga_shader_emitter *emit,
|
|||
emit->key.fkey.tex[unit].swizzle_a);
|
||||
}
|
||||
|
||||
if (!emit->use_sm30 &&
|
||||
dst.mask != TGSI_WRITEMASK_XYZW &&
|
||||
!compare &&
|
||||
!swizzle) {
|
||||
/* pre SM3.0 a TEX instruction can't have a writemask. Do it as a
|
||||
* separate step here.
|
||||
*/
|
||||
if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src(tex_result) ))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2683,25 +2662,7 @@ static boolean emit_vs_preamble( struct svga_shader_emitter *emit )
|
|||
|
||||
static boolean emit_ps_preamble( struct svga_shader_emitter *emit )
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* For SM20, need to initialize the temporaries we're using to hold
|
||||
* color outputs to some value. Shaders which don't set all of
|
||||
* these values are likely to be rejected by the DX9 runtime.
|
||||
*/
|
||||
if (!emit->use_sm30) {
|
||||
struct src_register zero = get_zero_immediate( emit );
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
if (SVGA3dShaderGetRegType(emit->true_col[i].value) != 0) {
|
||||
|
||||
if (!submit_op1( emit,
|
||||
inst_token(SVGA3DOP_MOV),
|
||||
emit->temp_col[i],
|
||||
zero ))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
} else if (emit->ps_reads_pos && emit->info.reads_z) {
|
||||
if (emit->ps_reads_pos && emit->info.reads_z) {
|
||||
/*
|
||||
* Assemble the position from various bits of inputs. Depth and W are
|
||||
* passed in a texcoord this is due to D3D's vPos not hold Z or W.
|
||||
|
|
@ -2752,9 +2713,6 @@ static boolean emit_ps_postamble( struct svga_shader_emitter *emit )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Similarly for SM20 color outputs... Luckily SM30 isn't so
|
||||
* fragile.
|
||||
*/
|
||||
for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) {
|
||||
if (SVGA3dShaderGetRegType(emit->true_col[i].value) != 0) {
|
||||
|
||||
|
|
@ -3050,9 +3008,6 @@ needs_to_create_zero( struct svga_shader_emitter *emit )
|
|||
int i;
|
||||
|
||||
if (emit->unit == PIPE_SHADER_FRAGMENT) {
|
||||
if (!emit->use_sm30)
|
||||
return TRUE;
|
||||
|
||||
if (emit->key.fkey.light_twoside)
|
||||
return TRUE;
|
||||
|
||||
|
|
@ -3118,9 +3073,7 @@ needs_to_create_loop_const( struct svga_shader_emitter *emit )
|
|||
static INLINE boolean
|
||||
needs_to_create_sincos_consts( struct svga_shader_emitter *emit )
|
||||
{
|
||||
return !emit->use_sm30 && (emit->info.opcode_count[TGSI_OPCODE_SIN] >= 1 ||
|
||||
emit->info.opcode_count[TGSI_OPCODE_COS] >= 1 ||
|
||||
emit->info.opcode_count[TGSI_OPCODE_SCS] >= 1);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static INLINE boolean
|
||||
|
|
@ -3282,10 +3235,7 @@ boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit,
|
|||
break;
|
||||
|
||||
case TGSI_TOKEN_TYPE_DECLARATION:
|
||||
if (emit->use_sm30)
|
||||
ret = svga_translate_decl_sm30( emit, &parse.FullToken.FullDeclaration );
|
||||
else
|
||||
ret = svga_translate_decl_sm20( emit, &parse.FullToken.FullDeclaration );
|
||||
ret = svga_translate_decl_sm30( emit, &parse.FullToken.FullDeclaration );
|
||||
if (!ret)
|
||||
goto done;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue