r600g: Add support for reading native instructions from the LLVM bytestream
authorTom Stellard <thomas.stellard@amd.com>
Mon, 27 Feb 2012 20:47:34 +0000 (15:47 -0500)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 2 May 2012 13:39:09 +0000 (09:39 -0400)
Signed-off-by: Tom Stellard <thomas.stellard@amd.com>
src/gallium/drivers/r600/r600_shader.c

index 5e22b35ba48b67982914e2cb79bf865448c4856f..e6cb3fa2d499e055b7043270016a68a4664f06e2 100644 (file)
@@ -405,6 +405,7 @@ static void r600_bytecode_from_byte_stream(struct r600_shader_ctx *ctx,
                                unsigned char * bytes,  unsigned num_bytes)
 {
        unsigned bytes_read = 0;
+       unsigned i, byte;
        while (bytes_read < num_bytes) {
                char inst_type = bytes[bytes_read++];
                switch (inst_type) {
@@ -420,6 +421,15 @@ static void r600_bytecode_from_byte_stream(struct r600_shader_ctx *ctx,
                        bytes_read = r600_fc_from_byte_stream(ctx, bytes,
                                                                bytes_read);
                        break;
+               case 3:
+                       r600_bytecode_add_cfinst(ctx->bc, CF_NATIVE);
+                       for (i = 0; i < 2; i++) {
+                               for (byte = 0 ; byte < 4; byte++) {
+                                       ctx->bc->cf_last->isa[i] |=
+                                       (bytes[bytes_read++] << (byte * 8));
+                               }
+                       }
+                       break;
                default:
                        /* XXX: Error here */
                        break;