projects
/
mesa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gallium: Add support for multiple viewports
[mesa.git]
/
src
/
gallium
/
drivers
/
svga
/
svga_swtnl_state.c
diff --git
a/src/gallium/drivers/svga/svga_swtnl_state.c
b/src/gallium/drivers/svga/svga_swtnl_state.c
index 25b8c2af3a0a3d5cffff9d74adf2dc7a86d78414..d744f18ee72fc3845a423ea49710448314a54047 100644
(file)
--- a/
src/gallium/drivers/svga/svga_swtnl_state.c
+++ b/
src/gallium/drivers/svga/svga_swtnl_state.c
@@
-25,32
+25,31
@@
#include "draw/draw_context.h"
#include "draw/draw_vbuf.h"
#include "draw/draw_context.h"
#include "draw/draw_vbuf.h"
-#include "
pipe/p
_inlines.h"
+#include "
util/u
_inlines.h"
#include "pipe/p_state.h"
#include "pipe/p_state.h"
-#include "util/u_memory.h"
#include "svga_context.h"
#include "svga_swtnl.h"
#include "svga_state.h"
#include "svga_context.h"
#include "svga_swtnl.h"
#include "svga_state.h"
-
+#include "svga_tgsi.h"
#include "svga_swtnl_private.h"
#include "svga_swtnl_private.h"
-#define SVGA_POINT_ADJ_X -0.375
-#define SVGA_POINT_ADJ_Y -0.5
+#define SVGA_POINT_ADJ_X -0.375
f
+#define SVGA_POINT_ADJ_Y -0.5
f
-#define SVGA_LINE_ADJ_X -0.5
-#define SVGA_LINE_ADJ_Y -0.5
+#define SVGA_LINE_ADJ_X -0.5
f
+#define SVGA_LINE_ADJ_Y -0.5
f
-#define SVGA_TRIANGLE_ADJ_X -0.375
-#define SVGA_TRIANGLE_ADJ_Y -0.5
+#define SVGA_TRIANGLE_ADJ_X -0.375
f
+#define SVGA_TRIANGLE_ADJ_Y -0.5
f
static void set_draw_viewport( struct svga_context *svga )
{
struct pipe_viewport_state vp = svga->curr.viewport;
static void set_draw_viewport( struct svga_context *svga )
{
struct pipe_viewport_state vp = svga->curr.viewport;
- float adjx = 0;
- float adjy = 0;
+ float adjx = 0
.0f
;
+ float adjy = 0
.0f
;
switch (svga->curr.reduced_prim) {
case PIPE_PRIM_POINTS:
switch (svga->curr.reduced_prim) {
case PIPE_PRIM_POINTS:
@@
-62,10
+61,10
@@
static void set_draw_viewport( struct svga_context *svga )
* going to be drawn with triangles, but we're not catching all
* cases where that will happen.
*/
* going to be drawn with triangles, but we're not catching all
* cases where that will happen.
*/
- if (svga->curr.rast->
templ.line_width > 1.0)
+ if (svga->curr.rast->
need_pipeline & SVGA_PIPELINE_FLAG_LINES)
{
{
- adjx = SVGA_LINE_ADJ_X + 0.175;
- adjy = SVGA_LINE_ADJ_Y - 0.175;
+ adjx = SVGA_LINE_ADJ_X + 0.175
f
;
+ adjy = SVGA_LINE_ADJ_Y - 0.175
f
;
}
else {
adjx = SVGA_LINE_ADJ_X;
}
else {
adjx = SVGA_LINE_ADJ_X;
@@
-81,11
+80,12
@@
static void set_draw_viewport( struct svga_context *svga )
vp.translate[0] += adjx;
vp.translate[1] += adjy;
vp.translate[0] += adjx;
vp.translate[1] += adjy;
- draw_set_viewport_state
(svga->swtnl.draw
, &vp);
+ draw_set_viewport_state
s(svga->swtnl.draw, 0, 1
, &vp);
}
}
-static int update_swtnl_draw( struct svga_context *svga,
- unsigned dirty )
+static enum pipe_error
+update_swtnl_draw( struct svga_context *svga,
+ unsigned dirty )
{
draw_flush( svga->swtnl.draw );
{
draw_flush( svga->swtnl.draw );
@@
-93,15
+93,19
@@
static int update_swtnl_draw( struct svga_context *svga,
draw_bind_vertex_shader(svga->swtnl.draw,
svga->curr.vs->draw_shader);
draw_bind_vertex_shader(svga->swtnl.draw,
svga->curr.vs->draw_shader);
+ if (dirty & SVGA_NEW_FS)
+ draw_bind_fragment_shader(svga->swtnl.draw,
+ svga->curr.fs->draw_shader);
+
if (dirty & SVGA_NEW_VBUFFER)
if (dirty & SVGA_NEW_VBUFFER)
- draw_set_vertex_buffers(svga->swtnl.draw,
+ draw_set_vertex_buffers(svga->swtnl.draw,
0,
svga->curr.num_vertex_buffers,
svga->curr.vb);
if (dirty & SVGA_NEW_VELEMENT)
draw_set_vertex_elements(svga->swtnl.draw,
svga->curr.num_vertex_buffers,
svga->curr.vb);
if (dirty & SVGA_NEW_VELEMENT)
draw_set_vertex_elements(svga->swtnl.draw,
- svga->curr.
num_vertex_elements
,
- svga->curr.ve );
+ svga->curr.
velems->count
,
+ svga->curr.ve
lems->velem
);
if (dirty & SVGA_NEW_CLIP)
draw_set_clip_state(svga->swtnl.draw,
if (dirty & SVGA_NEW_CLIP)
draw_set_clip_state(svga->swtnl.draw,
@@
-114,7
+118,8
@@
static int update_swtnl_draw( struct svga_context *svga,
if (dirty & SVGA_NEW_RAST)
draw_set_rasterizer_state(svga->swtnl.draw,
if (dirty & SVGA_NEW_RAST)
draw_set_rasterizer_state(svga->swtnl.draw,
- &svga->curr.rast->templ);
+ &svga->curr.rast->templ,
+ (void *) svga->curr.rast);
if (dirty & SVGA_NEW_FRAME_BUFFER)
draw_set_mrd(svga->swtnl.draw,
if (dirty & SVGA_NEW_FRAME_BUFFER)
draw_set_mrd(svga->swtnl.draw,
@@
-139,7
+144,8
@@
struct svga_tracked_state svga_update_swtnl_draw =
};
};
-int svga_swtnl_update_vdecl( struct svga_context *svga )
+enum pipe_error
+svga_swtnl_update_vdecl( struct svga_context *svga )
{
struct svga_vbuf_render *svga_render = svga_vbuf_render(svga->swtnl.backend);
struct draw_context *draw = svga->swtnl.draw;
{
struct svga_vbuf_render *svga_render = svga_vbuf_render(svga->swtnl.backend);
struct draw_context *draw = svga->swtnl.draw;
@@
-147,16
+153,17
@@
int svga_swtnl_update_vdecl( struct svga_context *svga )
SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS];
const enum interp_mode colorInterp =
svga->curr.rast->templ.flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS];
const enum interp_mode colorInterp =
svga->curr.rast->templ.flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
-
const
struct svga_fragment_shader *fs = svga->curr.fs;
+ struct svga_fragment_shader *fs = svga->curr.fs;
int offset = 0;
int nr_decls = 0;
int offset = 0;
int nr_decls = 0;
- int src, i;
+ int src;
+ unsigned i;
memset(vinfo, 0, sizeof(*vinfo));
memset(vdecl, 0, sizeof(vdecl));
/* always add position */
memset(vinfo, 0, sizeof(*vinfo));
memset(vdecl, 0, sizeof(vdecl));
/* always add position */
- src = draw_find_
vs
_output(draw, TGSI_SEMANTIC_POSITION, 0);
+ src = draw_find_
shader
_output(draw, TGSI_SEMANTIC_POSITION, 0);
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, src);
vinfo->attrib[0].emit = EMIT_4F;
vdecl[0].array.offset = offset;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, src);
vinfo->attrib[0].emit = EMIT_4F;
vdecl[0].array.offset = offset;
@@
-167,13
+174,15
@@
int svga_swtnl_update_vdecl( struct svga_context *svga )
nr_decls++;
for (i = 0; i < fs->base.info.num_inputs; i++) {
nr_decls++;
for (i = 0; i < fs->base.info.num_inputs; i++) {
- unsigned name = fs->base.info.input_semantic_name[i];
- unsigned index = fs->base.info.input_semantic_index[i];
- src = draw_find_vs_output(draw, name, index);
+ const unsigned sem_name = fs->base.info.input_semantic_name[i];
+ const unsigned sem_index = fs->base.info.input_semantic_index[i];
+
+ src = draw_find_shader_output(draw, sem_name, sem_index);
+
vdecl[nr_decls].array.offset = offset;
vdecl[nr_decls].array.offset = offset;
- vdecl[nr_decls].identity.usageIndex =
fs->base.info.input_semantic_index[i]
;
+ vdecl[nr_decls].identity.usageIndex =
sem_index
;
- switch (name) {
+ switch (
sem_
name) {
case TGSI_SEMANTIC_COLOR:
draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_COLOR;
case TGSI_SEMANTIC_COLOR:
draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src);
vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_COLOR;
@@
-185,7
+194,8
@@
int svga_swtnl_update_vdecl( struct svga_context *svga )
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_TEXCOORD;
vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT4;
draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src);
vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_TEXCOORD;
vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT4;
- vdecl[nr_decls].identity.usageIndex += 1;
+ vdecl[nr_decls].identity.usageIndex =
+ svga_remap_generic_index(fs->generic_remap_table, sem_index);
offset += 16;
nr_decls++;
break;
offset += 16;
nr_decls++;
break;
@@
-221,8
+231,9
@@
int svga_swtnl_update_vdecl( struct svga_context *svga )
}
}
-static int update_swtnl_vdecl( struct svga_context *svga,
- unsigned dirty )
+static enum pipe_error
+update_swtnl_vdecl( struct svga_context *svga,
+ unsigned dirty )
{
return svga_swtnl_update_vdecl( svga );
}
{
return svga_swtnl_update_vdecl( svga );
}