summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_state_shader.c
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2009-02-12 23:36:21 -0800
committerCorbin Simpson <[email protected]>2009-02-12 23:36:21 -0800
commit8a2d0005af34cfaf88b2d70168fdfb2c91e79045 (patch)
tree6e81bd8c09292c7cc0bebd7a006d07d355ef7a9e /src/gallium/drivers/r300/r300_state_shader.c
parentfe7863f3f82cda290334cecfde816e21a0e9f5d3 (diff)
r300-gallium: Take care of various bad dereferences in shader setup.
Unbreaks glxinfo.
Diffstat (limited to 'src/gallium/drivers/r300/r300_state_shader.c')
-rw-r--r--src/gallium/drivers/r300/r300_state_shader.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/gallium/drivers/r300/r300_state_shader.c b/src/gallium/drivers/r300/r300_state_shader.c
index 352cb62df74..cb606c409aa 100644
--- a/src/gallium/drivers/r300/r300_state_shader.c
+++ b/src/gallium/drivers/r300/r300_state_shader.c
@@ -22,16 +22,32 @@
#include "r300_state_shader.h"
+static void r300_copy_passthrough_shader(struct r300_fragment_shader* fs)
+{
+ struct r300_fragment_shader* pt = &r300_passthrough_fragment_shader;
+ fs->shader.stack_size = pt->shader.stack_size;
+ fs->alu_instruction_count = pt->alu_instruction_count;
+ fs->tex_instruction_count = pt->tex_instruction_count;
+ fs->indirections = pt->indirections;
+ fs->instructions[0] = pt->instructions[0];
+}
+
+static void r500_copy_passthrough_shader(struct r500_fragment_shader* fs)
+{
+ struct r500_fragment_shader* pt = &r500_passthrough_fragment_shader;
+ fs->shader.stack_size = pt->shader.stack_size;
+ fs->instruction_count = pt->instruction_count;
+ fs->instructions[0] = pt->instructions[0];
+}
+
void r300_translate_shader(struct r300_context* r300,
struct r300_fragment_shader* fs)
{
- /* XXX fix this at some point */
- *fs = r300_passthrough_fragment_shader;
+ r300_copy_passthrough_shader(fs);
}
void r500_translate_shader(struct r300_context* r300,
struct r500_fragment_shader* fs)
{
- /* XXX fix this at some point */
- *fs = r500_passthrough_fragment_shader;
+ r500_copy_passthrough_shader(fs);
}